List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:com.android.test.uibench.MainActivity.java
protected Intent browseIntent(String path) { Intent result = new Intent(); result.setClass(this, MainActivity.class); result.putExtra(EXTRA_PATH, path);//from ww w . j a va2 s . c o m return result; }
From source file:com.easemob.helpdeskdemo.ui.ShopFragment.java
@Override public void onClick(View v) { Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setClass(getActivity(), ShopDetailsActivity.class); switch (v.getId()) { case R.id.ib_shop_imageone: intent.putExtra(Constant.INTENT_CODE_IMG_SELECTED_KEY, Constant.INTENT_CODE_IMG_SELECTED_1); break;//from ww w . j a v a2s. com case R.id.ib_shop_imagetwo: intent.putExtra(Constant.INTENT_CODE_IMG_SELECTED_KEY, Constant.INTENT_CODE_IMG_SELECTED_2); break; case R.id.ib_shop_imagethree: intent.putExtra(Constant.INTENT_CODE_IMG_SELECTED_KEY, Constant.INTENT_CODE_IMG_SELECTED_3); break; case R.id.ib_shop_imagefour: intent.putExtra(Constant.INTENT_CODE_IMG_SELECTED_KEY, Constant.INTENT_CODE_IMG_SELECTED_4); break; } startActivity(intent); }
From source file:com.loadsensing.app.SensorsActivity.java
protected void onListItemClick(ListView l, View v, int position, long id) { // obtenim l'id del sensor i obrim la nova pantalla de la informaci del sensor TextView c = (TextView) v.findViewById(R.id.text1); String idsensorselected = c.getText().toString(); Log.d(DEB_TAG, "idsensorselected: " + c.getText().toString()); Intent intent = new Intent(); intent.setClass(this.getApplicationContext(), SingleSensorActivity.class); intent.putExtra("idsensorselected", idsensorselected); startActivity(intent);//from w ww.java 2s .c o m }
From source file:com.android.development.ExceptionBrowser.java
@Override protected void onListItemClick(ListView l, View view, int pos, long id) { // TODO: Use a generic VIEW action on the crash's content URI. CrashData crash = ((CrashListItem) view).getCrashData(); if (crash != null) { Intent intent = new Intent(); intent.setClass(this, StacktraceViewer.class); intent.putExtra(CrashData.class.getName(), crash.getThrowableData().toString()); startActivity(intent);//from w w w . ja va2 s . com } }
From source file:com.example.mobileid.GcmIntentService.java
private void sendNotification(Intent intent) { mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); Bundle extras = intent.getExtras();/*from ww w .java 2s.co m*/ JSONObject gcmObj; try { gcmObj = new JSONObject(extras.getString("message")); String msg = gcmObj.getString("info"); Intent passIntent = new Intent(); passIntent.setClass(this, MainActivity.class); passIntent.putExtra("gcmMsg", gcmObj.toString()); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, passIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this); if (msg.compareToIgnoreCase("websign") != 0) { // NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) mBuilder.setSmallIcon(R.drawable.ic_launcher).setContentTitle("mobileID") .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)).setContentText(msg); } else { // NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) mBuilder.setSmallIcon(R.drawable.ic_launcher) .setContentTitle("Web Sign - " + gcmObj.getString("title")) .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)) .setContentText(gcmObj.getString("content")); } //default notification sound Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); mBuilder.setSound(alarmSound); //cleared after clicking mBuilder.setAutoCancel(true); mBuilder.setContentIntent(contentIntent); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.loadsensing.app.SingleSensorActivity.java
public void graph(View v) { Intent intent = new Intent(); intent.putExtra("idsensor", SensorSelected); intent.setClass(this.getApplicationContext(), Chart.class); startActivity(intent);/*from w w w . j a v a2 s . c o m*/ }
From source file:net.dahanne.android.google.client.GoogleWebOAuthActivity.java
private void displayGoogleOptions() { Intent intent = new Intent(); intent.setClass(this, GoogleActivity.class); startActivity(intent);//from w ww .j a v a 2s . com finish(); }
From source file:com.mikecorrigan.bohrium.pubsub.GCMBroadcastReceiver.java
@Override public final void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive: context=" + context + ", intent=" + intent + ", extras: " + Utils.bundleToString(intent.getExtras())); intent.setClass(context, RegistrationClient.class); startWakefulService(context, intent); setResult(Activity.RESULT_OK, null, null); // TODO: Is this needed? }
From source file:com.cloudbees.gasp.activity.GaspLocationsActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Single menu item only - need to handle multiple items if added Intent intent = new Intent(); intent.setClass(GaspLocationsActivity.this, SetPreferencesActivity.class); startActivityForResult(intent, 0);//from w w w .j a v a 2s.c om return true; }
From source file:com.gsma.rcs.ri.sharing.geoloc.GeolocSharingIntentService.java
/** * Add geoloc share notification//from ww w. j a v a 2 s .c om * * @param invitation intent */ private void addGeolocSharingInvitationNotification(Intent invitation, ContactId contact) { /* Create pending intent */ Intent intent = new Intent(invitation); intent.setClass(this, ReceiveGeolocSharing.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); /* * If the PendingIntent has the same operation, action, data, categories, components, and * flags it will be replaced. Invitation should be notified individually so we use a random * generator to provide a unique request code and reuse it for the notification. */ int uniqueId = Utils.getUniqueIdForPendingIntent(); PendingIntent contentIntent = PendingIntent.getActivity(this, uniqueId, intent, PendingIntent.FLAG_ONE_SHOT); String displayName = RcsContactUtil.getInstance(this).getDisplayName(contact); String title = getString(R.string.title_recv_geoloc_sharing); /* Create notification */ NotificationCompat.Builder notif = new NotificationCompat.Builder(this); notif.setContentIntent(contentIntent); notif.setSmallIcon(R.drawable.ri_notif_csh_icon); notif.setWhen(System.currentTimeMillis()); notif.setAutoCancel(true); notif.setOnlyAlertOnce(true); notif.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)); notif.setDefaults(Notification.DEFAULT_VIBRATE); notif.setContentTitle(title); notif.setContentText(getString(R.string.label_from_args, displayName)); /* Send notification */ NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(uniqueId, notif.build()); }