List of usage examples for android.content Intent putExtras
public @NonNull Intent putExtras(@NonNull Bundle extras)
From source file:most.voip.example.remote_config.MainActivity.java
public void acceptConfig(View view) { Intent resultIntent = new Intent(); Bundle b = new Bundle(); b.putString("account_data", accountDetailsData); b.putString("buddies_data", buddiesDetailsData); resultIntent.putExtras(b); // TODO Add extras or a data URI to this intent as appropriate. Log.d(TAG, "Configuration accepted"); setResult(Activity.RESULT_OK, resultIntent); finish();//from ww w. j a v a 2 s . c o m }
From source file:ca.psiphon.ploggy.FragmentFriendList.java
@Override public void onListItemClick(ListView listView, View view, int position, long id) { Data.Friend friend = (Data.Friend) listView.getItemAtPosition(position); Intent intent = new Intent(getActivity(), ActivityFriendStatusDetails.class); Bundle bundle = new Bundle(); bundle.putString(ActivityFriendStatusDetails.FRIEND_ID_BUNDLE_KEY, friend.mId); intent.putExtras(bundle); startActivity(intent);/*from w w w.java 2 s . c o m*/ }
From source file:com.parse.ParseAnalyticsTest.java
@Test public void testGetPushHashFromIntentEmptyIntent() throws Exception { Intent intent = new Intent(); Bundle bundle = new Bundle(); JSONObject json = new JSONObject(); json.put("push_hash_wrong_key", "test"); bundle.putString("data_wrong_key", json.toString()); intent.putExtras(bundle); String pushHash = ParseAnalytics.getPushHashFromIntent(intent); assertEquals(null, pushHash);//from w w w . ja v a 2 s . c o m }
From source file:fr.cph.chicago.activity.BaseActivity.java
/** * Finish current activity and start main activity with custom transition * /* w ww. j a v a 2 s .c o m*/ * @param trainArrivals * the train arrivals * @param busArrivals * the bus arrivals */ private void startMainActivity(SparseArray<TrainArrival> trainArrivals, List<BusArrival> busArrivals) { if (!isFinishing()) { Intent intent = new Intent(this, MainActivity.class); Bundle bundle = new Bundle(); bundle.putParcelableArrayList("busArrivals", (ArrayList<BusArrival>) busArrivals); bundle.putSparseParcelableArray("trainArrivals", trainArrivals); intent.putExtras(bundle); finish(); startActivity(intent); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } }
From source file:ca.mudar.snoozy.receiver.PowerConnectionReceiver.java
private void notify(Context context, boolean isConnectedPower, boolean hasVibration, boolean hasSound, int notifyCount) { final Resources res = context.getResources(); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_notify).setContentTitle(res.getString(R.string.notify_content_title)) .setAutoCancel(true);/*from w ww .j a v a 2 s . c om*/ if (notifyCount == 1) { final int resContentTextSingle = (isConnectedPower ? R.string.notify_content_text_single_on : R.string.notify_content_text_single_off); mBuilder.setContentText(res.getString(resContentTextSingle)); } else { mBuilder.setNumber(notifyCount).setContentText(res.getString(R.string.notify_content_text_multi)); } if (hasVibration && hasSound) { mBuilder.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND); } else if (hasVibration) { mBuilder.setDefaults(Notification.DEFAULT_VIBRATE); } else if (hasSound) { mBuilder.setDefaults(Notification.DEFAULT_SOUND); } // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(context, MainActivity.class); final Bundle extras = new Bundle(); extras.putBoolean(Const.IntentExtras.INCREMENT_NOTIFY_GROUP, true); extras.putBoolean(Const.IntentExtras.RESET_NOTIFY_NUMBER, true); resultIntent.putExtras(extras); resultIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); mBuilder.setContentIntent( PendingIntent.getActivity(context, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT)); Intent receiverIntent = new Intent(context, PowerConnectionReceiver.class); receiverIntent.setAction(Const.IntentActions.NOTIFY_DELETE); PendingIntent deleteIntent = PendingIntent.getBroadcast(context, Const.RequestCodes.RESET_NOTIFY_NUMBER, receiverIntent, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setDeleteIntent(deleteIntent); NotificationManager mNotificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); // NOTIFY_ID allows updates to the notification later on. mNotificationManager.notify(Const.NOTIFY_ID, mBuilder.build()); }
From source file:com.aikidonord.fragments.FragmentDate.java
@Override /**//from w w w . j a va 2 s.c o m * Au clic sur un lment de la liste. */ public void onListItemClick(ListView l, View v, int position, long id) { String date = (String) l.getItemAtPosition(position); FragmentManager fm = getFragmentManager(); if (fm.findFragmentById(R.id.fragment_prochains_stages) != null) { // affichage tablette mCallback.onDateSelected(date); } else { // dans le cas de l'affichage tlphone classique Intent i = new Intent(this.getActivity(), com.aikidonord.ProchainsStages.class); // donnes envoyer l'activit Bundle b = new Bundle(); b.putString("type", "date"); b.putString("data", String.valueOf(date)); i.putExtras(b); this.getActivity().startActivity(i); } }
From source file:com.aikidonord.fragments.FragmentLieu.java
@Override /**// w w w. j av a 2 s. c om * Au clic sur un lment de la liste. */ public void onListItemClick(ListView l, View v, int position, long id) { String lieu = (String) l.getItemAtPosition(position); FragmentManager fm = getFragmentManager(); if (fm.findFragmentById(R.id.fragment_prochains_stages) != null) { // affichage tablette mCallback.onLieuSelected(lieu); } else { // dans le cas de l'affichage tlphone classique Intent i = new Intent(this.getActivity(), com.aikidonord.ProchainsStages.class); // donnes envoyer l'activit Bundle b = new Bundle(); b.putString("type", "lieu"); b.putString("data", String.valueOf(lieu)); i.putExtras(b); this.getActivity().startActivity(i); } }
From source file:com.aikidonord.fragments.FragmentType.java
@Override /**//from w w w . j a va 2 s . c om * Au clic sur un lment de la liste. */ public void onListItemClick(ListView l, View v, int position, long id) { String type = (String) l.getItemAtPosition(position); FragmentManager fm = getFragmentManager(); if (fm.findFragmentById(R.id.fragment_prochains_stages) != null) { // affichage tablette mCallback.onTypeSelected(type); } else { // dans le cas de l'affichage tlphone classique Intent i = new Intent(this.getActivity(), com.aikidonord.ProchainsStages.class); // donnes envoyer l'activit Bundle b = new Bundle(); b.putString("type", "type"); b.putString("data", String.valueOf(type)); i.putExtras(b); this.getActivity().startActivity(i); } }
From source file:com.example.db.messagewall.activity.MainActivity.java
private void setupDrawerContent(NavigationView navigationView) { CircleImageView imageView = (CircleImageView) navigationView.findViewById(R.id.account_logo); final TextView textView = (TextView) navigationView.findViewById(R.id.account_name); final TextView nichen = (TextView) navigationView.findViewById(R.id.account_nichen); /*/*from w ww .jav a2 s.co m*/ */ AVQuery<AVObject> query = new AVQuery<AVObject>("NiChen"); query.whereEqualTo("username", AVUser.getCurrentUser().getUsername()); query.findInBackground(new FindCallback<AVObject>() { @Override public void done(List<AVObject> list, AVException e) { if (e == null) { AVObject avObject = (AVObject) list.get(0); if (avObject.get("nichen").toString() != null) { textView.setText("?: " + AVUser.getCurrentUser().getUsername()); nichen.setText(": " + avObject.get("nichen").toString()); } else { textView.setText("?: " + AVUser.getCurrentUser().getUsername()); nichen.setText(": " + AVUser.getCurrentUser().getUsername()); } } else { e.printStackTrace(); } } }); /* logo */ SharedPreferences sharedPreferences = this.getSharedPreferences("com.example.db.alife_walllogo", Context.MODE_PRIVATE); String paper = sharedPreferences.getString("paper_path", ""); if (paper.equals("")) { imageView.setBackgroundResource(R.drawable.head_xiaoqiang_m); } else { Bitmap bitmap = BitmapFactory.decodeFile(paper); imageView.setImageBitmap(bitmap); } imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, PersonInfoActivity.class); intent.putExtras(bundle); startActivity(intent); } }); navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.nav_home: toolbar.setTitle(menuItem.getTitle()); MessageWallFragment messageWallFeagment = new MessageWallFragment(); messageWallFeagment.setArguments(bundle); fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.container, messageWallFeagment).commit(); menuItem.setChecked(true); mDrawerLayout.closeDrawers(); break; case R.id.nav_partner: toolbar.setTitle(menuItem.getTitle()); MembersFragment membersFragment = new MembersFragment(); membersFragment.setArguments(bundle); fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.container, membersFragment).commit(); menuItem.setChecked(true); mDrawerLayout.closeDrawers(); break; case R.id.nav_messages: toolbar.setTitle(menuItem.getTitle()); WallInfoFragment wallInfoFragment = new WallInfoFragment(); wallInfoFragment.setArguments(bundle); fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.container, wallInfoFragment).commit(); menuItem.setChecked(true); mDrawerLayout.closeDrawers(); break; case R.id.nav_edit: toolbar.setTitle(menuItem.getTitle()); fragmentTransaction = getSupportFragmentManager().beginTransaction(); EditWallPaperFragment editWallPaperFeagment = new EditWallPaperFragment(); editWallPaperFeagment.setArguments(bundle); fragmentTransaction.replace(R.id.container, editWallPaperFeagment).commit(); menuItem.setChecked(true); mDrawerLayout.closeDrawers(); break; case R.id.nav_add: toolbar.setTitle(menuItem.getTitle()); AskMembersFragment askMembersFragment = new AskMembersFragment(); askMembersFragment.setArguments(bundle); fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.container, askMembersFragment).commit(); menuItem.setChecked(true); mDrawerLayout.closeDrawers(); break; case R.id.nav_alert: toolbar.setTitle(menuItem.getTitle()); startActivity(new Intent(MainActivity.this, AlertWallActivity.class)); MainActivity.this.finish(); menuItem.setChecked(true); mDrawerLayout.closeDrawers(); break; } return true; } }); }
From source file:com.example.sam.drawerlayoutprac.Partner.MyFirebaseMessagingService.java
/** * Create and show a simple notification containing the received FCM message. * * @param aNotificationMsgBody FCM message body received. *///from w ww .j ava2 s. c o m private void sendNotification(String aNotificationMsgBody, Map<String, String> aDataMap) { Intent intent = new Intent(this, MainActivity.class); //?data-MainActivity.class -> ?bundle?("fcm")??: Set<String> keys = aDataMap.keySet(); Bundle bundle = null; for (String key : keys) { bundle = new Bundle(); bundle.putString(key, aDataMap.get(key)); } intent.putExtras(bundle); // ?Notification: intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); String fromMemId = aDataMap.get("fromMemId"); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.logo03_64dp).setColor(getResources().getColor(R.color.sub1_color)) .setContentTitle("DDD hotel").setContentText(aNotificationMsgBody).setAutoCancel(true) .setSound(defaultSoundUri).setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }