miércoles, 14 de julio de 2010

Documentación en Android: NotificationManager

En las FAQs de la dev guide de Android, mas precisamente en el howto de las notificaciones, podemos ver el siguiente codigo:


static void setNewMessageIndicator(Context context, int messageCount){
   // Get the static global NotificationManager object.
   NotificationManager nm = NotificationManager.getDefault();

   // If we're being called because a new message has been received,    // then display an icon and a count. Otherwise, delete the persistent    // message.    if (messageCount > 0) {       nm.notifyWithText(myApp.NOTIFICATION_GUID,      // ID for this notification.                 messageCount + " new message" + messageCount > 1 ? "s":"", // Text to display.                 NotificationManager.LENGTH_SHORT); // Show it for a short time only.    } }


El gran problema es que el metodo NotificationManager.getDefault() no existe. El uso correcto de las notificaciones lo podemos ver aquí. Donde se observa que la manera de acceder al NotificationManager es:


String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);



Gracias al equipo de documentación de google!

martes, 13 de julio de 2010

“On Android, it’s fucking hell”

100% deacuerdo...

Designing views in the Android SDK is one of the areas that I can say without equivocation is worse than the iPhone in every single respect. Android’s approach to creating views has absolutely no redeeming value whatsoever. Designing your interface on the iPhone is easy. It’s fun. It’s intuitive. On Android, it’s fucking hell. It’s like working with the evil offspring of GridBagLayout and XML. It’s utterly horrid. But, Java has never done UI well and has never made it particularly fun so I can’t say I was surprised by this, though it did exceed my expectations by being even worse than I thought humanly possible. The whole process is counter-intuitive and time-consuming, and that’s just to make something that functions. It’s even more time-consuming and painful to make a UI that doesn’t look like ass.

Texto original