Runtime exception when trying to run on UI thread
I am trying to create popup (through textview, its ridiculous but its in
my specs) that appears and lasts 5 secs without interrupting the ongoing
activity. Here is how I do it:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.popups);
message = getIntent().getStringExtra("message");
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Popups.this.finish();
messageView.setText(message);
}
});
}
}, 0, 5000);
This is called through an Intent in a BroadcastReceiver class. However, I
get the error :
08-21 19:32:09.030: E/AndroidRuntime(12505): FATAL EXCEPTION: main
08-21 19:32:09.030: E/AndroidRuntime(12505): java.lang.RuntimeException:
Unable to instantiate activity
ComponentInfo{com.example.[appname]/com.example.[appname].Popups}:
java.lang.NullPointerException
Anyone know what is causing this?
No comments:
Post a Comment