Honest wrote:
> I am just learning android. I was reading API documentation. I found
> the following line of code which i cannot understand so can some one
> explain me what is wrong in it ?
> 
> 
> String path = intent.getStringExtra("com.example.android.apis.Path");
> 
> Can some one tell me what this method getStringExtra() will do ? and
> the String "com.example.android.apis.path") means ?

Intents can be packaged with "extras", which more or less amount to a 
Map of additional bits of data. While the "extras" aren't used in 
routing Intents to applications that can handle them, they can package 
information that the recipients could use to better handle the request.

Since "extras" are keyed by Strings, the core Android team recommends 
you use a namespaced-qualified key (e.g., 
"com.example.android.apis.Path") rather than something short (e.g., 
"Path"), to make sure there aren't any collisions on naming.

In terms of what, exactly, "com.example.android.apis.Path" should hold, 
you would have to ask the author of the code where you got that sample 
from. It is up to the Intent recipient to document what extras are 
available and what they should hold if used.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com

Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to