Example usage for android.app Activity startActivity

List of usage examples for android.app Activity startActivity

Introduction

In this page you can find the example usage for android.app Activity startActivity.

Prototype

@Override
public void startActivity(Intent intent) 

Source Link

Document

Same as #startActivity(Intent,Bundle) with no options specified.

Usage

From source file:Main.java

public static void openSourceURL(Activity activity, String title, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri uri = Uri.parse(url);//  www  .j  a v  a 2  s .  c o m
    intent.setData(uri);
    activity.startActivity(Intent.createChooser(intent, title));
}

From source file:Main.java

public static void launch(Activity activity, String packageName) {
    Intent intent = activity.getPackageManager().getLaunchIntentForPackage(packageName);
    if (null != intent) {
        activity.startActivity(intent);
    }//from w  w w  .j a v  a  2  s.  c o  m
}

From source file:Main.java

public static <T extends Activity> void startActivity(Activity parent, Class<T> clazz, boolean killParent) {
    Intent intent = new Intent(parent, clazz);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    parent.startActivity(intent);

    if (killParent) {
        parent.finish();//from  w  w w  .ja v a 2 s .co  m
    }
}

From source file:Main.java

/**
 * Opens the dialer app with my number/*w  w  w  . j a va  2 s.  com*/
 * @param activity the calling activity
 * @param phoneNumber the phone number to call
 */
public static void openPhoneDialer(Activity activity, String phoneNumber) {
    Intent phoneIntent = new Intent(Intent.ACTION_DIAL);
    phoneIntent.setData(Uri.parse("tel:" + phoneNumber));
    activity.startActivity(phoneIntent);
}

From source file:com.acv.gallery.view.activity.ImageDetailActivity.java

public static void launch(Activity activity, List<Image> images, int currentPosition) {
    activity.startActivity(newInstance(activity, images, currentPosition));
}

From source file:com.andryr.musicplayer.utils.NavigationUtils.java

public static void showEqualizer(Activity activity) {
    Intent i = new Intent(activity, EqualizerActivity.class);
    activity.startActivity(i);
}

From source file:Main.java

public static void sendMessageText(Activity activity, String text) {
    Intent it = new Intent(Intent.ACTION_VIEW);
    it.putExtra("sms_body", text);
    it.setType("vnd.android-dir/mms-sms");
    activity.startActivity(it);
}

From source file:Main.java

protected static void startActivity(Activity activity, Class cls, int flags) {
    Intent intent = new Intent(activity, cls);
    if (flags > 0) {
        intent.addFlags(flags);//from   w w w  . j a  va  2s  .  c  om
    }
    activity.startActivity(intent);
}

From source file:com.andryr.musicplayer.utils.NavigationUtils.java

public static void showPreferencesActivity(Activity activity) {
    Intent i = new Intent(activity, PreferencesActivity.class);
    activity.startActivity(i);
}

From source file:Main.java

public static void startActivity(Activity a, Intent intent, int requestCode) {
    if (requestCode >= 0) {
        a.startActivityForResult(intent, requestCode);
    } else {/*from   w w  w  .  ja v  a 2 s .  c  o m*/
        a.startActivity(intent);
    }
}