extras

startActivityForResult and Intents Extras, it seems extras are not pushed back

元气小坏坏 提交于 2019-11-27 05:51:41
问题 I have this code: Intent intent = new Intent(); intent.setAction(Intent.ACTION_PICK); intent.setData(ContactsContract.Contacts.CONTENT_URI); intent.putExtra(EXTRA_ONLINE_ID, (String) v.getTag()); startActivityForResult(intent, PICK_CONTACT); Then on response: public void onActivityResult(int reqCode, int resultCode, Intent data) { switch (reqCode) { case (PICK_CONTACT): if (resultCode == Activity.RESULT_OK) { try { Uri contactData = data.getData(); String onlineid = data.getStringExtra(EXTRA

Multiple calls to AlarmManager.setRepeating deliver the same Intent/PendingIntent extra values, but I supplied different ones

痞子三分冷 提交于 2019-11-27 05:43:05
问题 Solved while writing this question, but posting in case it helps anyone: I'm setting multiple alarms like this, with different values of id : AlarmManager alarms = (AlarmManager)context.getSystemService( Context.ALARM_SERVICE); Intent i = new Intent(MyReceiver.ACTION_ALARM); // "com.example.ALARM" i.putExtra(MyReceiver.EXTRA_ID, id); // "com.example.ID", 2 PendingIntent p = PendingIntent.getBroadcast(context, 0, i, 0); alarms.setRepeating(AlarmManager.RTC_WAKEUP, nextMillis, 300000, p); // 5

How can I correctly pass unique extras to a pending intent?

别等时光非礼了梦想. 提交于 2019-11-26 22:24:07
I'm having a problem with alarmManager and the pending intent with extras that will go along with it. If I set multiple alarms, they will go off, however the extras stay the same. I have already read into these questions: android pending intent notification problem Android keeps caching my intents Extras, how to declare a pending intent that keeps fresh extras? and I have tried: assigning a unique ID to each pending intent and using all the pending intent flags, all to no avail. I have no clue why it will not work. Here is a code snippet: Intent intent = new Intent(con,

Android: Starting app from 'recent applications' starts it with the last set of extras used in an intent

若如初见. 提交于 2019-11-26 21:18:36
问题 Bit of a confusing problem for me here: I've got a home screen widget which, when clicked, starts my main app Activity with a few extras put in the intent: Intent start = new Intent(context, Main.class); start.putExtra("action", "showXYZ"); start.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(start); This all works fine, it starts my activity and my activity receives the extras as expected. It processes these extras and starts another activity. Once a user has clicked the home

Pass arraylist of user defined objects to Intent android

瘦欲@ 提交于 2019-11-26 17:47:08
I am trying to pass a structure of arraylist to an intent as follows, In the calling function i am using ArrayList<Parliament> s=(ArrayList<Parliament>)msg.obj; Intent i = new Intent(ReadTasks.this, GenrateTasks.class); i.putExtra("tasks", s); startActivity(i); And in the called function Bundle b = getIntent().getExtras(); if(b!=null) { ArrayList<Parliament> as = (ArrayList<Parliament>)b.getSerializable("tasklist"); } I have given implements serializable in both the classes, but am getting unable to marshall.. run time error in the calling function at line start activity. Please help how to

Why the PendingIntent doesn't send back my custom Extras setup for the Intent?

安稳与你 提交于 2019-11-26 16:34:03
问题 This questions somehow relates to the question when I was looking to get the extras back in startActivityForResult but now I face another challenge. I have subscribed to receive ProximityAlerts and I have explicitly constructed the Intent to include some Extras. But when I got the service the extras are not there. After the answers here is the working code: Intent intent = new Intent(this, PlacesProximityHandlerService.class); intent.setAction("PlacesProximityHandlerService"); intent.putExtra

Android keeps caching my intents Extras, how to declare a pending intent that keeps fresh extras?

南楼画角 提交于 2019-11-26 16:13:22
A few days ago I was struggling to find a way to use custom intents for my alarms. Although I got clear answer that I have to customize the Intents based on some unique ID eg. setAction() still have some problems. I define a PendingIntent this way: Intent intent = new Intent(this, viewContactQuick.class); intent.setAction("newmessage"+objContact.getId());//unique per contact intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK ).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP ); intent.putExtra("id", Long.parseLong(objContact.getId())); intent.putExtra("results", result.toArray()); PendingIntent

How can I correctly pass unique extras to a pending intent?

浪子不回头ぞ 提交于 2019-11-26 12:19:24
问题 I\'m having a problem with alarmManager and the pending intent with extras that will go along with it. If I set multiple alarms, they will go off, however the extras stay the same. I have already read into these questions: android pending intent notification problem Android keeps caching my intents Extras, how to declare a pending intent that keeps fresh extras? and I have tried: assigning a unique ID to each pending intent and using all the pending intent flags, all to no avail. I have no

Android keeps caching my intents Extras, how to declare a pending intent that keeps fresh extras?

こ雲淡風輕ζ 提交于 2019-11-26 06:00:54
问题 A few days ago I was struggling to find a way to use custom intents for my alarms. Although I got clear answer that I have to customize the Intents based on some unique ID eg. setAction() still have some problems. I define a PendingIntent this way: Intent intent = new Intent(this, viewContactQuick.class); intent.setAction(\"newmessage\"+objContact.getId());//unique per contact intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK ).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP ); intent.putExtra(\"id\",

Pass arraylist of user defined objects to Intent android

落爺英雄遲暮 提交于 2019-11-26 05:36:52
问题 I am trying to pass a structure of arraylist to an intent as follows, In the calling function i am using ArrayList<Parliament> s=(ArrayList<Parliament>)msg.obj; Intent i = new Intent(ReadTasks.this, GenrateTasks.class); i.putExtra(\"tasks\", s); startActivity(i); And in the called function Bundle b = getIntent().getExtras(); if(b!=null) { ArrayList<Parliament> as = (ArrayList<Parliament>)b.getSerializable(\"tasklist\"); } I have given implements serializable in both the classes, but am