|
POST
|
By default, the android.view.View is destroyed whenever the phone rotates or you transition to another view. I disagree with that design, but it's fundamental to the Android OS, and it even affects web apps running in the phone's browser. Here's a few ideas that I've used before: 1) Until you can migrate to Fragments you can "temporarily" continue to use onRetainNonConfigurationInstance() with your current architecture. That's not ideal, of course, but the functionality is deprecated but not gone and removed from the native SDK...yet. 2) You can prevent rotation of the screen but not allowing it in the manifest. I've seen this most often on phones where viewing the map in portrait mode makes the most sense and best use of screen real estate. I understand that might not work with your requirements. 3) **Make sure you set the android:configChanges property in the manifest's Activity tag. For example, android:configChanges="orientation". This prevents the onCreate event from firing every time the phone rotates. Why? Because every time onCreate fires then depending on how you architected your code it could be rebuilding (or partially rebuilding) your map. You can also do the following if #2 above doesn't resolve your issues: 1) Store any important map or graphic layer values in SQLite or in a singleton 2) Listen for rotation events 3) when phone rotates rebuild the map using the values stored in step #1. Again, this isn't ideal but the pattern can give you a framework for attempting to maintain map state. -Andy -Andy
... View more
07-31-2013
08:58 AM
|
0
|
0
|
1668
|
|
POST
|
Jozef, can you run a basic, Hello World map from the SDK? Here's a blog post I wrote that may help narrow the problem down: http://www.andygup.net/troubleshooting-multi-threading-problems-related-to-androids-onresume/ -Andy
... View more
07-31-2013
08:36 AM
|
0
|
0
|
2814
|
|
POST
|
Esther, make sure you are using the coding pattern for a "web map", which is a map created on ArcGIS.com. package com.esri.arcgis.android.samples.webmap;
import android.app.Activity;
import android.os.Bundle;
import com.esri.android.map.MapView;
public class WebMap extends Activity {
MapView mMapView = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMapView = new MapView(
getApplicationContext(),
"http://www.arcgis.com/home/item.html?id=f8ab9f0b818b4ece966c4b2cf91fa0c1",
null, null);
setContentView(mMapView);
}
@Override
protected void onPause() {
super.onPause();
mMapView.pause();
}
@Override
protected void onResume() {
super.onResume();
mMapView.unpause();
}
}
... View more
07-31-2013
08:31 AM
|
0
|
2
|
1386
|
|
POST
|
Gakumin, Just a quick follow-up. Your approach is a good work-around for now, as it turns out you cannot freeze/unfreeze the map in the current SDK. I've entered an enhancement request and discussed with the Android team. As part of the enhancement request I added that there should also be a sample to demonstrate the functionality. -Andy
... View more
07-31-2013
08:22 AM
|
1
|
0
|
1314
|
|
POST
|
Gakumin, Good suggestion, I agree that would be a good sample to have. I'll pass the suggestion to the Android team. -Andy
... View more
07-23-2013
10:13 AM
|
0
|
0
|
1314
|
|
POST
|
Good question, I'm not aware of any Android examples to date. However...if it's a specific type of non-ArcGIS layer your work may have already been done for you. What type of layer are you working with? For example, here are the existing capabilities for layers in our ArcGIS Runtime SDK for Android 10.1.1: https://developers.arcgis.com/en/android/guide/map-layer-types.htm You can also go the route of creating a web map and adding a non-ArcGIS Tile Layers using the "Add > Add Layer from Web > Tiled layer" functionality as long as it matches the right level, columns, and row placeholders. You can build these web maps using this mapviewer along with an ArcGIS Online account: http://www.arcgis.com/home/webmap/viewer.html?useExisting=1. In addition to tile layers it also works with WMS, WMST, GeoRSS, KML, and Shapefiles. -Andy
... View more
07-22-2013
02:14 PM
|
0
|
0
|
2256
|
|
POST
|
Thomas, good point, thanks. Yes, I agree that for some common use cases that pattern could significantly simplify things. I recommend you either submit an enhancement request at http://support.esri.com/en/, and/or post it to http://ideas.arcgis.com/. Both of those are monitored for good ideas, and they provide a mechanism for officially tracking them. -Andy
... View more
07-22-2013
01:44 PM
|
0
|
0
|
1395
|
|
POST
|
Aditya, whoops, missed your question. Hopefully my answer isn't too late. You want to check out AsyncTask.get() http://developer.android.com/reference/android/os/AsyncTask.html#get%28long,%20java.util.concurrent.TimeUnit%29. -Andy
... View more
07-22-2013
01:38 PM
|
0
|
0
|
1395
|
|
POST
|
Chris, For v10.1.1 there is not a documented way to do this. Coming in 10.2 is full offline support. You might take a look at these articles although they are a bit dated: http://datamoil.blogspot.com/2011/06/offline-tiled-layer-with-arcgis-for.html http://gis.stackexchange.com/questions/7567/solution-for-android-map-app-with-offline-use -Andy
... View more
06-27-2013
06:38 AM
|
0
|
0
|
536
|
|
POST
|
Vansi, Awesome, glad you got it taken care of. If you have a moment, I have a few more questions that may help others on the forum. >>However the problem was with the target device i was installing the app into. Can you please clarify this, did the error you posted occur while trying to run the app on the emulator? Or, if you are referring to particular smartphone or table, please post the make, model and OS number? >>This ArcGIS app doesn't run in the emulators especially the Intel x86-system emulators. Did you try the steps listed here? http://blogs.esri.com/esri/arcgis/2012/05/02/arcgis-runtime-sdk-for-android-v1-1-supports-android-emulator/ -Andy
... View more
06-27-2013
06:18 AM
|
0
|
0
|
1745
|
|
POST
|
Kevin, Can you post your logcat dump that shows the error? Have you tried these steps? Android Tools > Fix Project Properties > Clean ArcGIS Tools > Fix Project Properties > Clean -Andy
... View more
06-26-2013
07:32 AM
|
0
|
0
|
2142
|
|
POST
|
Vansi, I've also seen similar problems occur randomly on different machines, and including non-ArcGIS Runtime projects when using Eclipse. I have a few suggestions: - This may be obvious, but just in case, did you try the following? Android Tools > Fix Project Properties > Clean ArcGIS Tools > Fix Project Properties > Clean - Check your Java Build Path > Order and Export settings and make sure that at least the ArcGIS for Android 10.1.1 is checked > "OK" > re-clean your project > rebuild > run. On my builds I make sure that the Android SDK is before the ArcGIS Runtime (in terms of the order) - Note you can also add missing files under the Java Build Path > Libraries tab. See this StackOverflow page. -Andy
... View more
06-26-2013
07:29 AM
|
0
|
0
|
1745
|
|
POST
|
Have you tried upgrading to ArcGIS Runtime for Android v10.1.1? -Andy
... View more
06-25-2013
07:21 AM
|
0
|
0
|
2911
|
|
POST
|
Tom, I almost forgot. Here's a blog post specifically about shutting down Android GPS: http://www.andygup.net/3-steps-for-shutting-off-gps-and-locationmanager-on-android/ -Andy
... View more
06-25-2013
07:18 AM
|
0
|
0
|
674
|
|
POST
|
Gakumin, As for problem #1, I agree. If the app only runs in debugger then there is an execution timing problem. Those are very hard to troubleshoot. Here is a blog post I wrote that shows a pattern for trying to narrow down execution timing and threading issues that may help: http://www.andygup.net/troubleshooting-multi-threading-problems-related-to-androids-onresume/ Problem #2: Double check the context that is being used in this line of code. You might change it to use getApplicationContext() rather than using "this". It's just a guess: myTouchListener = new MyTouchListener(this, mMapView); Also in your onDragPointerUp() method make sure it always returns to the default touch listener. It looked like it only returned to the default listener under certain circumstances. -Andy
... View more
06-25-2013
07:17 AM
|
0
|
0
|
1314
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-10-2026 08:29 AM | |
| 1 | 03-26-2026 03:12 PM | |
| 2 | 02-21-2026 10:23 AM | |
| 2 | 08-01-2025 06:20 AM | |
| 1 | 05-27-2025 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|