Whi with this code
public final String[] array_titoli_serie_prima = new String[]{
getResources().getString(R.string.titolo_p1),
getResources().getString(R.string.titolo_p2),
getResources().getString(R.string.titolo_p3),
getResources().getString(R.string.titolo_p4),
getResources().getString(R.string.titolo_p5),
getResources().getString(R.string.titolo_p6),
getResources().getString(R.string.titolo_p7),
getResources().getString(R.string.titolo_p8),
getResources().getString(R.string.titolo_p9),
getResources().getString(R.string.titolo_p10),
getResources().getString(R.string.titolo_p11),
getResources().getString(R.string.titolo_p12),
getResources().getString(R.string.titolo_p13),
getResources().getString(R.string.titolo_p14),
getResources().getString(R.string.titolo_p15),
getResources().getString(R.string.titolo_p16),
getResources().getString(R.string.titolo_p17),
getResources().getString(R.string.titolo_p18),
getResources().getString(R.string.titolo_p19),
getResources().getString(R.string.titolo_p20),
getResources().getString(R.string.titolo_p21),
getResources().getString(R.string.titolo_p22)
};
I have the error 03-20 00:46:02.120: E/AndroidRuntime(14847): java.lang.NullPointerException for all getResources line ?
Thanks
getResources()is a method ofContext, so you can only do it like that in a class instance which subclasses Context, like anActivity.And actually you may want to look into String Array resources: http://developer.android.com/guide/topics/resources/string-resource.html#StringArray