Question about passing data using intents?

When using an Intent to start another activity, the receiving activity must use the getIntent() method to access it; there is no reason to use savedInstanceState for this purpose; that's only useful when "restoring" an activity's current state because it was interrupted You can use the "extras" of the Intent in the sending activity to transmit the data you want to send. The receiving activity uses the same extra names to get to the data. Also, never assume all the extras were sent (i.e.

Check for null s! ) You should make all the decisions about what the activity's action is, in the onCreate method of the receiving activity If an activity can be "started" multiple ways, you must use Intent.setAction() in the Intent and check for all valid actions, in the receiving activity Also, do not depend on the id parameter in onListItemClick it is often incorrect. The position parameter is always correct, and you can use it to get to the actual item from the adapter, and get the ID from the item.

Usually, one sets the Intent s data URI instead of sending the ID as an extra; this works better with the system's Activity resolution (see below) In fact, "data manipulation" activities should support the standard actions for data editing INSERT EDIT and the like, and have intent filters that specify those actions and your data's MIME type. I'm pretty sure those are part of the example application In the receiving activity, you must call Activity.setResult() and you typically send back return data (e.g. New content URL) via another Intent which you then access from the sending activity in onActivityResult() Also, you must call setResult() at an appropriate time; e.g. Calling it during lifecycle exit ( onPause() or onStop() ) is too late, and will not transmit your results back.

When using an Intent to start another activity, the receiving activity must use the getIntent() method to access it; there is no reason to use savedInstanceState for this purpose; that's only useful when "restoring" an activity's current state because it was interrupted. You can use the "extras" of the Intent in the sending activity to transmit the data you want to send. The receiving activity uses the same extra names to get to the data.

Also, never assume all the extras were sent (i.e. Check for nulls! ) You should make all the decisions about what the activity's action is, in the onCreate method of the receiving activity.

If an activity can be "started" multiple ways, you must use Intent.setAction() in the Intent and check for all valid actions, in the receiving activity. Also, do not depend on the id parameter in onListItemClick it is often incorrect. The position parameter is always correct, and you can use it to get to the actual item from the adapter, and get the ID from the item.

Usually, one sets the Intent's data URI instead of sending the ID as an extra; this works better with the system's Activity resolution (see below). In fact, "data manipulation" activities should support the standard actions for data editing, INSERT, EDIT and the like, and have intent filters that specify those actions and your data's MIME type. I'm pretty sure those are part of the example application.In the receiving activity, you must call Activity.setResult(), and you typically send back return data (e.g. New content URL) via another Intent, which you then access from the sending activity in onActivityResult().

Also, you must call setResult() at an appropriate time; e.g. Calling it during lifecycle exit (onPause() or onStop()) is too late, and will not transmit your results back.

When using an Intent to start another activity, the receiving activity must use the getIntent() method to access it; there is no reason to use savedInstanceState for this purpose; that's only useful when "restoring" an activity's current state because it was interrupted. You can use the "extras" of the Intent in the sending activity to transmit the data you want to send. The receiving activity uses the same extra names to get to the data.

Also, never assume all the extras were sent (i.e. You should make all the decisions about what the activity's action is, in the onCreate method of the receiving activity. If an activity can be "started" multiple ways, you must use Intent.setAction() in the Intent and check for all valid actions, in the receiving activity.

Also, do not depend on the id parameter in onListItemClick it is often incorrect.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions