I’m having a minor problem and I don’t know how to do it.
I created a app, that pulls information through an xml web service.
The data get’s parsed and inserted into a local sqlite database.
Everything works so far.
Due to the size of the data (that varies based on the pulled information) I intended to insert a loading screen with a progressbar and a spinner to notify the user that actions are taken.
Well let’s say it, that it is planed to work this way.
My Problem is, that it is displayed, as soon as the work is done, not bevor.
This is how I’ve done it:
Handler phHandle = new Handler(){
@Override
public void handleMessage(Message msg){
int progress = msg.arg1;
pb.setProgress(progress);
}
};
class firstInitHandler implements Runnable{
private Handler phHandle;
public void setHandle(Handler h){
this.phHandle = h;
}
public void run(){
try {
firstInit i = new firstInit();
i.doInit(this.phHandle);
if(i.isResult())
i.doParse();
if(i.isData()){
i.doTasks();
i.doEquipment();
i.doUser();
i.doCompany();
i.doForms();
i.doSysconfig();
}
} catch (NullPointerException e) {
e.printStackTrace();
}
}
}
firstInitHandler h = new firstInitHandler();
h.setHandle(phHandle);
h.run();
This is part of a method.
Well it works so far.
The thread for processing the information is visible in task manager in the sdk.
I can also see the status messages on logcat that are created while the debug system works.
But the screen stays blank and only is displayed as soon as the task is done.
I’m a little bit confused and don’t know where to start to have the waiting screen work.
I would welcome any help.
Chris
Have you tried looking at the Android Developers resources?
Here is the Dialog tutorial. A progress dialog example is shown on this page, or you could hop to the specific progress dialog section where it shows all the possible commands, usages, etc.
Hope this is what you need.