List of usage examples for android.content Intent FLAG_ACTIVITY_SINGLE_TOP
int FLAG_ACTIVITY_SINGLE_TOP
To view the source code for android.content Intent FLAG_ACTIVITY_SINGLE_TOP.
Click Source Link
From source file:com.amazonaws.mobileconnectors.pinpoint.targeting.notification.NotificationClient.java
private Intent notificationIntent(final Bundle pushBundle, final String campaignId, final int requestId, final String intentAction, final Class<?> targetClass) { final Intent notificationIntent = new Intent(pinpointContext.getApplicationContext(), targetClass); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); notificationIntent.setAction(intentAction); notificationIntent.putExtras(pushBundle); notificationIntent.putExtra(INTENT_SNS_NOTIFICATION_FROM, AWS_EVENT_TYPE_OPENED); notificationIntent.putExtra(CAMPAIGN_ID_PUSH_KEY, campaignId); notificationIntent.putExtra(REQUEST_ID, requestId); notificationIntent.setPackage(pinpointContext.getApplicationContext().getPackageName()); return notificationIntent; }
From source file:gpsalarm.app.service.PostMonitor.java
private void showNotification(String str, String gid) { final NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification note = new Notification(R.drawable.status, "Locate@ Tweet", System.currentTimeMillis()); Intent i = new Intent(this, AlarmEdit3.class); i.putExtra("user", prefs.getString("user", null)); i.putExtra(ReminderHelper.GLOBAL_ID, gid); // i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP| // Intent.FLAG_ACTIVITY_SINGLE_TOP); i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0); note.setLatestEventInfo(this, "Locate@ Tweet", str, pi); mgr.notify(NOTIFICATION_ID, note);/*from ww w.j a va2 s . c o m*/ }
From source file:com.trellmor.berrytubechat.ChatActivity.java
private void initService(BerryTubeBinder service) { mBinder = service;//from w w w .j a v a 2 s . co m if (mCallback == null) { createCallback(); } mBinder.getService().setCallback(mCallback); mBinder.getService().setChatMsgBufferSize(mScrollback); mBinder.getService().setNotification(mNotification); mNotification = null; if (mChatAdapter == null) { mChatAdapter = new ChatMessageAdapter(ChatActivity.this, R.layout.chat_item, mBinder.getService().getChatMsgBuffer()); mListChat.setAdapter(mChatAdapter); } mChatAdapter.notifyDataSetChanged(); setNick(mBinder.getService().getNick()); mDrinkCount = mBinder.getService().getDrinkCount(); updateDrinkCount(); if (!mBinder.getService().isConnected()) { try { // Only connect if we got Username and Password from // MainActivity, otherwise wait until BerryTube reconnect // normally if (mUsername != null && mPassword != null) { NotificationCompat.Builder note = new NotificationCompat.Builder(this); note.setSmallIcon(R.drawable.ic_stat_notify_berrytube); note.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher)); note.setContentTitle(getString(R.string.title_activity_chat)); Intent intent = new Intent(this, ChatActivity.class); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.putExtra(MainActivity.KEY_USERNAME, mUsername); intent.putExtra(MainActivity.KEY_PASSWORD, mPassword); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY); note.setContentIntent( PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)); mBinder.getService().connect(mUsername, mPassword, note); } } catch (MalformedURLException e) { Log.w(TAG, e); } catch (IllegalStateException e) { // already connected, ignore } } }
From source file:org.andstatus.app.account.AccountSettingsActivity.java
private void returnToOurActivity() { Class<? extends Activity> ourActivity; MyContextHolder.initialize(this, this); if (MyContextHolder.get().persistentAccounts().size() > 1) { ourActivity = MySettingsActivity.class; } else {/*from w ww . ja v a2 s.c o m*/ ourActivity = TimelineActivity.class; } MyLog.v(this, "Returning to " + ourActivity.getSimpleName()); Intent i = new Intent(this, ourActivity); // On modifying activity back stack see http://stackoverflow.com/questions/11366700/modification-of-the-back-stack-in-android i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(i); }
From source file:com.example.multi_ndef.Frag_Write.java
/** * Force this Activity to get NFC events first *//*from w w w . j av a 2 s.c o m*/ //@SuppressLint("NewApi") private void enableWriteMode() { mInWriteMode = true; try { // set up a PendingIntent to open the app when a tag is scanned PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); IntentFilter tagDetected = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED); IntentFilter[] filters = new IntentFilter[] { tagDetected }; mAdapter.enableForegroundDispatch(this, pendingIntent, filters, null); } catch (Exception e) { Toast toast = Toast.makeText(getApplicationContext(), "Problem capturing tag" + e.toString(), Toast.LENGTH_SHORT); toast.show(); } }
From source file:com.smc.tw.waltz.MainActivity.java
private void SignIn() { if (DEBUG)/* ww w . j a v a 2 s. c o m*/ Log.d(TAG, "SignIn"); if (!mForceSignIn)// && MainApplication.isUserSignedIn() ) return; mForceSignIn = false; try { Intent intent = new Intent(MainActivity.this, UserActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(intent); } catch (ActivityNotFoundException e) { } }
From source file:com.radiusnetworks.scavengerhunt.ScavengerHuntApplication.java
public void dependencyLoadFinished() { Log.d(TAG, "all dependencies loaded"); if (ProximityKitManager.getInstanceForApplication(this).getKit() == null || hunt.getTargetList().size() == 0) { dependencyLoadingFailed("Network error", "Can't access scavenger hunt data. Please verify your network connection and try again."); return;/*from ww w . j a va2 s. com*/ } if (validateRequiredImagesPresent()) { // Yes, we have everything we need to start up. this.hunt.start(); Intent i; if (hunt.hasCustomStartScreen()) { i = new Intent(this, InstructionActivity.class); } else { i = new Intent(this, TargetCollectionActivity.class); } i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(i); this.loadingActivity.finish(); // do this so that if we hit back, the loading activity won't show up again return; } else { dependencyLoadingFailed("Network error", "Can't download images. Please verify your network connection and try again."); return; } }
From source file:com.linkbubble.MainApplication.java
public static Intent getStoreIntent(Context context, String storeProUrl) { PackageManager manager = context.getPackageManager(); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(storeProUrl)); List<ResolveInfo> infos = manager.queryIntentActivities(intent, PackageManager.GET_RESOLVED_FILTER); for (ResolveInfo info : infos) { IntentFilter filter = info.filter; if (filter != null && filter.hasAction(Intent.ACTION_VIEW) && filter.hasCategory(Intent.CATEGORY_BROWSABLE)) { if (info.activityInfo.packageName.equals(BuildConfig.STORE_PACKAGE)) { Intent result = new Intent(Intent.ACTION_VIEW); result.setClassName(info.activityInfo.packageName, info.activityInfo.name); result.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); result.setData(Uri.parse(storeProUrl)); return result; }// w w w . j a va 2 s. co m } } return null; }
From source file:com.bonsai.wallet32.WalletService.java
private void showStatusNotification() { CharSequence started_txt = getText(R.string.wallet_service_started); CharSequence info_txt = getText(R.string.wallet_service_info); Notification note = new Notification(R.drawable.ic_stat_notify, started_txt, System.currentTimeMillis()); Intent intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0); // Set the info for the views that show in the notification panel. note.setLatestEventInfo(this, getText(R.string.wallet_service_label), info_txt, contentIntent); note.flags |= Notification.FLAG_NO_CLEAR; startForeground(NOTIFICATION, note); }
From source file:com.googlecode.android_scripting.activity.ScriptManager.java
/** * Opens the script for editing./*from www.j av a2s . c o m*/ * * @param script * the name of the script to edit */ private void editScript(File script) { Intent i = new Intent(Constants.ACTION_EDIT_SCRIPT); i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); i.putExtra(Constants.EXTRA_SCRIPT_PATH, script.getAbsolutePath()); startActivity(i); }