List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
/** * Creates an intent to open a link.//from w w w . j a v a 2s . c o m * * @param url The url to be opened. * @param context The context needed to start the intent. */ public static void openLink(String url, Context context) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); context.startActivity(intent); }
From source file:Main.java
public static void toNextActivityAndFinish(Context packageContext, Class<?> cls) { Intent i = new Intent(packageContext, cls); packageContext.startActivity(i); ((Activity) packageContext).finish(); }
From source file:Main.java
/** * Activity Finish Jump//from w ww.j a v a 2 s .co m */ public static void gotoActivityFinish(Context context, Class<?> actClass) { Intent intent = new Intent(context, actClass); context.startActivity(intent); ((Activity) context).finish(); }
From source file:Main.java
/** * starts an activity/*from w w w. j a v a2 s. com*/ * * @param context context of calling activity * @param nextClass activity class to be opened */ public static void startActivity(Context context, Class nextClass) { Intent intent = new Intent(context, nextClass); context.startActivity(intent); }
From source file:Main.java
public static void openGPS(Context context) { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); context.startActivity(intent); }
From source file:Main.java
public static void sendMail(Context mContext, String mailID) { Uri uri = Uri.parse("mailto:" + mailID); mContext.startActivity(new Intent(Intent.ACTION_SENDTO, uri)); }
From source file:Main.java
public static void finish(Context packageContext, Class<?> cls) { Intent intent = new Intent(packageContext, cls); packageContext.startActivity(intent); ((Activity) packageContext).finish(); }
From source file:Main.java
public static void toWIFISettingActivity(Context mContext) { Intent wifiSettingsIntent = new Intent(Settings.ACTION_WIFI_SETTINGS); mContext.startActivity(wifiSettingsIntent); }
From source file:Main.java
public static void settings(Context context) { if (context == null) return;/*from w w w . j a va2s . c o m*/ try { context.startActivity(new Intent(Settings.ACTION_SETTINGS)); } catch (ActivityNotFoundException e) { } catch (Exception e) { } }
From source file:Main.java
public static void startSetNetActivity(Context activity) { Intent intent = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS); activity.startActivity(intent); }