List of usage examples for android.app Activity startActivity
@Override public void startActivity(Intent intent)
From source file:Main.java
public static boolean startActivityUsingScheme(Activity a, String scheme, Bundle args) { Uri uri = Uri.parse(scheme + "://"); Intent intent = new Intent(Intent.ACTION_RUN, uri); boolean result = true; try {//w ww. j a va2 s .com intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); if (args != null) intent.putExtras(args); a.startActivity(intent); } catch (Exception e) { Log.e(a.getClass().getName(), e.getMessage(), e); result = false; } return result; }
From source file:com.yutong.axxc.parents.view.common.ActivityUtils.java
/** * ????/*from ww w . ja v a 2 s. c o m*/ * @param activity * @param telNumber */ public static void call(Activity activity, String telNumber) { Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + telNumber)); activity.startActivity(intent); }
From source file:com.binomed.showtime.android.util.CineShowTimeLayoutUtils.java
/** * Set the theme of the Activity, and restart it by creating a new Activity of the same type. *//*from w w w.j a v a 2 s . c om*/ public static void changeToTheme(Activity activity, Intent originalIntent) { activity.finish(); Intent newIntent = new Intent(activity, activity.getClass()); newIntent.replaceExtras(originalIntent); activity.startActivity(newIntent); }
From source file:com.burnevsky.firu.TranslationsActivity.java
public static void showWords(Activity caller, ArrayList<Word> words, int selection) { Intent intent = new Intent(caller, TranslationsActivity.class); intent.putParcelableArrayListExtra(TranslationsActivity.INTENT_EXTRA_WORD_LIST, words); intent.putExtra(TranslationsActivity.INTENT_EXTRA_WORD_IDX, selection); caller.startActivity(intent); }
From source file:com.github.rutvijkumar.twittfuse.Util.java
public static void onProfileView(Activity activity) { Intent profileViewIntent = new Intent(activity, ProfileViewActivity.class); activity.startActivity(profileViewIntent); }
From source file:com.farproc.wifi.connecter.TestWifiScan.java
private static void downloadWifiConnecter(final Activity activity) { Intent downloadIntent = new Intent(Intent.ACTION_VIEW) .setData(Uri.parse("market://details?id=com.farproc.wifi.connecter")); try {/*w w w . j a v a 2 s .c om*/ activity.startActivity(downloadIntent); Toast.makeText(activity, "Please install this app.", Toast.LENGTH_LONG).show(); } catch (ActivityNotFoundException e) { // Market app is not available in this device. // Show download page of this project. try { downloadIntent.setData(Uri.parse("http://code.google.com/p/android-wifi-connecter/downloads/list")); activity.startActivity(downloadIntent); Toast.makeText(activity, "Please download the apk and install it manully.", Toast.LENGTH_LONG) .show(); } catch (ActivityNotFoundException e2) { // Even the Browser app is not available!!!!! // Show a error message! Toast.makeText(activity, "Fatel error! No web browser app in your device!!!", Toast.LENGTH_LONG) .show(); } } }
From source file:Main.java
/** * Restart the Activity/*from w w w. j ava 2 s. c o m*/ * * @param activity */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void restartActivity(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { activity.recreate(); } else { Intent intent = activity.getIntent(); activity.overridePendingTransition(0, 0); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); activity.finish(); activity.overridePendingTransition(0, 0); activity.startActivity(intent); } }
From source file:com.ruesga.rview.misc.ActivityHelper.java
public static void openSearchActivity(Activity activity) { Intent intent = new Intent(activity, SearchActivity.class); activity.startActivity(intent);/*from w ww. j a v a2s.co m*/ activity.overridePendingTransition(0, 0); }
From source file:Main.java
public static void openActivity(Activity activity, Class<?> pClass, Bundle pBundle, int requestCode, int enterAnim, int exitAnim) { if (null == activity) return;/*from www . jav a 2s .c om*/ Intent intent = new Intent(activity, pClass); if (pBundle != null) { intent.putExtras(pBundle); } if (requestCode < 0) { activity.startActivity(intent); } else { activity.startActivityForResult(intent, requestCode); } if (enterAnim > 0 && exitAnim > 0) { activity.overridePendingTransition(enterAnim, exitAnim); } }
From source file:com.ntsync.android.sync.activities.AbstractFragmentActivity.java
public static boolean onSelectMenuItem(Activity activity, MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(activity); return true; case R.id.action_settings: // Show Settings Intent intent = new Intent(activity, SettingsPreferenceActivity.class); activity.startActivity(intent); return true; case R.id.action_about: // Show Settings intent = new Intent(activity, AboutActivity.class); activity.startActivity(intent);/* ww w . ja v a2 s . c om*/ return true; case R.id.action_viewkey: // Show Key intent = new Intent(activity, ViewKeyPasswordActivity.class); activity.startActivity(intent); return true; default: if (BuildConfig.DEBUG) { throw new IllegalArgumentException("Invalid MenuId:" + item.getItemId()); } LogHelper.logW(TAG, "Unsupported MenuId:" + item.getItemId()); } return false; }