Hi, if I start my app I load GoogleMaps. During loading the map I'm showing a progressbar. If the loading is complete everything works fine but if I'm pressing the Back-Button during loading file the app crashes. Seems to be a memory problem. Could someone help me?
Tom public class KarteAnzeigenActivity extends MapActivity implements LocationListener { private MapController map_Controller; private MapView map_View; private MyLocationOverlay mMyLocationOverlay ; private GeoKontaktOverlay mMapViewOverlay; private Progressbar progThread; private ProgressDialog progDialog; private float mlatitude; private float mlongitude; /** Kuerzel fuers Logging. */ private static final String TAG = KarteAnzeigenActivity.class.getSimpleName(); @Override public void onCreate(Bundle savedInstanceState) { try { requestWindowFeature(Window.FEATURE_LEFT_ICON); super.onCreate(savedInstanceState); setContentView(R.layout.mapkarte); setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.icon); showDialog(0); if(getIntent().hasExtra("latitude") == true) mlatitude = getIntent().getExtras().getFloat("latitude"); if(getIntent().hasExtra("longitude") == true) mlongitude = getIntent().getExtras().getFloat("longitude"); initMapView(); // fuege der MapView das Overlay fuer die // empfangene Position hinzu initGCFormelOverlay(); // Zeige die eigene Position mit Hilfe // des Overlays aus der Google Api initMyLocationOverlay(); // create an overlay that shows our current location } catch (Exception ex) { Log.i(TAG, ex.getMessage()); Toast.makeText(this,"UI problem in " + TAG + "-" + ex.getMessage(),Toast.LENGTH_LONG).show(); } } // Method to create a progress bar dialog of either spinner or horizontal type @Override protected Dialog onCreateDialog(int id) { switch(id) { case 0: // Spinner progDialog = new ProgressDialog(this); progDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progDialog.setMessage("Loading..."); progThread = new Progressbar(handler); progThread.start(); return progDialog; default: return null; } } // Handler on the main (UI) thread that will receive messages from the // second thread and update the progress. final Handler handler = new Handler() { public void handleMessage(Message msg) { // Get the current value of the variable total from the message data // and update the progress bar. if(progDialog != null) { int total = msg.getData().getInt("total"); progDialog.setProgress(total); if (total <= 0){ progDialog.dismiss(); progThread.setState(Progressbar.DONE); } } } @Override protected void onDestroy() { Log.d(TAG, "onDestroy() aufgerufen..."); super.onDestroy(); if( this.progThread != null) this.progThread.destroy(); if (this.progDialog != null) { progDialog.dismiss(); } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en