I use the group to show activity in one tab.
A and B Activty are the same group.
A call B such as below code:
Intent intent = new Intent(AActivity.this, BActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Window w = MyGroup.group.getLocalActivityManager().startActivity("BActivity", intent);
View view = w.getDecorView();
MyGroup.group.setContentView(view);
And BActivity is a ListActivity.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.list);
RL url = new URL(urlstr);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setConnectTimeout(10000);
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);
InputStream is = connection.getInputStream();
//extract information from is, and show in list view
}
I want to show dialog to show loading.
I already try AsyncTask and Thread Runnable method.
But the error Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@2afe9488 is not valid; is your activity running? shows.
How to solve it?
you can use ProgressDialog Class with the Help of Handler Class. This way you can achieve what you want to do.