Here is the code inside main Activity class, which works fine..
public void onStart() {
super.onStart();
mHandler = new Handler();
context = this;
...
}
And the following code gives problem, don’t know why:
public void onStart() {
super.onStart();
new Thread(new Runnable(){
public void run(){
mHandler = new Handler();
context = this;
...
}
}).start();
}
In above code
.thisrefers toThread (Runnable)class object not aCurrent Activity. And you can not castThread (Runnable) objecttoAndroid Context.or something like,