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
/** | |
* Alert 1 | |
* Normal Alert | |
*/ | |
AlertDialog.Builder alertDialog = new AlertDialog.Builder(your_activity.this); // we build alert | |
alertDialog.setMessage("Alert_text") // alert text with setMessage() method | |
.setCancelable(true); // user can cancel this alert for 'true' | |
AlertDialog alert = alertDialog.create(); // we create alert for show | |
alert.setTitle("Alert_title"); |
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
Intent intent = new Intent(); | |
PendingIntent my_pIntent = PendingIntent.getActivities(your_activity.this, | |
0, new Intent[]{intent},0); | |
Notification mynoti = new Notification.Builder(your_activity.this) | |
.setTicker("Ticker_Text") | |
.setContentTitle("Content_Title") | |
.setContentText("Content_Text") | |
.setSmallIcon(R.mipmap.ic_launcher) | |
.setContentIntent(my_pIntent).getNotification(); |
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; | |
} |
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
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
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
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
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
/** | |
* @author Shariful Islam | |
* From : 11/01/2018 | |
*/ | |
/** | |
* java_po | |
* -> array_po | |
* ---> checkArrays (all data) | |
* ---> arrangement (String) | |
*/ |
OlderNewer