List of usage examples for android.app Activity startActivity
@Override public void startActivity(Intent intent)
From source file:com.androidquery.service.MarketService.java
private static boolean openUrl(Activity act, String url) { try {/*from w ww . ja v a2 s . c o m*/ if (url == null) return false; Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); act.startActivity(intent); return true; } catch (Exception e) { return false; } }
From source file:com.brq.wallet.activity.receive.ReceiveCoinsActivity.java
public static void callMe(Activity currentActivity, Address address, boolean havePrivateKey, boolean showIncomingUtxo) { Intent intent = new Intent(currentActivity, ReceiveCoinsActivity.class); intent.putExtra("address", address); intent.putExtra("havePrivateKey", havePrivateKey); intent.putExtra("showIncomingUtxo", showIncomingUtxo); currentActivity.startActivity(intent); }
From source file:com.forrestguice.suntimeswidget.AlarmDialog.java
/** * @param context a context used to start the "show alarm" intent *///from ww w .j a va 2s . c o m @TargetApi(Build.VERSION_CODES.KITKAT) public static void showAlarms(Activity context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Intent alarmsIntent = new Intent(AlarmClock.ACTION_SHOW_ALARMS); alarmsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (alarmsIntent.resolveActivity(context.getPackageManager()) != null) { context.startActivity(alarmsIntent); } } }
From source file:de.da_sense.moses.client.abstraction.ApkMethods.java
/** * Start an application by the name of the package. * /*from w ww.j ava 2 s.co m*/ * @param packageName package name of the app to start * @param baseActivity the base activity * @throws NameNotFoundException */ public static void startApplication(String packageName, Activity baseActivity) throws NameNotFoundException { if (baseActivity == null) { Log.e("ApkMethods", "the context was NULL for the package: " + packageName); } Intent intent = baseActivity.getApplicationContext().getPackageManager() .getLaunchIntentForPackage(packageName); Log.d("ApkMethods", "created intent, about to launch other application with packageName: " + packageName); baseActivity.startActivity(intent); }
From source file:com.felkertech.n.ActivityUtils.java
public static void launchLiveChannels(Activity mActivity) { Intent i = new Intent(Intent.ACTION_VIEW, TvContract.Channels.CONTENT_URI); try {//from w w w . j a v a2s . c o m mActivity.startActivity(i); } catch (Exception e) { Toast.makeText(mActivity, R.string.no_live_channels, Toast.LENGTH_SHORT).show(); } }
From source file:com.andrewshu.android.reddit.common.Common.java
/** http://developer.android.com/guide/topics/ui/actionbar.html#Home */ public static void goHome(Activity activity) { // app icon in action bar clicked; go home Intent intent = new Intent(activity, ThreadsListActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); activity.startActivity(intent); }
From source file:au.id.micolous.frogjump.Util.java
private static void newVersionAlert(final Activity activity) { // We have a new version available. Prompt. AlertDialog.Builder updateDialog = new AlertDialog.Builder(activity); updateDialog.setTitle(R.string.update_available_title); updateDialog.setMessage(R.string.update_available_message); updateDialog.setPositiveButton(R.string.update_positive, new DialogInterface.OnClickListener() { @Override/* w w w. j a v a2 s. c om*/ public void onClick(DialogInterface dialogInterface, int i) { try { activity.startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName()))); } catch (ActivityNotFoundException anfe) { // Hmm, market is not installed Log.w(TAG, "Google Play is not installed; cannot install update"); } } }); updateDialog.setNegativeButton(R.string.update_negative, null); updateDialog.setCancelable(true); updateDialog.show(); }
From source file:com.eyekabob.util.EyekabobHelper.java
public static void launchEmail(Activity activity) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("plain/text"); String to[] = { "philj21@yahoo.com", "adam.sill01@gmail.com", "coffbr01@gmail.com" }; emailIntent.putExtra(Intent.EXTRA_EMAIL, to); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Eyekabob Advertising"); String label = activity.getResources().getString(R.string.write_email); activity.startActivity(Intent.createChooser(emailIntent, label)); }
From source file:com.felkertech.n.ActivityUtils.java
public static void openStream(Activity activity, String url) { Intent i = new Intent(activity, CumulusTvPlayer.class); i.putExtra(CumulusTvPlayer.KEY_VIDEO_URL, url); activity.startActivity(i); }
From source file:com.felkertech.n.ActivityUtils.java
public static void openIntroIfNeeded(Activity activity) { SettingsManager sm = new SettingsManager(activity); if (sm.getInt(R.string.sm_last_version) < LAST_GOOD_BUILD) { activity.startActivity(new Intent(activity, Intro.class)); activity.finish();//from w ww. jav a 2 s. co m } }