List of utility methods to do Intent Create
void | callHTTPDownload(Context context, String chooserTilte, String url) call HTTP Download if (null == context) { return; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(URLUtil.guessUrl(url))); try { context.startActivity(Intent .createChooser(intent, chooserTilte).addFlags( ... |
void | callPhone(Context context, String number) call Phone if (null == context) { return; Intent intent = new Intent(); intent.setAction(Intent.ACTION_CALL); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("tel:" + number)); context.startActivity(intent); ... |
Intent | constructGoogleCalendarIntentVariant1() Google calendar intent variant 1 final Intent intent = new Intent(); return intent.setClassName("com.android.calendar", "com.android.calendar.AgendaActivity"); |
Intent | constructGoogleCalendarIntentVariant2() Google calendar intent variant 1 final Intent intent = new Intent(); final long startTimeMillis = System.currentTimeMillis(); final String url = "content://com.android.calendar/time/" + startTimeMillis; intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); return intent; |
void | createNotification(Intent resultIntent, Context current, final Class> destination) create Notification NotificationManager mNotificationManager = (NotificationManager) current .getSystemService(Context.NOTIFICATION_SERVICE); mBuilder = new NotificationCompat.Builder(current) .setContentTitle("Ho") .setContentText("You've received a new hoot") .setSmallIcon(R.drawable.ic_owl_white).setAutoCancel(true) .setNumber(numMessages++); if (numMessages > 1) { ... |
Object | getExtraObject(Activity context, String key) Used to get the parameter values passed into Activity via a Bundle. if (context == null) return null; Object param = null; Bundle bundle = context.getIntent().getExtras(); if (bundle != null) { param = bundle.get(key); return param; ... |
void | gotoHome(Context context) goto Home Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addCategory(Intent.CATEGORY_HOME);
context.startActivity(intent);
|
void | locate(Context context, String chooserTilte, String lat, String lng, String addr) locate if (null == context) { return; Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); String uri = "geo:0,0" + "?q=" + lat + "," + lng; if (null != addr && addr.length() > 0) { ... |
void | putParamters(Intent intent, Object[] parameters) put Paramters if (parameters.length % 2 == 0) { for (int i = 0; i < parameters.length / 2; i += 2) { if (parameters[i] instanceof String && parameters[i + 1] instanceof Long) { intent.putExtra((String) parameters[i], (Long) parameters[i + 1]); |
void | to(Context context, Class> cls) to to(context, cls, null); |