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. How to Make your owrn SDK with full calss library(function)

Hi, All,
When you want to modify the android system applications such as
Calendar, Email, Launcher, you can download it, and add that project
into Eclipse, but there are alway more or less errors which said some
class couldn't be referenced, for example, in the official SDK,
(android.jar), there are no
android.net.http.androidHttpClient,
android.provider.im,
.....


So, we need a full class contained SDK, generally you can build your
ower by:
$make sdk
But unfortunately, the builded SDK  also don't contain the missed
class file. Does any one konw how to add the missed class files in to
SDK packet? I think this is one very basic development environment, it
will benefit much developer loving android!

Thanks.

Kerr

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. unable to add a new layout xml file.

using eclipse 3.4.1 and also 3.5 and I cannot seem to add a new
layout .xml file.

i tried adding it externally using windows explorer, but got all these
errors.

[2009-08-21 00:01:54 - TestAndroid]     (skipping index file
'C:\workspace\TestProject\res\drawable\Thumbs.db')
[2009-08-21 00:01:54 - TestAndroid] res\layout\Test1.xml:
Invalid file name: must contain only [a-z0-9_.]
[2009-08-21 00:01:54 - TestAndroid] res\layout\Test1.xml:
Invalid file name: must contain only [a-z0-9_.]

then i tried right click on the layout folder, selected new Android
XML file and I got this --

The selected wizard could not be started.
  Plug-in com.android.ide.eclipse.adt was unable to load class
com.android.ide.eclipse.editors.wizards.NewXmlFileWizard.
  com.android.ide.eclipse.editors.wizards.NewXmlFileWizard

I tried both versions of eclipse, I tried uninstalling and
reinstalling the ADT plugin.  Nothing seems to be working!

tia.
--~--~---------~--~----~------------~-------~--~----~

3. RILD works abnormally after setting up APN via GPRS

4. where can I find the posts that I posted

5. Developing Facebook Apps for Android

6. odd issues with port 80

7. MediaRecorder API: preview is not happening and audio sounds muffled