Imaginemos un mundo libre

La paz interior comienza en el momento en el que decides no permitir, que ninguna persona o evento, tome el control de tus emociones.

Archive for August 2013

Sigo Siendo (Kachkaniraqmi)

leave a comment »

Finalmente, Sigo Siendo: “La película que viaja por los mundos del Perú a través de la vida de sus músicos”, está disponible en todos los cines a nivel nacional.  Allá vamos!

Sigo siendo - Película

Como dice Javier Corcuera, su director, este largometraje documental toca fibra:

Advertisements

Written by Ronny Yabar

August 22, 2013 at 12:11 pm

KDE Applications 4.11 released

leave a comment »

Today,  KDE Applications 4.11 has been released. Besides all the new features added, it’s nice to see that one of theses features are KMail supporting themes and that now we have a new theme editor for email headers.

You can see my full report of the Google Summer of Code project in which I worked in the past. In this post I talked about all this stuff.

You can get these themes from KMail -> View – > Headers -> Download New Themes.  And you can create your own ones using the KMail Header Theme Editor and upload them to KDE-Look.

At the moment, there are a couple of email header themes that look beautiful (Kudos to the authors):

KMail header theme

KMail header theme

Thanks to all the KDE Community for the new release, the new features added in applications, workspaces and the platform.

Written by Ronny Yabar

August 14, 2013 at 6:30 pm

Android Code Snippets: Getting the device metrics

leave a comment »

It’s really important to know the device metrics (Height and width pixels, density, density dpi)  when working on an Android app, specially if you are dealing with fragmentation.

Android has a utility class called DisplayMetrics to get these device properties. Let’s say you need these properties in X activities.  It would be better create a utils class and get the device metrics there.

import android.util.DisplayMetrics;

Your class...
    public static float deviceDensity;
    public static int deviceDensityDpi;
    public static int deviceHeightPixels;
    public static int deviceWidthPixels;

    void getDeviceMetrics(Activity activity)  {
        DisplayMetrics metrics  =  new DisplayMetrics();
        activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
        deviceDensity = metrics.density;
        deviceDensityDpi = metrics.densityDpi;
        deviceHeight = metrics.heightPixels;
        deviceWidth = metrics.widthPixels;
    }

...

Written by Ronny Yabar

August 3, 2013 at 1:21 pm

Android Code Snippets: Adapter notifyDataSetChanged()

leave a comment »

A common error when working with adapters in Android, is not to notify your adapter when your data has changed.  If you don’t do that, you’ll receive and exception like this:

java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification.

Just call the notifyDataSetChanged() method after you modify your content.  But, maybe even if you notified your adapter, you receive an exception like this:

java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread.

That means, you need to call notifyDataSetChanged() from the UI thread.  It’s better to create a method, so you can call it at anytime:

private void notifyAdapter()  {
    activity.runOnUiThread(new Runnable()  {
        public void run() {
            listView.setAdapter(null);
            if(adapter != null) {
                adapter.notifyDataSetChanged();
             }
        }
    });
}

I assume you have a listview and adapter objects created.

Enjoy

Written by Ronny Yabar

August 2, 2013 at 1:18 pm