List of usage examples for android.app Activity startActivity
@Override public void startActivity(Intent intent)
From source file:org.geek.utils.ApplicationUtils.java
/** * Share a page.// w ww .ja va 2s . c om * @param activity The parent activity. * @param title The page title. * @param url The page url. */ public static void sharePage(Activity activity, String title, String url) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, url); shareIntent.putExtra(Intent.EXTRA_SUBJECT, title); try { activity.startActivity( Intent.createChooser(shareIntent, activity.getString(R.string.Main_ShareChooserTitle))); } catch (android.content.ActivityNotFoundException ex) { // if no app handles it, do nothing } }
From source file:com.shareyourproxy.IntentLauncher.java
/** * Add a new group or edit a selected group and it's channels. * * @param activity context//from w ww.j a v a2 s . c o m * @param group selected * @param groupEditType add edit or public group */ public static void launchEditGroupChannelsActivity(Activity activity, Group group, GroupEditType groupEditType) { Intent intent = new Intent(Intents.ACTION_EDIT_GROUP_CHANNEL); intent.putExtra(ARG_SELECTED_GROUP, group); intent.putExtra(ARG_EDIT_GROUP_TYPE, groupEditType); activity.startActivity(intent); activity.overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out); }
From source file:com.mycelium.wallet.activity.send.SendMainActivity.java
public static void callMe(Activity currentActivity, UUID account, Long amountToSend, Address receivingAddress, boolean isColdStorage) { Intent intent = new Intent(currentActivity, SendMainActivity.class); intent.putExtra("account", account); intent.putExtra("amountToSend", amountToSend); intent.putExtra("receivingAddress", receivingAddress); intent.putExtra("isColdStorage", isColdStorage); intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); currentActivity.startActivity(intent); }
From source file:com.mercandalli.android.apps.files.file.image.FileImageActivity.java
public static void startOnlineImage(final @NonNull Activity activity, final @NonNull FileModel fileModel, final @Nullable View iconAnimationView, final @Nullable View titleAnimationView) { Preconditions.checkNotNull(activity); Preconditions.checkNotNull(fileModel); final Intent intent = new Intent(activity, FileImageActivity.class); intent.putExtra("ID", fileModel.getId()); intent.putExtra("TITLE", "" + fileModel.getFullName()); intent.putExtra("URL_FILE", "" + fileModel.getOnlineUrl()); intent.putExtra("CLOUD", true); intent.putExtra("SIZE_FILE", fileModel.getSize()); intent.putExtra("DATE_FILE", fileModel.getDateCreation()); if (iconAnimationView == null || titleAnimationView == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { activity.startActivity(intent); activity.overridePendingTransition(R.anim.left_in, R.anim.left_out); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { activity.startActivity(intent,// w ww .j ava 2 s .c o m ActivityOptionsCompat.makeSceneTransitionAnimation(activity, Pair.create(iconAnimationView, "transitionIcon"), Pair.create(titleAnimationView, "transitionTitle")).toBundle()); } }
From source file:com.mycelium.wallet.activity.send.SendMainActivity.java
public static void callMe(Activity currentActivity, UUID account, BitcoinUri uri, boolean isColdStorage) { Intent intent = new Intent(currentActivity, SendMainActivity.class); intent.putExtra("account", account); intent.putExtra("amountToSend", uri.amount); intent.putExtra("receivingAddress", uri.address); intent.putExtra("transactionLabel", uri.label); intent.putExtra("isColdStorage", isColdStorage); intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); currentActivity.startActivity(intent); }
From source file:com.shareyourproxy.IntentLauncher.java
/** * View Ello profile/* w w w .j a v a 2 s. c o m*/ * * @param activity context * @param userId ello user id */ public static void launchElloIntent(Activity activity, String userId) { StringBuilder sb = new StringBuilder("https:ello.co/").append(userId); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString())); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:com.shareyourproxy.IntentLauncher.java
/** * View Address in maps//from w ww . j a v a2s . c o m * * @param activity context * @param actionAddress location */ public static void launchAddressIntent(Activity activity, String actionAddress) { StringBuilder sb = new StringBuilder("geo:0,0?q=").append(actionAddress); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString())); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:com.androidquery.simplefeed.fragments.FeedFragment.java
public static void startIntent(Activity act, String url) { Intent intent = new Intent(act, FeedActivity.class); intent.putExtra("url", url); act.startActivity(intent); }
From source file:com.shareyourproxy.IntentLauncher.java
/** * Launch Email Intent./*from ww w.ja v a 2s.c o m*/ * * @param activity context * @param address to send to */ public static void launchEmailIntent(Activity activity, String address) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address }); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:com.google.android.apps.forscience.whistlepunk.PictureUtils.java
public static void launchExternalViewer(Activity activity, String fileUrl) { Intent intent = new Intent(Intent.ACTION_VIEW); String extension = MimeTypeMap.getFileExtensionFromUrl(fileUrl); String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); if (!TextUtils.isEmpty(type)) { String filePath = fileUrl; if (filePath.startsWith("file:")) { filePath = filePath.substring("file:".length()); }// w ww . j a v a 2 s . c om Uri photoUri = FileProvider.getUriForFile(activity, activity.getPackageName(), new File(filePath)); intent.setDataAndType(photoUri, type); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // Needed to avoid security exception on KitKat. intent.setClipData(ClipData.newRawUri(null, photoUri)); } intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); try { activity.startActivity(intent); } catch (ActivityNotFoundException e) { Log.e(TAG, "No activity found to handle this " + fileUrl + " type " + type); } } else { Log.w(TAG, "Could not find mime type for " + fileUrl); } }