beginner question.

by Honest » Thu, 04 Dec 2008 00:59:51 GMT


Sponsored Links
 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 ?



--~--~---------~--~----~------------~-------~--~----~



beginner question.

by Mark Murphy » Thu, 04 Dec 2008 01:30:37 GMT


 


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 

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. mouse pointer not going

I have implemented mouse pointer succesfully following the patch -
0001-fixed-different-build-breaks-added-mouse-cursor-sup.patch. But
the pointer remains there even after I remove the mouse. Can anyone
help me to fix this? Shall I get any event in EventHub.cpp file when I
remove the mouse from the device? Please suggest.

-- 

2. SMS Ringtone

Hi,

I want to change SMS ringtone programatically from a raw resource  but I
don't find any example to do it.


Thanks
Regards

-- 

3. Using Settings.System inside MediaPlayer

4. Paging bos tio

5. Ko Indosat IM3 Dari Kemaren malem ga bisa online yah?ada yang mengalami hal sama?

6. Service State

7. JSON - Database - Local Variable`