I add Version detection in the entrance of activity. And add the following code in onCreate method.
new Thread(){
public void run(){
try{
checkToUpdate();
}
catch(Exception e) {
}
}
}.run();
Now it has a new thread. But why it has the error: android.os.NetworkOnMainThreadException in android 4.0?
thanks in advance!
it should be start() instead of run()
And may be you have not added internet permission in manifest file