Refine search
public static void addKeepAliveExtra(Context context, Intent intent) { Intent keepAliveIntent = new Intent().setClassName( context.getPackageName(), KeepAliveService.class.getCanonicalName()); intent.putExtra(EXTRA_CUSTOM_TABS_KEEP_ALIVE, keepAliveIntent); }
@Override public void onReceive(Context context, Intent intent) { //start activity Intent i = new Intent(); i.setClassName("com.test", "com.test.MainActivity"); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); }
Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.setType("plain/text"); sendIntent.setData(Uri.parse("test@gmail.com")); sendIntent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail"); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "test@gmail.com" }); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "test"); sendIntent.putExtra(Intent.EXTRA_TEXT, "hello. this is a message sent from my demo app :-)"); startActivity(sendIntent);
Intent intent = new Intent("com.android.vending.billing.PURCHASE"); intent.setClassName("com.android.vending", "com.google.android.finsky.billing.lightpurchase.LightPurchaseFlowActivity"); intent.putExtra(EXTRA_NAME, EXTRA_VALUE); startActivityForResult(intent, 0);
Intent intent=new Intent(); intent.setClassName(this,"com.mainscreen.activity1"); startActivity(intent);
public void openGPlus(String profile) { try { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName("com.google.android.apps.plus", "com.google.android.apps.plus.phone.UrlGatewayActivity"); intent.putExtra("customAppUri", profile); startActivity(intent); } catch(ActivityNotFoundException e) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/"+profile+"/posts"))); } }
Intent myIntent = new Intent(); myIntent.setClassName("com.name.tlc", "com.name.tlc.map_page"); myIntent.putExtra("LatValue", (int)39485000); myIntent.putExtra("LongValue", (int)-80142777); startActivity(myIntent);
Intent intent = new Intent("android.intent.category.LAUNCHER"); intent.setClassName("com.facebook.katana", "com.facebook.katana.LoginActivity"); startActivity(intent);
public void shareFacebook() { String fullUrl = "https://m.facebook.com/sharer.php?u=.."; try { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setClassName("com.facebook.katana", "com.facebook.katana.ShareLinkActivity"); sharingIntent.putExtra(Intent.EXTRA_TEXT, "your title text"); startActivity(sharingIntent); } catch (Exception e) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(fullUrl)); startActivity(i); } }
public static void addKeepAliveExtra(Context context, Intent intent) { Intent keepAliveIntent = new Intent().setClassName( context.getPackageName(), KeepAliveService.class.getCanonicalName()); intent.putExtra(EXTRA_CUSTOM_TABS_KEEP_ALIVE, keepAliveIntent); }
Intent i = new Intent(); i.setClassName("com.WAPP", "com.WAPP.SetLocation.setLocationActivity"); startActivity(i);
try { // Check if the Twitter app is installed on the phone. getPackageManager().getPackageInfo("com.twitter.android", 0); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName("com.twitter.android", "com.twitter.android.ProfileActivity"); // Don't forget to put the "L" at the end of the id. intent.putExtra("user_id", 01234567L); startActivity(intent); } catch (NameNotFoundException e) { // If Twitter app is not installed, start browser. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/AndroTesteur"))); }
Intent intent = new Intent("com.android.camera.action.CROP"); intent.setClassName("com.android.camera", "com.android.camera.CropImage"); File file = new File(filePath); Uri uri = Uri.fromFile(file); intent.setData(uri); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("outputX", 96); intent.putExtra("outputY", 96); intent.putExtra("noFaceDetection", true); intent.putExtra("return-data", true); startActivityForResult(intent, REQUEST_CROP_ICON);
Intent intent = new Intent(); intent.setClassName(resolveInfo.activityInfo.applicationInfo.packageName, resolveInfo.activityInfo.name); startActivity(intent);
Intent tweetIntent = new Intent(Intent.ACTION_SEND); tweetIntent.putExtra(Intent.EXTRA_TEXT, "This is a Test."); tweetIntent.setType("text/plain"); PackageManager packManager = getPackageManager(); List<ResolveInfo> resolvedInfoList = packManager.queryIntentActivities(tweetIntent, PackageManager.MATCH_DEFAULT_ONLY); boolean resolved = false; for(ResolveInfo resolveInfo: resolvedInfoList){ if(resolveInfo.activityInfo.packageName.startsWith("com.twitter.android")){ tweetIntent.setClassName( resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name ); resolved = true; break; } } if(resolved){ startActivity(tweetIntent); }else{ Toast.makeText(this, "Twitter app isn't found", Toast.LENGTH_LONG).show(); }
public void shareTwitter() { String message = "Your message to post"; try { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setClassName("com.twitter.android","com.twitter.android.PostActivity"); sharingIntent.putExtra(Intent.EXTRA_TEXT, message); startActivity(sharingIntent); } catch (Exception e) { Log.e("In Exception", "Comes here"); Intent i = new Intent(); i.putExtra(Intent.EXTRA_TEXT, message); i.setAction(Intent.ACTION_VIEW); i.setData(Uri.parse("https://mobile.twitter.com/compose/tweet")); startActivity(i); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.preferences: { Intent intent = new Intent(); intent.setClassName(this, "your.package.MyPreferenceActivity"); startActivity(intent); return true; } } return super.onOptionsItemSelected(item); }
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName("com.google.android.apps.plus", "com.google.android.apps.plus.phone.UrlGatewayActivity"); intent.putExtra("customAppUri", "FAN_PAGE_ID"); startActivity(intent);
private static final String SCHEME = "package"; private static final String APP_PKG_NAME_21 = "com.android.settings.ApplicationPkgName"; private static final String APP_PKG_NAME_22 = "pkg"; private static final String APP_DETAILS_PACKAGE_NAME = "com.android.settings"; private static final String APP_DETAILS_CLASS_NAME = "com.android.settings.InstalledAppDetails"; public static void showInstalledAppDetails(Context context, String packageName) { Intent intent = new Intent(); final int apiLevel = Build.VERSION.SDK_INT; if (apiLevel >= 9) { // above 2.3 intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts(SCHEME, packageName, null); intent.setData(uri); } else { // below 2.3 final String appPkgName = (apiLevel == 8 ? APP_PKG_NAME_22 : APP_PKG_NAME_21); intent.setAction(Intent.ACTION_VIEW); intent.setClassName(APP_DETAILS_PACKAGE_NAME, APP_DETAILS_CLASS_NAME); intent.putExtra(appPkgName, packageName); } context.startActivity(intent); }
Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.setClassName(this,"com.mainscreen.activity2"); startActivity(intent);