Calling Intent from Two Locations

by Mark Robinton » Sat, 01 Nov 2008 06:27:44 GMT


Sponsored Links
 Hi,

I am trying to call an intent to select someone from the contactlist
from 2 different places in my program.

In one activity class (my main one) I call:

                Intent i=new Intent(Intent.ACTION_PICK,
                Uri.parse("content://contacts/people"));
                startActivityForResult(i, PICK_REQUEST);


and I am able to catch the result of PICK_REQUEST in my
onActivityResult function, no problem.

When I try calling the same intent within another class, it still
tries to catch it in the
onActivityResult of the main class, not in the onActivityResult i
implemented in the 2nd class.

What am I doing wrong so I don't jump out of my other class (where
there's private data I want to access once I am done getting the
contact info).

Thanks,
Mark



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



Calling Intent from Two Locations

by Mark Murphy » Sat, 01 Nov 2008 08:23:38 GMT


 


Is the second class an activity? If not, there's your problem.

If the second class is an activity, I would expect the callback to match 
where startActivityForResult lies. You're not calling 
startActivityForResult in some inner class that gets passed around by 
any chance?

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 1.3 Published!

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


Sponsored Links


Other Threads

1. Downloading a particular software component of a particular branch

Hi all,

I would like to download ril (radio interface layer) of eclair branch
only. I know I can download the the entire eclair branch using repo.
However, it will take a long time as I only need to download only ril
from eclair only.

May I know which command should I use to download ril from eclair
only? I have googled for help but could not find help on this aspect
except downloading the whole eclair branch.

-- 

2. Determining the subset of text that is visible in a TextView

Assume I have a block of text that is too long to fit into a standard
TextView. When I put that text into the TextView via the setText()
method, it gets truncated.

Is there any way that I can then query this TextView or some other
component in order to find out the subset of the text which is
actually being displayed?

I know that I can calculate this by considering the screen dimensions,
the font metrics, the border spacing, the screen orientation, the
TextView dimensions, etc., etc. ...  However, is there a way to simply
query some object in order get this information directly?

After all, the inverse set of calculations has to be performed in
order to decide what text to actually draw in the TextView, so
theoretically at least, there should be a straightforward way to
retrieve the text that is actually being displayed.

Thanks in advance for any suggestions or pointers to documentation.

-- 

3. Simple code hangs the android emulator.

4. Layout: Battery usage bar

5. setSingleChoiceItems api usage in a dialog

6. monkeyrunner fails for emulator: Error starting command: monkey --port 12345

7. How to Declare file write permission in framework code