First time posting here, so go easy on me. 🙂
I am trying to do something that (I think) should be simple. I am loading another activity within the onClick event of a OnClickListener that is attached to a button:
public class Prime extends Activity {
....
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.prime);
Button startButton = (Button) findViewById(R.id.main_start_button);
Button scoreButton = (Button) findViewById(R.id.main_score_button);
startButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent start = new Intent("com.mazam.eikaiwa.Modules");
startActivity(start);
}
});
scoreButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
.....
}
});
}
}
Now, the Modules activity that I am loading via the startButton is a bit heavy with the XML layout, and takes about 2-3 seconds to load. I would like to place a progress dialogue when the button is clicked to notify the user until the intent is fully loaded.
I have been able to make this work perfectly with the information I found on a site (I am sorry I don’t remember the name or location) using a separate thread and overriding the onKeyDown function. However I couldn’t extend this to the onClick function.
So, my question is how can I display a progress dialogue when the user clicks the startButton and have it disappear when the Modules activity is fully loaded?
Any help is appreciated, thanks in advance.
you can use ProgressDialog Class with the Help of Handler Class. Please visit my answer here.