Launching Activity from Overlay onTap

by jgostylo » Wed, 11 Feb 2009 02:22:29 GMT


Sponsored Links
 I am wondering if I am going about this problem the correct way.

I am making an app that places overlays on top of google maps.  When
you click on the overlay it should launch a dialog type window that
will give you options on what to do with that overlay.

Currently the method I am trying to use is to Override onTap():

Intent myIntent = new Intent(context, MyActivity.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);

The context is the MapActivity that contains the MapView.  It is
passed to the Overlay with the constructor.

It is the line startActivity where the app throws an exception
(ActivityNotFoundException).  I did the setFlags because an error
message said it was needed because I was trying to start the Activity
while outside an Activity.  That makes me think I am going about this
wrong.

I have 'MyActivity' listed in my manifest so I don't think that is the
issue.  I have searched for this problem on the internet and I can't
seem to find anyone else running into this so that is another reason I
think I may be trying to do this the wrong way.

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



Launching Activity from Overlay onTap

by Tim Bray » Wed, 11 Feb 2009 02:36:44 GMT


 




This works for me just fine.  I want to launch the browser on a URL that's
associated with where they tapped:

container.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uri)));

Works fine.  So the problem must be with finding your activity.  -T

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


Sponsored Links


Launching Activity from Overlay onTap

by jgostylo » Wed, 11 Feb 2009 21:22:16 GMT


 > This works for me just fine. I want to launch the browser on a URL that's

Thanks Tim!  Your words helped me push on and I finally found out
where I was going wrong.  I had been passing the context to my
MyOverlay class incorrectly as getApplicationContext() instead of just
'this' when I declared a new MyOverlay.  When I changed that it
started working.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. speed test

Apakah ada apps untuk test kecepatan semacam speedtestnet? Pingin tau
performance agnes di  spica ini. Mohon bantuan link atau file apk-nya,
freeware kan yah?

Trims,
Alex

-- 
"Indonesian Android Community [id-android]" 

2. Root Spica

saya mau install live wallpaper, katanya harus di root ya ?
cara ngerootnya gmana ya ? soalnya saya liat di
http://forum.samdroid.net/threads/13-How-to-get-Root-on- dan
http://www.greaky.com/ caranya kok beda yah ?
 ada yang udah berhasil blom ?

makasih sebelumnya

-- 
"Indonesian Android Community [id-android]" 

3. how do you forcibly turn *on* the display....

4. build different version of android

5. how to run tests about dalvik in android source code Options

6. V4l2 USB Camera Integration with Android (Froyo & Eclair)

7. App Widget with AlarmManager... full example source?