Android :: How To Return Location Pressed To MapActivity From An Overlay OnTap Method
Aug 30, 2010
I have an activity that has a button which opens a new MapActivity to select a location by tapping on the map.
The map has an overlay that overrides the onTap method to get the location but I want to return that location to the previous activity but, I don't know how to return the geopoint to the mapactivity in order to call the setResult() and finish() methods, because I can't call them from the Overlay.onTap method.
View 2 Replies
Feb 10, 2009
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.It is the line startActivity where the app throws an exception.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.
View 3 Replies
View Related
Feb 10, 2009
I am attempting to launch a dialog type window when I click an Overlay that has been placed on google maps. I thought the way I would do this was Override the onTap() method, create an intent, and call startActivity on that intent as follows:
CODE:..........
It looks like the program throws an ActivityNotFoundException when executing that last line. The exception reads that if you try to start an Activity while you are not in an Activity you need to set the FLAG_ACTIVITY_NEW_TASK flag which is why that line is there. I have included MyActivity in my manifest.
'context' is passed to my class constructor that extends Overlay and is the MapActivity that I am using to display the map.
View 2 Replies
View Related
Jul 29, 2010
I have several Overlays drawn on a MapView with ItemizedOverlay, and an onTap that works when I first start my app. However, if I press the Back button on the Android then start my app again the onTap does not work at all. Other touch sensative operations work fine, like long press on the map and several face buttons. It is also fine if I press the Home button on the phone then go back into my app, so its only on the Back button. It will also work if I first open another app like the Maps app, then go back into my app, acting like a reset.
Overriding the onBackPressed method to move the task to the background also does not work, does anyone have any ideas what would cause this? It happens in both the emulator and on a real device.
I don't know if it will help but here is the relevent code:
CODE:...........................
View 1 Replies
View Related
May 5, 2010
Could anyone help me with my below program. I'm unable to put a transparent label containing the contents from my HelloGoogleMaps.java class (Hola, Mundo!) when i click the markers(the android icon) in the map. I would like to have the ontap event do it for different markers here so that that particular location details is popped up. It needs to be in a canvas display. Upon clicking this new canvas label, it should take me to a seperate activity displaying complete details. I'm using the sample program given in the Google Android Website http://developer.android.com/resources/tutorials/views/hello-mapview and i want to extended it to the next level. Import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; import com.google.android.maps.OverlayItem; import android.app.Activity; import android.graphics.drawable.Drawable; import android.os.Bundle;
View 2 Replies
View Related
Apr 9, 2010
I've implemented a Class that extends Overlay and also override the onTap / onTouchEvent (tried both). Right now it seems like that event is triggered when you tap on the map regardless of position.How can I make sure that the event is triggered only when you tap over the overlay you have added?
View 2 Replies
View Related
Mar 4, 2010
I want to override the method enableMyLocation() in MyLocationOverlay class, in order to implement my own positioning algorithm to get latitude/longitude, and then plot them onto a MapView. I figured out how to do that, but now I'm stuck because I dont know what Canvas to pass when I call the method drawMyLocation().
Here is the MyLocationOverlay class
View 4 Replies
View Related
Jun 7, 2010
In the description of how to add a list of options to an AlertDialog the official Android documentation alludes to saving a users preferences with one of the "data storage techniques." The examples assume the AlertDialog has been spawned within an Activity class.
In my case I've created a class that extends ItemizedOverlay. This class overrides the onTap method and uses an AlertDialog to prompt the user to make a multi-choice selection. I would like to capture and persist the selections for each OverlayItem they tap on.
The below code is the onTap method I've written. It functions as written but doesn't yet do what I'd hope. I'd like to capture and persist each selection made by the user to be used later. How do I do that? Is using an AlertDialog in this manner a good idea? Are there better options?
CODE:.......................
View 2 Replies
View Related
Nov 20, 2009
An Activity that extends from MapActivity Uses ItemizedOverlay to show some balloons on the map ZoomControls are enabled
The ItemizeOverlay implements onTap(...) which works perfectly ok when tapping one of the overlay items.
The question is: How to identify a tap on another part of the map (with the intention of getting the location and center'ing on that point)
View 1 Replies
View Related
Nov 4, 2010
This is what I'm trying to support. Can this be done?
a) User is an Activity A in my app. b) The user is taken to the native dialer when he chooses a particular action in my Activity c) User presses the back key d) Taken to homescreen
Is there a way I can change it, so the back key press returns him to my app, instead of native homescreen?
View 14 Replies
View Related
Oct 25, 2010
Basically I have created a blackjack game (first using just java) and it falls under an infinite while loop (this is so that the deck data is kept and everything works well. So first it deals the cards and then it needs to wait for either the hit button (which is displayed) or the stand button (which is displayed) to be clicked. I initially did this with a while loop that would keep checking if buttons were hit (basically when a button was hit, a static int would change and stuff would occur). However this just causes the droid to freeze up (thus far anyway) and also not refresh. So please someone tell me there is some way I can have my method pause until a button is pressed? I also need to know the proper way to use invalidate() so that my textviews, pictureviews and such can be updated as the methods change them.
View 3 Replies
View Related
Jan 19, 2010
Trying to make an google maps overlay in an android program. Inside of my overlay's draw method, I have two ways of adding a pin. One of them works, and one does not. Unfortunately, the one that does not work is also the only one that has the ability to add a shadow!
CODE:...........................
View 2 Replies
View Related
Mar 15, 2010
I am building a MapView and I want my custom overlay items to display the name of the location they are marking when the user taps them, like the Android Maps app. I setup the onTap listener and the floating TextView to hold the location name. I still need to set it up so that it redraws the label when the user moves the map, etc. Anyway, I am wondering if I am reinventing the wheel here. Is there a built-in method I am unaware of? I would think that most implementations of MapView have labels. For reference, my implementation so far: in map xml:
<LinearLayout android:id="@+id/mapBubbleWrap" android:layout_width="wrap_content"
andoid:layout_height="wrap_content" android:layout_alignParentTop="true">
<TextView android:id="@+id/mapBubble" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:visibility="gone"
android:background="#ffffff" android:textColor="#ff0000"/>
</LinearLayout>
in my extended ItemizedOverlay:
public boolean onTap(int index) { this.setFocus( mOverlays.get(index) ); return true; }
in my Activity onFocus:
public void onFocusChanged( ItemizedOverlay overlay, OverlayItem item ) {
if( item != null) { mapBubble.setText(item.getTitle());
Point newPoint = mapView.getProjection().toPixels(item.getPoint(), null);
mapBubbleWrap.setPadding(newPoint.x, newPoint.y-10, 0, 0);
mapBubble.setVisibility(View.VISIBLE); } }
View 1 Replies
View Related
Aug 18, 2010
I am trying to see if anyone knows if it is possible to change the update time of MyLocationOverlay (http://bit .ly /dBIVdj). I have tried subclassing MyLocationOverlay and implementing my own location manager but when that happens I do not see the overlay on the map. I would try overriding the drawMyLocation method however I don't know which canvas to provide the method (since I would be drawing onLocationChange). To summarize, I am looking to do three things in MyLocationOverlay subclass:
1. Change the location update times to whatever I want.
2. Draw the "my location" dot with the radius when the onLocationChanged() method is called.
I've thought about making my own special class with special overlay -- but I feel like there has to be a better method to get what I want out of this class.
View 13 Replies
View Related
Aug 24, 2010
I want to use my image to replace the Compass image of MyLocationOverlay, how can i implement?
View 1 Replies
View Related
Aug 11, 2010
I am trying to implement the MyLocationOverlay class from google maps. However, when I try and use my own locationManager -- I cannot get the overlay to acutally draw on the map. I am wondering if I am doing something wrong.
I don't want to call the super method(enbaleMyLocation) of the MyLocationOverlay class because that request updates from the locationManager way too quickly and will eat my battery alive.
Here is my code...
View 2 Replies
View Related
Nov 3, 2010
I am using these three lines to add a compass on the MapView: mMyLocationOverlay = new MyLocationOverlay (this,mapView);mMyLocationOverlay. enableCompass(); mapView.getOverlays() .add(mMyLocation Overlay) ; However the default position of the compass showing on the screen is not too good for my apps, and I want to move it to somewhere else. Anyone knows how I can achieve that?
View 2 Replies
View Related
Oct 26, 2010
I'm messing around with maps and gps and i have some questions. Hope any of you point me in the right direction:
- I´m loading about 400 overlays in a mapview, but it takes 2-3 minutes. Is there any way to speed things up?
- On the other hand, I use another overlay to point device gps position, but when location point change i need to delete this overlay to put it again in it's new position. How can i delete this overlay without deleting all the others?
View 15 Replies
View Related
Jun 25, 2010
I am doing some android application. I just wonder what will case the managedQuery method return a null value?
View 1 Replies
View Related
May 4, 2009
I live in an area which is 9 feet above sea level, and when I call getAltitude I get back a value less than -10. Am I doing something wrong, is my device a failure, or is there some nifty scale that I don't know about?
View 2 Replies
View Related
May 5, 2009
Is there any API method{[android.location " pack ] to get location name? did not find related method to to retrieve location name for given GeoPoint(lat,lon); I wanted to keep list of location names for particular GeoPoints (lat,Lon) in journey. can this be achievable in Android to calculate the name of location from lat .
View 4 Replies
View Related
Sep 3, 2010
I am thinking to create a static method to return a reference to the application instance. I am not sure if it is safe to assume there is only one instance of the Application in one application. Apparently, the Application class in Android SDK doesn't provide such method to return the instance reference. So I suspect there must be a reason?
View 1 Replies
View Related
Jul 8, 2010
I have a problem and that is my SplashScreen I have. It is built as an intro and after 3 seconds it shows the main menu of the program. Anyway, if I press down Back or Home button during the time the SplashScreen shows, it closes, but the activity I have chosen to follow after the SplashScreen will still run after the three seconds.
My code: **UPDATED CODE**
Handler ur = new Handler();
myRun = new Runnable() {
public void run() {
mainIntent = new Intent(SplashScreen.this,MyApp.class);
SplashScreen.this.startActivity(mainIntent);
SplashScreen.this.finish();..........................
View 1 Replies
View Related
Sep 19, 2010
I don't understand this. When you hit the back button after following a link, you go back to the previous page, but not where you left off. The browser seems to just throw you somewhere near the top of the page. Is there a settings fix for this, or is it just how it works?
View 10 Replies
View Related
Aug 18, 2010
I like tu use the MapActivity to display some pins. When a pin is pressed i like to open a description. This can I obtain following the tutorial: http://developer.android.com /resources /tutorials/views/hello-mapview. But now I like to put a button on the overlay window. That button should open a detail activity. How can I make this? How is possible to personalize the overlay "info window"?
View 2 Replies
View Related
Feb 15, 2010
I'm using Google maps. I put the markers on map and my inherited ItemizedOverlay overrides onTap() method.
Markers are 32x32 images.
However, I can tap quite a bit away from the marker and still receive the event. This becomes a problem when markers are close to each other.
View 2 Replies
View Related
Jun 15, 2010
I have a MapView where I would like to be able to tap the map to create a new item at that location if there is no item there, or display the info about the item if there is.
I tried overriding both the onTap(int) and onTap(GeoPoint, MapView) methods but apparently if the second method is overridden the first never gets called (commenting one or the other lets each one work as I expected).
I thought about just checking if an item was at the location, but there doesn't seem to be any handy methods available to do that (other than iterating through the list of items and checking each manually).
View 17 Replies
View Related
Aug 3, 2010
I have an Overlays class named picOverlay which extends ItemizedOverlay<OverlayItem> that uses a drawable named ''overlay''.
I'd like for my application to change the drawable to let's say ''overlay_hover'' when the user touches the overlay.
Can I do this in the onTap method? Can someone enlight me a little bit on how to change the drawable that I'm actually touching?
View 2 Replies
View Related
Aug 28, 2009
I have a mapactivity with multiple ItemizedOverlays and a onTap method when the user clicks on the marker. I can show a toast message but i want to display a Dialog when the user clicks on the marker (so in onTap method). How can i do that?
View 2 Replies
View Related
Feb 4, 2010
When I add a new item to my ItemizedOverlay the onTap display I have set appears X times, where X is equal to the number of items that I added. So for example, if I add one item and tap it, it the onTap method gets called once, and in the LogCat I get:
02-04 23:28:56.188: INFO/NotificationService(52): enqueueToast pkg=android.mapit callback=android.app.ITransientNotification$Stub $Proxy@4394c100 duration=0
If I add a second item and click ANY of the other items, the onTap method gets called twice and I get the following in LogCat:
CODE:.....................
If I add a third item and click ANY of the other items, the onTap method gets called three times and I get the following in LogCat:
CODE:...................................
Any idea why this would occur? I'm running into issues with it affecting other things like removal of items.
View 2 Replies
View Related