Android Utililty Methods Intent Create

List of utility methods to do Intent Create

Description

The list of methods to do Intent Create are organized into topic(s).

Method

voidcallHTTPDownload(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(
...
voidcallPhone(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);
...
IntentconstructGoogleCalendarIntentVariant1()
Google calendar intent variant 1
final Intent intent = new Intent();
return intent.setClassName("com.android.calendar",
        "com.android.calendar.AgendaActivity");
IntentconstructGoogleCalendarIntentVariant2()
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;
voidcreateNotification(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) {
...
ObjectgetExtraObject(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;
...
voidgotoHome(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);
voidlocate(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) {
...
voidputParamters(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]);
voidto(Context context, Class cls)
to
to(context, cls, null);