List of usage examples for android.content Intent FLAG_ACTIVITY_NEW_TASK
int FLAG_ACTIVITY_NEW_TASK
To view the source code for android.content Intent FLAG_ACTIVITY_NEW_TASK.
Click Source Link
From source file:edu.cmu.cs.quiltview.RequestPullingService.java
private void recordForQuery(String query, int queryID, int userID, String imagePath) { Intent respondIntent = new Intent(this, RespondActivity.class); respondIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); respondIntent.putExtra(RESPOND_INTENT_QUERY, query); respondIntent.putExtra(RESPOND_INTENT_QUERY_ID, queryID); respondIntent.putExtra(RESPOND_INTENT_USER_ID, userID); respondIntent.putExtra(RESPOND_INTENT_QUERY_IMAGE, imagePath); startActivity(respondIntent);/*from w w w. j ava 2s . co m*/ }
From source file:com.telepromptu.TeleprompterService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); Log.d(TAG, intent.toUri(0));/* ww w .ja va2s . c o m*/ if (mLiveCard == null) { Log.d(TAG, "Publishing LiveCard"); mLiveCard = mTimelineManager.createLiveCard(LIVE_CARD_TAG); // Keep track of the callback to remove it before unpublishing. mCallback = new TeleprompterDrawer(this); mLiveCard.setDirectRenderingEnabled(true).getSurfaceHolder().addCallback(mCallback); Intent menuIntent = new Intent(this, MenuActivity.class); menuIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); mLiveCard.setAction(PendingIntent.getActivity(this, 0, menuIntent, 0)); mLiveCard.publish(PublishMode.REVEAL); Log.d(TAG, "Done publishing LiveCard"); } else { // TODO(alainv): Jump to the LiveCard when API is available. } (new Thread(new Runnable() { @Override public void run() { // String text = "Hi! My name is Waseem Ahmad! I'm a senior studying computer science at Rice University. Today, I'm going to demonstrate an application that my team has created called Telepromptu. It is a Google Glass application that serves as a live automatic teleprompter. The application uses speech recognition to get snippets of text from Google Speech recognition API. Because the speech to text recognition is not fully accurate, our application uses a local subsequence alignment algorithm to match the recognized text with text on the teleprompter."; slides = connect("http://telepromptu.appspot.com/glass?id=" + presentationId); String text = ""; for (Slide slide : slides) { text += slide.notes + " "; } mCallback.mTeleprompterView.setText(text); speechTraverser = new SuperSpeechTraverser(text); } })).start(); startListening(); return START_STICKY; }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.InviteToSharedAppFeedObj.java
public void handleDirectMessage(Context context, Contact from, JSONObject obj) { try {//w ww . j av a 2s . co m String packageName = obj.getString(PACKAGE_NAME); String feedName = obj.getString("sharedFeedName"); JSONArray ids = obj.getJSONArray(PARTICIPANTS); Intent launch = new Intent(); launch.setAction(Intent.ACTION_MAIN); launch.addCategory(Intent.CATEGORY_LAUNCHER); launch.putExtra("type", "invite_app_feed"); launch.putExtra("creator", false); launch.putExtra("sender", from.id); launch.putExtra("sharedFeedName", feedName); launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); long[] idArray = new long[ids.length()]; for (int i = 0; i < ids.length(); i++) { idArray[i] = ids.getLong(i); } launch.putExtra("participants", idArray); launch.setPackage(packageName); final PackageManager mgr = context.getPackageManager(); List<ResolveInfo> resolved = mgr.queryIntentActivities(launch, 0); if (resolved.size() == 0) { Toast.makeText(context, "Could not find application to handle invite.", Toast.LENGTH_SHORT).show(); return; } ActivityInfo info = resolved.get(0).activityInfo; launch.setComponent(new ComponentName(info.packageName, info.name)); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, launch, PendingIntent.FLAG_CANCEL_CURRENT); (new PresenceAwareNotify(context)).notify("New Invitation from " + from.name, "Invitation received from " + from.name, "Click to launch application: " + packageName, contentIntent); } catch (JSONException e) { Log.e(TAG, e.getMessage()); } }
From source file:com.oakesville.mythling.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getAppSettings().isFirstRun()) { new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert) .setTitle(getString(R.string.setup_required)) .setMessage(getString(R.string.access_network_settings)) .setPositiveButton(getString(R.string.go_to_settings), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(MainActivity.this, PrefsActivity.class)); }/* w w w . j av a 2s. c o m*/ }).show(); } setContentView(getAppSettings().isTv() ? R.layout.firetv_split : R.layout.split); findViewById(R.id.breadcrumbs).setVisibility(View.GONE); createProgressBar(); backTo = getIntent().getStringExtra("back_to"); setPathFromIntent(); setSelItemIndex(getIntent().getIntExtra(SEL_ITEM_INDEX, 0)); setTopOffset(getIntent().getIntExtra(TOP_OFFSET, 0)); setCurrentTop(getIntent().getIntExtra(CURRENT_TOP, 0)); String mode = getIntent().getStringExtra(MODE_SWITCH); modeSwitch = mode != null; if (mode == null) mode = getAppSettings().getMediaSettings().getViewType().toString(); if (ViewType.list.toString().equals(mode)) goListView(); else if (ViewType.split.toString().equals(mode)) goSplitView(); if (getAppSettings().getMediaSettings().getViewType() == ViewType.detail) { Intent intent = new Intent(this, MediaPagerActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); if (backTo != null) intent.putExtra("back_to", backTo); startActivity(intent); finish(); return; } listView = (ListView) findViewById(R.id.split_cats); }
From source file:jp.co.conit.sss.sn.ex2.service.SendMessageIdIntentService.java
/** * SamuraiNotification????snUserdata??????? * //from w w w . j a v a 2 s. co m * @param snUserdata */ private void startActivity4Userdata(String snUserdata) { Intent activityIntent = new Intent(); if (StringUtil.isEmpty(snUserdata) || snUserdata.equals("null")) { activityIntent.setClass(getApplicationContext(), MessagesActivity.class); } else { if (snUserdata.startsWith("http")) { activityIntent.setAction(Intent.ACTION_VIEW); activityIntent.setData(Uri.parse(snUserdata)); } else { activityIntent.setClass(getApplicationContext(), UserDataActivity.class); activityIntent.putExtra("option", snUserdata); } } activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(activityIntent); }
From source file:edu.stanford.mobisocial.dungbeetle.GroupsActivity.java
/*** Dashbaord stuff ***/ public void goHome(Context context) { final Intent intent = new Intent(context, HomeActivity.class); if (Build.VERSION.SDK_INT < 11) intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); else//from w w w .ja va 2 s .c o m intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:com.umeng.community.example.CommunityApplication.java
@Override public void onCreate() { super.onCreate(); PlatformConfig.setWeixin("wx96110a1e3af63a39", "c60e3d3ff109a5d17013df272df99199"); //RENREN????? //?//from w w w . j av a 2 s . c o m PlatformConfig.setSinaWeibo("275392174", "d96fb6b323c60a42ed9f74bfab1b4f7a"); PlatformConfig.setQQZone("1104606393", "X4BAsJAVKtkDQ1zQ"); PushAgent.getInstance(this).setDebugMode(true); PushAgent.getInstance(this).setMessageHandler(new UmengMessageHandler() { @Override public void dealWithNotificationMessage(Context arg0, UMessage msg) { // ,???? super.dealWithNotificationMessage(arg0, msg); Log.e("", "### ???"); } }); PushAgent.getInstance(this).setNotificationClickHandler(new UHandler() { @Override public void handleMessage(Context context, UMessage uMessage) { com.umeng.comm.core.utils.Log.d("notifi", "getting message"); try { JSONObject jsonObject = uMessage.getRaw(); String feedid = ""; if (jsonObject != null) { com.umeng.comm.core.utils.Log.d("json", jsonObject.toString()); JSONObject extra = uMessage.getRaw().optJSONObject("extra"); feedid = extra.optString(Constants.FEED_ID); } Class myclass = Class.forName(uMessage.activity); Intent intent = new Intent(context, myclass); Bundle bundle = new Bundle(); bundle.putString(Constants.FEED_ID, feedid); intent.putExtras(bundle); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } catch (Exception e) { com.umeng.comm.core.utils.Log.d("class", e.getMessage()); } } }); }
From source file:com.mono.applink.Facebook.java
/** Called when the activity is first created. */ @Override/*w w w. ja v a 2 s.c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this; final String url = getIntent().getData().toString(); if (url.contains("posts") || url.contains("profile.php") || (!url.contains("&") && !url.contains("=") && url.length() > 24)) //1)Posts->It is impossible to launch FeedbackActivity because of permission denied. //With root permission and "am start" it's impossible to pass a Long extra_key... //2)Profile //3)Nickname { new FacebookUser().execute(); } else if (url.contains("sk=inbox"))//Message { new FacebookMessage().execute(); } else if (url.contains("event.php"))//event { new FacebookEvent().execute(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Sorry, but this type of link is not currently supported"); builder.setOnCancelListener(new OnCancelListener() { public void onCancel(DialogInterface dialog) { finish(); } }); builder.setPositiveButton("Open in Browser", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent i = new Intent(); i.setAction("android.intent.action.VIEW"); i.addCategory("android.intent.category.BROWSABLE"); i.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity")); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setData(Uri.parse(url)); startActivity(i); finish(); } }); AlertDialog alert = builder.create(); alert.show(); } }
From source file:com.vrem.wifianalyzer.navigation.items.ExportItem.java
private Intent createIntent(String title, String data) { Intent intent = createSendIntent();/*from w w w . j a va 2 s.c o m*/ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TITLE, title); intent.putExtra(Intent.EXTRA_SUBJECT, title); intent.putExtra(Intent.EXTRA_TEXT, data); return intent; }
From source file:jahirfiquitiva.iconshowcase.services.MuzeiArtSourceService.java
@Override public void onCustomCommand(int id) { super.onCustomCommand(id); if (id == COMMAND_ID_SHARE) { Artwork currentArtwork = getCurrentArtwork(); Intent shareWall = new Intent(Intent.ACTION_SEND); shareWall.setType("text/plain"); String wallName = currentArtwork.getTitle(); String authorName = currentArtwork.getByline(); String storeUrl = MARKET_URL + getPackageName(); String iconPackName = getString(R.string.app_name); shareWall.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_text, wallName, authorName, iconPackName, storeUrl)); shareWall = Intent.createChooser(shareWall, getString(R.string.share_title)); shareWall.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(shareWall);// w w w. ja v a 2 s .com } }