I have a sax parser which runs when the user taps a start button. I would like to set a progress bar view which will update as the parser progresses.
My code is currently as follows :
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.progressview);
try {
XMLParser.parse(getAssets().open("deindexed.xml"), this);
} catch (IOException e) {
Log.d("XML","onCreate(): parse() failed");
return;
}
//Start the Main Activity.
System.out.println("Activity recreated");
Intent i = new Intent(this, Simple.class);
startActivity(i);
}
The problem is that the setContentView does not update until the parser has completed (which I understand is to be expected).
Can anyone advise me on the best way to transform the above so it runs using a thread ?
Thank you.