List of usage examples for android.app Activity startActivity
@Override public void startActivity(Intent intent)
From source file:Main.java
public static void standardUp(Activity activity) { Intent upIntent = NavUtils.getParentActivityIntent(activity); if (NavUtils.shouldUpRecreateTask(activity, upIntent)) { TaskStackBuilder.create(activity).addNextIntentWithParentStack(upIntent).startActivities(); } else {/*from ww w . ja va2 s .co m*/ upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); activity.startActivity(upIntent); activity.finish(); } }
From source file:Main.java
public static void restartPC(final Activity activity) { if (activity == null) return;// w ww . j a v a 2 s . c o m final int enter_anim = android.R.anim.fade_in; final int exit_anim = android.R.anim.fade_out; activity.overridePendingTransition(enter_anim, exit_anim); activity.finish(); activity.overridePendingTransition(enter_anim, exit_anim); activity.startActivity(activity.getIntent()); }
From source file:Main.java
public static void restartApp(final Activity activity) { if (activity == null) return;//from w ww.java2s . co m final int enter_anim = android.R.anim.fade_in; final int exit_anim = android.R.anim.fade_out; activity.overridePendingTransition(enter_anim, exit_anim); activity.finish(); activity.overridePendingTransition(enter_anim, exit_anim); activity.startActivity(activity.getIntent()); }
From source file:Main.java
/** * Open Calendar app with specific time/*from w ww. jav a 2s. co m*/ */ public static void openCalendar(Activity activity, long epochEventStartTime) { Uri uri = Uri.parse("content://com.android.calendar/time/" + epochEventStartTime); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(uri); intent.putExtra("VIEW", "DAY"); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); activity.startActivity(intent); }
From source file:Main.java
/** * Restarts activity, from http://stackoverflow.com/questions/1397361/how-do-i-restart-an-android-activity * @param activity the activity to restart *///from ww w . ja v a 2s. co m @TargetApi(11) public static void restartActivity(Activity activity) { if (Build.VERSION.SDK_INT >= 11) { activity.recreate(); } else { Intent intent = activity.getIntent(); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); activity.finish(); activity.overridePendingTransition(0, 0); activity.startActivity(intent); activity.overridePendingTransition(0, 0); } }
From source file:com.app.common.util.IntentUtils.java
public static void start_activity(Activity activity, Class<?> cls, BasicNameValuePair... name) { Intent intent = new Intent(); intent.setClass(activity, cls);/*from w ww . ja v a 2 s. com*/ for (int i = 0; i < name.length; i++) { intent.putExtra(name[i].getName(), name[i].getValue()); } activity.startActivity(intent); }
From source file:codepath.watsiapp.utils.Util.java
public static void startFundTreatmentIntent(Activity activity, ShareableItem patient) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(patient.getShareableUrl())); activity.startActivity(browserIntent); // overridePendingTransition(R.anim.right_in, R.anim.left_out); // activity.overridePendingTransition(R.anim.slide_in_right,R.anim.slide_out_left); }
From source file:com.ouyangzn.github.utils.Actions.java
/** * /*from w w w . j a v a 2s . c o m*/ * * @param activity ?activity * @param url url */ public static void openUrl(Activity activity, String url) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); activity.startActivity(intent); }
From source file:Main.java
public static void restartTW(final Activity activity) { if (activity == null) return;/*from ww w . j av a 2s .c o m*/ final int enter_anim = android.R.anim.fade_in; final int exit_anim = android.R.anim.fade_out; activity.overridePendingTransition(enter_anim, exit_anim); activity.finish(); activity.overridePendingTransition(enter_anim, exit_anim); activity.startActivity(activity.getIntent()); }
From source file:codepath.watsiapp.utils.Util.java
public static void starShowMedicalPartnerIntent(Activity activity, MedicalPartner medicalPartner) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(medicalPartner.getWebsiteUrl())); activity.startActivity(browserIntent); }