Hi,
I wrote an Android widget with alarmmanager as updating process.
Sometimes i've got a nullpointer exception. But all objects are
initialized...

public void UpdateWidget(Context con)
{
    //Log.d("berlinClock", "UpdateWidget="+i);
    RemoteViews views=new
RemoteViews(con.getPackageName(),R.layout.widgetlayout);
    Calendar c = Calendar.getInstance();
    int h = c.get(Calendar.HOUR_OF_DAY);
    int m = c.get(Calendar.MINUTE);

    ComponentName thisWidget = new ComponentName(con,widget.class);

    //update views on remoteView
    // GOT NULLPOINTER EXEPTION IN FOLLOWING LINE (96)
    views.setImageViewResource(R.id.wha1, R.drawable.cgrau);
    views.setImageViewResource(R.id.wha2, R.drawable.cgrau);
    ...
}

Here is the Stacktrace:

java.lang.RuntimeException: Unable to start receiver
ms.jung.android.berlinclock.widget: java.lang.NullPointerException
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2821)
at android.app.ActivityThread.access$3200(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
2083)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at ms.jung.android.berlinclock.widget.UpdateWidget(widget.java:96)
at ms.jung.android.berlinclock.widget.onReceive(widget.java:34)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2810)

have you any ideas?

-- 
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

Reply via email to