List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:com.gsma.rcs.ri.messaging.OneToOneTalkView.java
/** * Forge intent to start OneToOneTalkView activity upon reception of a stack event * * @param ctx The context//from w w w .j ava 2 s . c om * @param contact The contact ID * @param intent intent * @return intent */ public static Intent forgeIntentOnStackEvent(Context ctx, ContactId contact, Intent intent) { intent.setClass(ctx, OneToOneTalkView.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(EXTRA_CONTACT, (Parcelable) contact); return intent; }
From source file:com.birkettenterprise.phonelocator.broadcastreceiver.SendWorkToUpdateServiceBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { intent.setClass(context, UpdateService.class); startWakefulService(context, intent); }
From source file:com.google.samples.apps.iosched.ui.SessionLivestreamActivity.java
/** * Helper method to start this activity using only extras (rather than session uri). * @param context The package context// w ww .j a v a 2s . co m * @param youtubeUrl The youtube url or video id to load * @param title The title to show in the session info fragment, can be null * @param sessionAbstract The session abstract to show in the session info fragment, can be null */ public static void startFromExtras(Context context, String youtubeUrl, String title, String sessionAbstract, String captionsUrl) { if (youtubeUrl == null) { return; } final Intent i = new Intent(); i.setClass(context, SessionLivestreamActivity.class); i.putExtra(EXTRA_YOUTUBE_URL, youtubeUrl); i.putExtra(EXTRA_TITLE, title); i.putExtra(EXTRA_ABSTRACT, sessionAbstract); i.putExtra(EXTRA_CAPTIONS, captionsUrl); context.startActivity(i); }
From source file:com.clockworkmod.billing.BillingReceiver.java
/** * This is the entry point for all asynchronous messages sent from Android Market to * the application. This method forwards the messages on to the * {@link BillingService}, which handles the communication back to Android Market. * The {@link BillingService} also reports state changes back to the application through * the {@link ResponseHandler}./* w ww . j av a 2 s . co m*/ */ @Override public void onReceive(final Context context, Intent intent) { intent.setClass(context, BillingService.class); context.startService(intent); }
From source file:net.benmoran.affectsampler.SyncServiceTestCase.java
/** * Test basic startup/shutdown of Service *//*from w w w . j a v a 2 s.c o m*/ @SmallTest public void testStartable() { Intent startIntent = new Intent(); startIntent.setClass(getContext(), SyncService.class); startService(startIntent); }
From source file:com.polyvi.xface.extension.zbar.XZBarExt.java
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (COMMAND_START.equals(action) && !mLock && apiLevel >= 8) { mCallbackCtx = callbackContext;/*from w ww .ja v a 2 s . c o m*/ mLock = true; Intent intent = new Intent(); intent.setClass(cordova.getActivity(), XCameraActivity.class); cordova.startActivityForResult(this, intent, 1); PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT); result.setKeepCallback(true); callbackContext.sendPluginResult(result); return true; } return false; }
From source file:com.gsma.rcs.ri.messaging.GroupTalkView.java
/** * Forge intent to notify new Group Chat * * @param ctx The context.//from ww w .j av a 2s. co m * @param invitation The original intent. * @return intent */ public static Intent forgeIntentInvitation(Context ctx, Intent invitation) { invitation.setClass(ctx, GroupTalkView.class); invitation.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); invitation.putExtra(GroupTalkView.EXTRA_MODE, GroupChatMode.INCOMING); return invitation; }
From source file:com.epam.training.taskmanager.FragmentLayoutSupportActivity.java
@Override public void onShowDetails(int index) { if (mDualPane) { // We can display everything in-place with fragments, so update // the list to highlight the selected item and show the data. // Check what fragment is currently shown, replace if needed. DetailsFragment details = (DetailsFragment) getSupportFragmentManager().findFragmentById(R.id.details); if (details == null || details.getShownIndex() != index) { // Make new fragment to show this selection. details = DetailsFragment.newInstance(index); // Execute a transaction, replacing any existing fragment // with this one inside the frame. getSupportFragmentManager().beginTransaction().replace(R.id.details, details) .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).commit(); }/*from w w w .j av a 2s . c om*/ } else { // Otherwise we need to launch a new activity to display // the dialog fragment with selected text. Intent intent = new Intent(); intent.setClass(this, DetailsFragmentActivity.class); intent.putExtra("index", index); startActivity(intent); } }
From source file:com.cssweb.android.common.FairyUI.java
public static Intent genIntent(String paramString1, int paramInt, String paramString2, String paramString3, Context paramContext) {/*from w w w .ja v a 2s. c o m*/ Intent localIntent = new Intent(); if (paramString1.equals(Global.QUERY_STOCK_LSWT)) { localIntent.putExtra("strdate", paramString2); localIntent.putExtra("enddate", paramString3); localIntent.setClass(paramContext, HistoryEntrust.class); } else if (paramString1.equals(Global.QUERY_STOCK_LSCJ)) { localIntent.putExtra("strdate", paramString2); localIntent.putExtra("enddate", paramString3); localIntent.setClass(paramContext, HistoryDeal.class); } else if (paramString1.equals(Global.QUERY_STOCK_DZD)) { localIntent.putExtra("strdate", paramString2); localIntent.putExtra("enddate", paramString3); localIntent.setClass(paramContext, Bill.class); } else if (paramString1.equals(Global.QUERY_NEW_STOCK_MATCH)) { localIntent.putExtra("strdate", paramString2); localIntent.putExtra("enddate", paramString3); localIntent.setClass(paramContext, NewStockMatch.class); } else if (paramString1.equals(Global.QUERY_FUND_LSCJ)) { localIntent.putExtra("startdate", paramString2); localIntent.putExtra("enddate", paramString3); localIntent.setClass(paramContext, HistoryConclusion.class); } else if (paramString1.equals(Global.QUERY_FUND_LSWT)) { localIntent.putExtra("startdate", paramString2); localIntent.putExtra("enddate", paramString3); localIntent.setClass(paramContext, HistoryTrust.class); } return localIntent; }
From source file:com.cloudbees.gasp.activity.RestaurantListActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.gasp_settings: Intent intent = new Intent(); intent.setClass(this, SetPreferencesActivity.class); startActivityForResult(intent, 0); return true; case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; default:/*from w w w. j a v a 2s. c o m*/ return super.onOptionsItemSelected(item); } }