FAIL

My first attempt to support Android 1.5 was a FAIL. The application crashed due to a change in the SDK behaviour, related to dialogs. If your application crashes when showing a progress dialog, that probably means that you have followed the official documentation.

This documentation recommends to create progress dialogs like this:
  ProgressDialog dialog = ProgressDialog.show(
      MyActivity.this, "",
      "Loading. Please wait...", true);
Well, don’t do it! Instead, create the dialog by calling the constructor and populate its properties with the appropiate setter methods. If you call this ‘show’ static method, then you are doomed because there is no need to show the dialog inside the “onCreateDialog” callback, as android will already do this for you. This is a good alternative:

  ProgressDialog progress = new ProgressDialog(this);
  progress.setMessage("Loading. Please wait...");
  progress.setIndeterminate(true);

The fact is that the android documentation is not as bad if you think that they document for the latest SDK, and it works in 1.6 and newer versions, but anyway it is a bit difficult to figure out the problem without help.

I have just published version 1.2 on the market with this fix. I hope that it finally works for 1.5 users. Sorry for the inconvenience.
Anuncios

Acerca de Rubén L.

Software Engineer
Esta entrada fue publicada en android, English y etiquetada , , . Guarda el enlace permanente.

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s