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

/**
 * Launch Application Setting to grant permission.
 *//*from w  w  w . j  a  v a  2 s . co  m*/
public static void launchPermissionSettings(Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    intent.setData(Uri.fromParts("package", activity.getPackageName(), null));
    activity.startActivity(intent);
}

From source file:com.samknows.measurement.util.LoginHelper.java

public static void openActivatingScreen(Activity acc) {
    Intent intent = new Intent(acc, SamKnowsActivating.class);
    acc.startActivity(intent);
    acc.finish();/*  www.  ja  va2 s  . c  om*/
}

From source file:butter.droid.activities.StreamLoadingActivity.java

public static Intent startActivity(Activity activity, StreamInfo info) {
    Intent i = new Intent(activity, StreamLoadingActivity.class);
    i.putExtra(EXTRA_INFO, info);/*w  ww . ja v a 2 s  . c om*/
    activity.startActivity(i);
    return i;
}

From source file:Main.java

public static void shareText(Activity activity, String title, String text) {
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, text);
    sendIntent.setType("text/plain");
    activity.startActivity(Intent.createChooser(sendIntent, title));
}

From source file:com.ran.pics.activity.ImageSearchResultActivity.java

public static void startImageSearchResultActivity(Activity fromActivity, String keyword) {
    Intent intent = new Intent(fromActivity, ImageSearchResultActivity.class);
    intent.putExtra(KEY_WORD, keyword);//from   w w  w .j av a  2  s. c  om
    fromActivity.startActivity(intent);
}

From source file:Main.java

/**
 * Open the specified map in Collector for ArcGIS.
 *
 * @param activity  the activity launching Collector for ArcGIS.
 * @param mapItemId The web map item ID to open within Collector.
 * @param mapCenter Specified as a set of latitude, longitude (y,x) coordinates. Coordinates must be in WGS84 coordinates. (optional)
 * @throws IllegalArgumentException if the map item id passed in is null or empty
 *//*from   w  w  w .j  a  v  a 2 s .  com*/
public static void openMapInCollector(Activity activity, String mapItemId, String mapCenter) {
    Uri uriBuilder = generateUri(mapItemId, mapCenter);

    Intent mapIntent = new Intent(Intent.ACTION_VIEW, uriBuilder);
    activity.startActivity(mapIntent);
}

From source file:Main.java

public static void openApplicationSettings(Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
    intent.setData(uri);/*from   ww  w .ja va  2 s .  c o m*/
    activity.startActivity(intent);
}

From source file:butter.droid.tv.activities.TVStreamLoadingActivity.java

public static Intent startActivity(Activity activity, StreamInfo info) {
    Intent i = new Intent(activity, TVStreamLoadingActivity.class);
    i.putExtra(EXTRA_STREAM_INFO, info);
    activity.startActivity(i);
    return i;//from   w w  w . j  a v  a2s.co  m
}

From source file:Main.java

public static void sendText(Activity context, String text) {
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    //        sendIntent.putExtra(Intent.EXTRA_TEXT, text);
    //        sendIntent.setType("text/plain");
    context.startActivity(Intent.createChooser(sendIntent, text));
}

From source file:Main.java

/**
 * Finish the given activity and start a home activity class.
 * <p>/*from  w ww. ja v a  2s  .  com*/
 * This mirror the behavior of the home action bar button that clears the
 * current activity and starts or brings another activity to the top.
 *
 * @param activity
 * @param homeActivityClass
 */
public static void goHome(Activity activity, Class<?> homeActivityClass) {
    activity.finish();
    Intent intent = new Intent(activity, homeActivityClass);
    intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
    activity.startActivity(intent);
}