How to get rid of black screen
m Goutham m using开发者_StackOverflow中文版 android 2.2 i have a problem may be you guys help me in figuring it out. i have a authentication screen when m logging in it is taking so time to load and then it switches to a black screen and then it goes to the actuall mainscreen. how can i make that black screen to white.. plz help me guys...
Thanx in Advance, Goutham
Inside your 2nd activity( i.e the page which u load after the login) create
private class LoginTask extends AsyncTask<String, Void, Boolean> {
@Override
protected void onPreExecute() {
super.onPreExecute();
// show a progress dialog indicating that its loading
}
@Override
protected Boolean doInBackground(String... params) {
// give your code that has to be loaded.
}
@Override
protected void onPostExecute(Boolean success) {
super.onPostExecute(success);
//dismiss your progress dialog
}
}
And call this LoginTask in your onCreate function of your 2nd activity as:
new LoginTask().execute();
Hope this may solve your issue...
simply show a progress dialog
see this.
http://developer.android.com/guide/topics/ui/dialogs.html
thanks.
精彩评论