Android :: More Efficient Map Overlays
Nov 2, 2009
In my app I am drawing bus routes on top of a MapView. The routes have anywhere between a dozen and a few hundred GPS coordinates that describe the route that the bus takes. The problem I'm having is that once I draw out all these lines panning/zooming the MapView is incredibly slow (even clicking the 'Back' button takes a minute to happen). I'm not sure how relevant it is, but I put in some debug code then checked the logcat output and the MapView is repeatedly calling the draw() method of the Overlay whether anything has changed or not. This is happening several times a second and is causing a massive amount of garbage collection to happen (2-3 MB every second).
View 2 Replies
Nov 24, 2010
I want to do the following and am kind of stuck on these for a few days:
1) I was trying to draw poly lines ( I have encoded polylines, but have managed to decoded those) that move when I move the map(the only solution that I found was for Geopoints to be transformed into screen co-ordinateswhich wont move if I move the map !)
2) I have used helloItemizedOverlay to add about 150 markers and it gets very very slow.any idea what to do ? I was thinking about threads(handler)
3) I was looking for some sort of a timer function that executes a given function, say, every 1 minute or so.
4) I was also looking for ways to clear the Google map from all the markers/lines etc
View 1 Replies
View Related
Sep 23, 2010
I've searched here and on the interweb, but cannot find out how to add overlays (.kml files) into Maps or Earth. Can it even be done (shame if not) and if so, how do I do it.
EDIT: I've tried MyMapsEditor, but that doesn't run on Froyo.
View 2 Replies
View Related
Jun 21, 2010
Is there any efficient linear algebra library for android? I need to compute matrices of different sizes(also bigger than 4x4) and rectangular too.
View 1 Replies
View Related
Aug 3, 2010
My application requires that when a snapshot is taken it must store in memory and next time when I restart the phone I must get a thumbnail of that photo in list of photos and the full scale photo when I click on it.There are 2 ways I know.
1. Store images directly. Concern here is every time it has to hit directory to get image which takes some time.
2. Store all images in single xml. Concern here is XML will be too big and takes time to parse.
View 1 Replies
View Related
May 26, 2009
What's the most efficient way to clone a JSONArray?
View 2 Replies
View Related
Aug 21, 2009
I have some image names stored in a database, but the images themselves are in the /res/drawable folder of the application. I need to assign these images to some views at runtime, and I'm currently doing it this way:
// public static final String DRAWABLES_PATH = ":drawable/";
int resId = getResources().getIdentifier(packageName+DRAWABLES_PATH +imageName,null,null); mButtonX.setBackgroundResource(resId); //
Is there a more efficient way to do it? Or should I be storing the images directly in the database (they are many)?
View 2 Replies
View Related
Jul 17, 2010
What I am trying to do - I am continuously getting a stream of lat/lng positions, I want to move a overlay item dynamically on the map based on the lat/lng in the stream. I am displaying the location of moving object dynamically on the map
I am putting my whole code in a while(true) loop and trying to read the stream every 5 seconds and refresh the overlays on the map. But overlay items are not shown until the function (either oncreate, or any onclickeventhandler etc) is completed. For example, test code, I am adding a single test overlay item when ever the user clicks on a button. If I put a wait(2000000) "after" I add overlays and invalidate the map, the overlay is not displayed until the time has elapsed and the function is completed.
View 5 Replies
View Related
Sep 28, 2009
My problem is my MapView becoming very laggy and so non-responsive at times, that Android thinks its hit deadlock and tries to close it.
I am adding 60 overlays to the map view and i originally thought that the icon size may be causing the problem by using up all the memory. When i decreased the overlay icon size, it did improve things, though it is still to slow to be usable. Has anyone experienced anything similar and have a workaround? There may be a better way of doing it other then extending the Hello MapView example.
View 8 Replies
View Related
Sep 12, 2010
I have the following code to add an Overlay
myMapView.getOverlays().add(sites);
myMapView.invalidate();
I also have the following remove code where sites is a global variable.code...
Sometimes I am left with duplicates so would like a way to remove all overlays from a map, is this possible?
View 1 Replies
View Related
Aug 22, 2010
I'm using a mixture of the "Efficient Adapter" and the EndlessAdapter from CommonsGuy, and sometime the holder in getView() is null.
CODE:.............
I've put the rest of the code for both of my classes here, as it's rather large to paste inline.
Once the whole data set is loaded, scrolling up & down causes rows to disappear and re-appear too.
View 1 Replies
View Related
Dec 29, 2009
Currently I'm using a HashMap to map the strings to int and the int values need to be frequently accessed. I'm looking for a better way to do this if possible with minimal object creation, and preferable being able to store the values as primitive ints without wrapping them with the Integer class. (Basically, the reverse of the SparseArray's int->object mapping.)
View 4 Replies
View Related
Jul 10, 2010
I am trying to reduce the size of images retrieved form the camera (so ~5-8 mega pixels) down to one a a few smaller sizes (the largest being 1024x768).It looks like the OOM happens during the createBitmap. Is there a more memory efficient way to do this? Perhaps something that doesn't require me to load the entire original into memory?
View 2 Replies
View Related
Jun 24, 2010
It happens that the user click on enter where i dont want to include it as a part of my input the string can end with 3 times so just replacing one wont do the job
My solution was:
CODE:........
Or just to point there without the new but i want later to dump the garbage. Or at least to dump values to the gc now ....
View 5 Replies
View Related
Apr 12, 2010
I currently have a Service in Android that is a sample VOIP client so it listens out for SIP messages and if it recieves one it starts up an Activity screen with UI components. Then the following SIP messages determine what the Activity is to display on the screen.
For example if its an incoming call it will display Answer or Reject or an outgoing call it will show a dialling screen. At the minute I use Intents to let the Activity know what state it should display. An example is as follows:
Intent i = new Intent();
i.setAction(SIPEngine.SIP_TRYING_INTENT);
i.putExtra("com.net.INCOMING", true);
sendBroadcast(i);
Intent x = new Intent();
x.setAction(CallManager.SIP_INCOMING_CALL_INTENT);
sendBroadcast(x);
Log.d("INTENT SENT", "INTENT SENT INCOMING CALL AFTER PROCESSINVITE");
So the activity will have a broadcast reciever registered for these intents and will switch its state according to the last intent it received...............
View 2 Replies
View Related
Feb 14, 2010
i have a problem with my mapView. my app reads "some" gps points out of a file and i want to draw a route (drawing lines between the gps point). If my file contains many gps points, my app works really slow. i think its working slow, because i draw all overlays. now i want to check, whether a point is visible in my mapView or not. so i have to get the mapCenter and Lat/lon span (getLatitudeSpan,..) !? how and where must i save my points and how can i check all my points (after my mapCenter has changed for example). Shall I save my points in a list (in my Overlay class??) and iterate through every list item and check, wheter its visible or not?
View 4 Replies
View Related
Oct 29, 2009
I've been reading the (shoddy) documentation for the Google Maps API (MapActivity et al), and I think I have roughly worked out how it works. It seems that if you want to add a marker overlay you can use ItemizedOverlay easily, but you have to add all your markers at once. There doesn't seem to be any way to remove them.
What I want to do is query markers from an online database as the user pans around (in the same way the actual map tiles are fetched). Is there a simple way to do this?
As far as I can tell I need to subclass Overlay and implement the draw method, but where is the best place to put the code that fetches new markers when the map is panned? There doesn't seem to be an onMapChanged() method anywhere. My best guess is MapController.onKey() but that seems wrong.
View 2 Replies
View Related
Feb 17, 2010
I'm seeing a bug with overlays on MapView with the Nexus One. Pinch and zoom multitouch gestures don't scale my overlays until the user releases the gesture, at which point the overlay redraws itself. In contrast, the My Location overlay in Google Maps WILL scale during the gesture. Is there a way to fix this in my app, or is this a MapView bug?
View 2 Replies
View Related
Mar 1, 2010
I followed the instructions from the google hellomapview tutorial. I get a working mapview etc. But the two items that are added to the map are not shown. It seems they are there somewhere because tapping at the specified location shows the message that was added to the items.
Here is my source code. It should be very close to the google tutorial source code.
CODE:.............
View 2 Replies
View Related
Apr 17, 2010
I have a map in my android application that shows many markers (~20-50). But the app performs very poor when i try to scroll/zoom (in Google Android Maps i did a sample search for pizza and there were also some 20-50 results found and i didn't notice any particular performance problems when zooming/scrolling through the map).
onCreate() {
....
drawable = this.getResources().getDrawable(R.drawable.marker1);
itemizedOverlay = new MyItemizedOverlay(drawable,mapView);
...
callWebServiceToRetrieveData();
createMarkers();
}..............................
View 4 Replies
View Related
Apr 14, 2010
I have a ImageView and draw some things on that view. Now I want to have the position of the click in the onClickListener. Although I think that's not really possible (storing the position in the onTouchListener is not working), I want to ask, if there is any other way to accomplish that? The goal is to have a image with some overlays, that should be clickable. I thought about AbsolutLayout, but that is depracated, so what now?
View 1 Replies
View Related
Oct 1, 2010
The Android the MapView Overlay class mentions two draw methods. One regular, and one for animated overlays.
I have tried to find more information on how to animate overlays and use this second method, but it all keeps coming back to the same forum postings. Can anyone explain how you specify to the MapView that a certain Overlay should be animated? How do you specify the manner in which it animates?
If it's relevant, I'm currently trying to draw pins in the map that update in realtime with streaming GPS locations for objects. I get new data every two seconds and need to tween the locations by having the pins move in a simple straight line between coordinates.
View 1 Replies
View Related
Sep 26, 2010
I would like to make a game out of many cubes and am planning on putting it on mobile platforms and also on the web using webgl. My problem is when I make a drawelements call per cube I take a hit on the frame rate. Is there a way I can make a single draw call to opengl es to draw them? The only difference between the cubes would be position and color.
View 4 Replies
View Related
Dec 2, 2009
I am doing a project where I have too develop an application that listens for incoming events by a service. The device that has to listen too events is an Android phone with Android SDK 1.5 on it. Currently the services that call events only implement communication trough UDP or TCP sockets. I can solve my problem by setting up a ServerSocket, but i doubt that's the most power efficient way. This application will be running most of the time, with Wi-Fi on, and I'd like too reach an long battery duration. I've been looking for options on the internet for my question for a while but i couldn't get a real answer.What is the most efficient way too listen to incoming events? Should I make an ServerSocket? or what are my options?Are there any other implementations that are more power efficient?
View 1 Replies
View Related
Sep 3, 2010
In my android app i need to get 50,000 database entry(text) and compare them with a value when the activity started(in onCreate()).I am doing this with the simplest way : i get the whole table from db to a cursor.However this way is too laggy.Are there any other way to do it more effective?The app is "scrabble solver" that is why i am not using WHERE close in my query (Take the whole data annd compare it with combination of the input letters).At first i was using a big table which contains whole possible words.Now i am using 26 tables.This reduced the lag and i am making database call on a thread that solved a lot problems too.It is still little bit laggy but much better.
View 4 Replies
View Related
Oct 19, 2010
on softkeyboard, which one is better to give user a visual feedback during keypress:
1.redraw portion of button that was pressed to background canvas of main View to give pressed effect
2.each button has its own "pressed" View, and that View is set to visible (flashing) during keypress event (so no redraw needed but need more memory)
I know its trade-off between speed and memory usage, but I just want to know what you will do under this situation.
View 1 Replies
View Related
Oct 12, 2010
I'm pretty new to java programming and am looking to do basic data mappings.What I want to happen is when you click an item it goes to it's subcategory.I'm not worried about switching the data when an item is clicked. I'm just not sure how to create the data set in an efficient way using Android.Eventually this will be driven by a database but I want to figure out how to use mock-data to get this working first.I'd like to be able to access it like myData['category2'] or myData['category2']['subcategory3']Should I create this in xml files and link them up or is it best to create a new class structure for it?
View 1 Replies
View Related
Jan 14, 2010
What is most efficient way of keeping a check on time within a game thread? Currently I create a new Date() when the game starts and was thinking of creating another Date() within the game thread and comparing it with the first one. But with a screen refreshing at around 60fps (hence a new date object each time), I can't help thinking this is rather inefficient. What other ways are there of doing this?
View 8 Replies
View Related
Nov 15, 2010
I've got a game, a custom View class draws my gameboard. I'm thinking of drawing some elements on a separate layer above the gameboard. I could do this in the View's canvas code, but since they won't change frequently, was thinking of introducing a frame layout to display this top layer.I'm not sure which route to take, the only reason I wouldn't do the FrameLayout is because I'm not sure if it has an impact on battery life. Everytime onDraw() is called, the system probably has to do an alpha composition of the two layers. Is that more battery consuming than drawing the elements from that layer myself in my canvas on every frame? Hard to answer since I'm not sure how complex the drawing will be yet, any general opinions?
View 1 Replies
View Related
Oct 9, 2009
When an overlay is put on a MapView, the shadow suggest that its at an angle and not flat on the map.
I have been creating scaled bitmaps to overlay on a mapview, but i am either geting the scale wrong or the overlay is being painted at a slight angle, sitting up a bit, rather then being flat to the map.
Does anyone know if this is true? and if so, is there a way to stop it painting at an angle or do you know the angle so i can compensate for it when creating the bitmapped overlay?
View 2 Replies
View Related