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. Audio write speed?

Anyone know if you can write a mono 16 bit pcm stream to flash at
44100 words a sec/88200 bytes per sec? Thanks

-- 

2. Pagi ; tanya backup

Pagi semua..........

Mau tanya nih, sama or beda sih antara Backup MemoryCard dgn Copy-Paste (termasuk hiden-file) MemoryCard-nya dah Swap/Partisi -- Jus* ~ send using pc jangkrik krik krik ~ -- "Indonesian Android Community [id-android]"

3. A little bird, not the blue bird twitter...had informed me...

4. Twicca

5. About metastate of hard keyboard

6. Please allow me to introduce myself.

7. Root Xperia