Example usage for android.content Intent Intent

List of usage examples for android.content Intent Intent

Introduction

In this page you can find the example usage for android.content Intent Intent.

Prototype

public Intent(Context packageContext, Class<?> cls) 

Source Link

Document

Create an intent for a specific component.

Usage

From source file:Main.java

public static void startActivityLeftOutRightInWithFinish(Context context, Class clazz) {
    Intent intent = new Intent(context, clazz);
    context.startActivity(intent);/*from ww  w  . j ava2  s . c om*/
    ((Activity) context).finish();
}

From source file:Main.java

public static void intentDirection(Context context, double latitude, double longitude) {
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
            Uri.parse("http://maps.google.com/maps?daddr=" + latitude + "," + longitude));
    context.startActivity(intent);/*from ww  w  .  j a va  2 s  .  c om*/
}

From source file:Main.java

public static void openSendMsg(Context context) {
    Uri uri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from w  w w.j  a v a 2 s .com*/
}

From source file:Main.java

public static void openSendMsg(Context getContext) {
    Uri uri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getContext.startActivity(intent);/*from  ww  w . j a  va2s . c om*/
}

From source file:Main.java

public static void openMap(Context context, String uri) {
    Uri mUri = Uri.parse(uri);/*ww w  .  j  a  v  a2  s. com*/
    Intent mIntent = new Intent(Intent.ACTION_VIEW, mUri);
    context.startActivity(mIntent);
}

From source file:Main.java

public static void openLink(Context context, String url) {
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    i.setData(Uri.parse(url));/*from   w  w w .j a va  2 s. c o  m*/
    context.startActivity(i);
}

From source file:Main.java

public static void startActivity(Context context, Class<?> clz, boolean isFinishSelf) {
    context.startActivity(new Intent(context, clz));
    if (isFinishSelf) {
        ((Activity) context).finish();/*  w  ww  .  j av a2s  . com*/
    }
}

From source file:Main.java

public static void goWebByUrl(Context context, String url) {
    Uri uri = Uri.parse(url);//from w  w w  . j  a  v a2 s .com
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(intent);
}

From source file:Main.java

public static void IntentWebPage(Context context, String url) {
    Uri uri = Uri.parse(url);//  w w  w.  j  a va  2 s . com
    Intent it = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(it);
}

From source file:Main.java

public static Intent getSendSmsIntent(String phoneNumber, String content) {
    Uri uri = Uri.parse("smsto:" + phoneNumber);
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra("sms_body", content);
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}