This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import android.support.v7.widget.Toolbar; | |
public void all_about_toolbar(){ | |
/** | |
* create Toolbar and set Title, subTitle, textColor | |
*/ | |
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar_id); | |
toolbar.setTitle("app_title"); | |
setSupportActionBar(toolbar); | |
toolbar.setTitleTextColor(Color.COLOR_NAME); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* simple handler and runnable | |
*/ | |
final Handler myHandler = new Handler(); | |
myHandler.postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
myHandler.postDelayed(this, 5000); // The interval time | |
// what we want to do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Shariful Islam | |
* From : 11/01/2018 | |
*/ | |
/** | |
* java_po | |
* -> array_po | |
* ---> checkArrays (all data) | |
* ---> arrangement (String) | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private GestureDetectorCompat gd; | |
// into onCreate method -----> | |
gd = new GestureDetectorCompat(this,this); | |
gd.setOnDoubleTapListener(this); | |
// <----- into onCreate method | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static final int dialog_id = 0; | |
int year_x, month_x, day_x; | |
final Calendar cal = Calendar.getInstance(); | |
year_x = cal.get(Calendar.YEAR); | |
month_x = cal.get(Calendar.MONTH); | |
day_x = cal.get(Calendar.DAY_OF_MONTH); | |
// call 'showDialog(dialog_id)' method for show data picker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static final int dialog_id = 0; | |
int hour_x, minute_x; | |
@Override | |
protected Dialog onCreateDialog(int id){ | |
if(id == dialog_id) { | |
return new TimePickerDialog(your_activity.this, getTime, hour_x, minute_x, true); | |
} | |
return null; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Database extends SQLiteOpenHelper { | |
public Database(Context context) { | |
super(context, "database_name", null, 1); | |
} | |
@Override | |
public void onCreate(SQLiteDatabase sqLiteDatabase) { | |
sqLiteDatabase.execSQL("CREATE TABLE table_name (table_id INTEGER PRIMARY KEY AUTOINCREMENT," + | |
"column_1 TEXT, column_2 TEXT)"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ListView list_view = (ListView) findViewById(R.id.list_view_id); | |
ArrayAdapter<String> myadapter = new ArrayAdapter<String>(this, R.layout.textView_xml_for_show_list_text, itemes); | |
list_view.setAdapter(myadapter); | |
list_view.setOnItemClickListener(new AdapterView.OnItemClickListener() { | |
@Override | |
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { | |
String value = (String) list_view.getItemAtPosition(i); | |
Toast.makeText(MainActivity.this,"Position : " + i + "Value : " + value, Toast.LENGTH_LONG).show(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* create service | |
*/ | |
public class service_Name extends Service { | |
@Nullable | |
@Override | |
public IBinder onBind(Intent intent) { | |
return null; | |
} |