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. ndk to access native bluetooth lib?

looking for any pointer or advise using NDK to access to native bluetooth
lib.  is it doable?  anyone have good or bad experience to share?

-- 

2. Pulling Touch Screen Events

Hi all.

I'm trying to write a musical application and I want the user to be
able to press multiple keys at the same time to play chords. Based on
my tests, it appears that the MotionEvent.getPointerCount() method at
MOST only returns 2 touch events. Even if I have 5 fingers pressed to
the screen, it only returns a pointer count of 2.

So, instead of allowing the View class in my application to push
MotionEvents to me, I am wondering if it is possible to poll the touch
screen and "pull" touch information from the hardware. Ie, can I say
TouchScreenObject.isThereATouchAtTheseCoordinates(x,y), or something
to that effect? If I can do this, then I can test different parts of
the screen rapidly and create the illusion of >2 finger multitouch.

Does anyone know if the SDK allows us to query the hardware in this
way?

-- 

3. Smtp axis

4. How to set logo in the title bar dynamically

5. No need apps2sd

6. Sold - WTS: Nexus One Second

7. Developing a C++ static library for use with Java on the Android