List of usage examples for android.content Intent FLAG_ACTIVITY_MULTIPLE_TASK
int FLAG_ACTIVITY_MULTIPLE_TASK
To view the source code for android.content Intent FLAG_ACTIVITY_MULTIPLE_TASK.
Click Source Link
From source file:fr.bmartel.android.tictactoe.GameSingleton.java
public void acceptChallenge(final String challengerId, String challengerName) { Log.i(TAG, "send accept challenge request : " + RequestBuilder.buildChallengeResponse(DEVICE_ID, challengerName, challengerId)); JsonObjectRequest jsObjRequest = new JsonObjectRequest(BuildConfig.APP_ROUTE + "/accept_challenge", RequestBuilder.buildChallengeResponse(DEVICE_ID, challengerName, challengerId), new Response.Listener<JSONObject>() { @Override// w w w . ja va2 s . co m public void onResponse(JSONObject response) { Log.i(TAG, "response received accept challenge : " + response.toString()); // call to start game activity playerTurn = false; GameSingleton.this.challengerId = challengerId; setSecondSign(); Intent intent2 = new Intent(context, GameActivity.class); intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); context.startActivity(intent2); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { error.printStackTrace(); } }); jsObjRequest.setShouldCache(false); queue.add(jsObjRequest); }
From source file:com.stillnojetpacks.huffr.activities.MainActivity.java
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.LOLLIPOP) private Intent rateIntentForUrl(String url) { Intent intent = new Intent(Intent.ACTION_VIEW, uriForUrl(url)); int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT; } else {//www . j a v a 2 s. c om flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET; } intent.addFlags(flags); return intent; }
From source file:io.github.hidroh.materialistic.AppUtils.java
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.LOLLIPOP) public static void openPlayStore(Context context) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(PLAY_STORE_URL)); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); } else {/*www. j a v a 2 s. c om*/ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); } try { context.startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(context, R.string.no_playstore, Toast.LENGTH_SHORT).show(); } }
From source file:com.untappedkegg.rally.home.ActivityMain.java
private void sendFeedback() { List<Intent> targetedShareIntents = new ArrayList<Intent>(); final String emailMsg = String.format( "App Version: %s\nAndroid: %s : %s\nDevice: %s \nPlease leave the above lines for debugging purposes. Thank you!\n\n", BuildConfig.VERSION_NAME, Build.VERSION.SDK_INT, Build.VERSION.RELEASE, /*Build.FINGERPRINT,*/ Build.MODEL); // Google+// w w w . j av a2s. c om ArrayList<Person> recipients = new ArrayList<Person>(); recipients.add(PlusShare.createPerson("109961307643513437237", BuildConfig.DEV_NAME)); targetedShareIntents .add(new PlusShare.Builder(this).setType("text/plain").setRecipients(recipients).getIntent()); // Email try { targetedShareIntents.add( CommonIntents.getShareIntent("email", "Feedback: " + getString(R.string.app_name), emailMsg) .putExtra(Intent.EXTRA_EMAIL, "UntappedKegg@gmail.com")); } catch (Exception e) { } try { targetedShareIntents.add( CommonIntents.getShareIntent("gmail", "Feedback: " + getString(R.string.app_name), emailMsg) .putExtra(Intent.EXTRA_EMAIL, "UntappedKegg@gmail.com")); } catch (Exception e) { } // Twitter Intent twitterIntent = CommonIntents.getShareIntent("twitter", "Untapped Rally", "@UntappedKegg "); if (twitterIntent != null) targetedShareIntents.add(twitterIntent); // Market try { final String mPackageName = getPackageName(); final String installer = getPackageManager().getInstallerPackageName(mPackageName); Intent marketIntent = null; if (AppState.MARKET_GOOGLE.equalsIgnoreCase(installer)) { marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(AppState.APP_LINK_GOOGLE + mPackageName)); marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); } else if (AppState.MARKET_AMAZON.equalsIgnoreCase(installer)) { marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(AppState.APP_LINK_AMAZON + mPackageName)); marketIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } if (marketIntent != null) targetedShareIntents.add(marketIntent); } catch (Exception e) { } Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "Send Feedback via:"); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[] {})); startActivity(chooserIntent); }
From source file:android.support.v7.widget.ShareActionProvider.java
private void updateIntent(Intent intent) { if (Build.VERSION.SDK_INT >= 21) { // If we're on Lollipop, we can open the intent as a document intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); } else {//from w w w .ja va2s.c o m // Else, we will use the old CLEAR_WHEN_TASK_RESET flag intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); } }
From source file:com.necisstudio.highlightgoal.MainActivity.java
void drawermenu(int id) { if (id == R.id.rate) { Uri uri = Uri.parse("market://details?id=com.necisstudio.highlightgoal"); Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); try {/*w ww. ja v a 2 s. co m*/ startActivity(goToMarket); } catch (ActivityNotFoundException e) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=com.necisstudio.highlightgoal"))); } } else if (id == R.id.feedback) { Intent send = new Intent(Intent.ACTION_SENDTO); String uriText = "mailto:" + Uri.encode("report@necistudio.com") + "?subject=" + Uri.encode("Feedback for Highlight Goal") + "&body=" + Uri.encode(""); Uri uri = Uri.parse(uriText); send.setData(uri); startActivity(Intent.createChooser(send, "Send mail...")); } else if (id == R.id.latest) { ApplicationConfig.status = id; iddrawer = id; imgLogo.setImageResource(0); txtTitle.setText("Latest"); fList = new ArrayList<Fragment>(); List<Fragment> fragments = getFragments(HighlightLatestFragment.newInstance(""), KlasementLigaFragment.newInstance("inggris"), ScheduleLigaLatestFragment.newInstance("")); adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments); final ViewPager pager = (ViewPager) findViewById(R.id.viewpager); tabHost = (TabLayout) findViewById(R.id.materialTabHost); pager.setAdapter(adapter_viewPager); pager.setOffscreenPageLimit(3); tabHost.setupWithViewPager(pager); tabHost.getTabAt(0).setText("Highlight"); tabHost.getTabAt(1).setText("Schedule"); } else if (id == R.id.inggris) { ApplicationConfig.status = id; iddrawer = id; imgLogo.setImageResource(R.mipmap.premier); txtTitle.setText("Premier League"); fList = new ArrayList<Fragment>(); List<Fragment> fragments = getFragments(HighlightFragment.newInstance("inggris"), KlasementLigaFragment.newInstance("inggris"), ScheduleLigaFragment.newInstance("inggris")); adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments); final ViewPager pager = (ViewPager) findViewById(R.id.viewpager); tabHost = (TabLayout) findViewById(R.id.materialTabHost); pager.setAdapter(adapter_viewPager); pager.setOffscreenPageLimit(3); tabHost.setupWithViewPager(pager); tabHost.getTabAt(0).setText("Highlight"); tabHost.getTabAt(1).setText("Standings"); tabHost.getTabAt(2).setText("Schedule"); } else if (id == R.id.europa) { ApplicationConfig.status = id; iddrawer = id; imgLogo.setImageResource(R.mipmap.europa); txtTitle.setText("Europa League"); fList = new ArrayList<Fragment>(); List<Fragment> fragments = getFragments(HighlightFragment.newInstance("europa"), new TeamEuropaFragment(), ScheduleLigaFragment.newInstance("europa")); adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments); final ViewPager pager = (ViewPager) findViewById(R.id.viewpager); tabHost = (TabLayout) findViewById(R.id.materialTabHost); pager.setAdapter(adapter_viewPager); pager.setOffscreenPageLimit(3); tabHost.setupWithViewPager(pager); tabHost.getTabAt(0).setText("Highlight"); tabHost.getTabAt(1).setText("Standings"); tabHost.getTabAt(2).setText("Schedule"); } else if (id == R.id.champion) { ApplicationConfig.status = id; iddrawer = id; imgLogo.setImageResource(R.mipmap.champion); txtTitle.setText("Champions League"); fList = new ArrayList<Fragment>(); List<Fragment> fragments = getFragments(HighlightFragment.newInstance("champions"), new TeamChampionsFragment(), ScheduleLigaFragment.newInstance("champions")); adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments); final ViewPager pager = (ViewPager) findViewById(R.id.viewpager); tabHost = (TabLayout) findViewById(R.id.materialTabHost); pager.setAdapter(adapter_viewPager); pager.setOffscreenPageLimit(3); tabHost.setupWithViewPager(pager); tabHost.getTabAt(0).setText("Highlight"); tabHost.getTabAt(1).setText("Standings"); tabHost.getTabAt(2).setText("Schedule"); } else if (id == R.id.seria) { ApplicationConfig.status = id; iddrawer = id; imgLogo.setImageResource(R.mipmap.seria); txtTitle.setText("Seri A"); fList = new ArrayList<Fragment>(); List<Fragment> fragments = getFragments(HighlightFragment.newInstance("italia"), KlasementLigaFragment.newInstance("italia"), ScheduleLigaFragment.newInstance("italia")); adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments); final ViewPager pager = (ViewPager) findViewById(R.id.viewpager); tabHost = (TabLayout) findViewById(R.id.materialTabHost); pager.setAdapter(adapter_viewPager); pager.setOffscreenPageLimit(3); tabHost.setupWithViewPager(pager); tabHost.getTabAt(0).setText("Highlight"); tabHost.getTabAt(1).setText("Standings"); tabHost.getTabAt(2).setText("Schedule"); } else if (id == R.id.jerman) { ApplicationConfig.status = id; iddrawer = id; imgLogo.setImageResource(R.mipmap.bundes); txtTitle.setText("Bundesliga"); fList = new ArrayList<Fragment>(); List<Fragment> fragments = getFragments(HighlightFragment.newInstance("jerman"), KlasementLigaFragment.newInstance("jerman"), ScheduleLigaFragment.newInstance("jerman")); adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments); final ViewPager pager = (ViewPager) findViewById(R.id.viewpager); tabHost = (TabLayout) findViewById(R.id.materialTabHost); pager.setAdapter(adapter_viewPager); pager.setOffscreenPageLimit(3); tabHost.setupWithViewPager(pager); tabHost.getTabAt(0).setText("Highlight"); tabHost.getTabAt(1).setText("Standings"); tabHost.getTabAt(2).setText("Schedule"); } else if (id == R.id.spain) { ApplicationConfig.status = id; iddrawer = id; imgLogo.setImageResource(R.mipmap.bbva); txtTitle.setText("BBVA League"); fList = new ArrayList<Fragment>(); List<Fragment> fragments = getFragments(HighlightFragment.newInstance("spain"), KlasementLigaFragment.newInstance("spain"), ScheduleLigaFragment.newInstance("spain")); adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments); final ViewPager pager = (ViewPager) findViewById(R.id.viewpager); tabHost = (TabLayout) findViewById(R.id.materialTabHost); pager.setAdapter(adapter_viewPager); pager.setOffscreenPageLimit(3); tabHost.setupWithViewPager(pager); tabHost.getTabAt(0).setText("Highlight"); tabHost.getTabAt(1).setText("Standings"); tabHost.getTabAt(2).setText("Schedule"); } else if (id == R.id.france) { ApplicationConfig.status = id; iddrawer = id; imgLogo.setImageResource(R.mipmap.ligue); txtTitle.setText("League 1"); fList = new ArrayList<Fragment>(); List<Fragment> fragments = getFragments(HighlightFragment.newInstance("france"), KlasementLigaFragment.newInstance("france"), ScheduleLigaFragment.newInstance("france")); adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments); final ViewPager pager = (ViewPager) findViewById(R.id.viewpager); tabHost = (TabLayout) findViewById(R.id.materialTabHost); pager.setAdapter(adapter_viewPager); pager.setOffscreenPageLimit(3); tabHost.setupWithViewPager(pager); tabHost.getTabAt(0).setText("Highlight"); tabHost.getTabAt(1).setText("Standings"); tabHost.getTabAt(2).setText("Schedule"); } else if (id == R.id.about) { Intent intent = new Intent(MainActivity.this, ActivityAbout.class); startActivity(intent); } else if (id == R.id.license) { Intent intent = new Intent(MainActivity.this, ActivityLicense.class); startActivity(intent); } }
From source file:arun.com.chromer.browsing.customtabs.CustomTabs.java
private void prepareChromerOptions() { final Intent moreMenuActivity = new Intent(activity, ChromerOptionsActivity.class); moreMenuActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); moreMenuActivity.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { moreMenuActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); }// w w w . j a va2s . c o m moreMenuActivity.putExtra(EXTRA_KEY_ORIGINAL_URL, url); final PendingIntent moreMenuPending = PendingIntent.getActivity(activity, 0, moreMenuActivity, FLAG_UPDATE_CURRENT); builder.addMenuItem(activity.getString(R.string.chromer_options), moreMenuPending); }
From source file:com.sentaroh.android.TaskAutomation.TaskManager.java
static final public void showMessageDialog(TaskManagerParms taskMgrParms, EnvironmentParms envParms, CommonUtilities util, String group, String task, String action, String dialog_id, String msg_type, String msg_text) {// w w w. ja v a 2 s .com Intent in_b = new Intent(taskMgrParms.context.getApplicationContext(), ActivityMessage.class); // in_b.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP); in_b.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); in_b.putExtra(MESSAGE_DIALOG_MESSAGE_KEY_GROUP, group); in_b.putExtra(MESSAGE_DIALOG_MESSAGE_KEY_TASK, task); in_b.putExtra(MESSAGE_DIALOG_MESSAGE_KEY_ACTION, action); in_b.putExtra(MESSAGE_DIALOG_MESSAGE_KEY_DIALOG_ID, dialog_id); in_b.putExtra(MESSAGE_DIALOG_MESSAGE_KEY_TYPE, msg_type); in_b.putExtra(MESSAGE_DIALOG_MESSAGE_KEY_TEXT, msg_text); taskMgrParms.context.startActivity(in_b); }
From source file:de.tap.easy_xkcd.utils.PrefHelper.java
public void showRateSnackbar(final String packageName, final Context context, FloatingActionButton mFab) { // Thanks to /u/underhound for this great idea! https://www.reddit.com/r/Android/comments/3i6uw0/dev_i_think_ive_mastered_the_art_of_asking_for/ if (showRateDialog()) { View.OnClickListener oc = new View.OnClickListener() { @Override// www . j a v a 2s. c o m public void onClick(View v) { Uri uri = Uri.parse("market://details?id=" + packageName); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); SharedPreferences.Editor editor = sharedPrefs.edit(); editor.putInt(RATE_SNACKBAR, 32); editor.apply(); try { context.startActivity(intent); } catch (ActivityNotFoundException e) { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + packageName))); } } }; Snackbar.make(mFab, R.string.snackbar_rate, Snackbar.LENGTH_LONG) .setAction(R.string.snackbar_rate_action, oc).show(); } }
From source file:org.puder.trs80.MainActivity.java
private void showRating() { Uri uri = Uri.parse("market://details?id=" + getPackageName()); Intent playMarketIntent = new Intent(Intent.ACTION_VIEW, uri); playMarketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); try {/* w w w . ja va2 s . com*/ startActivity(playMarketIntent); } catch (ActivityNotFoundException e) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + getPackageName()))); } }