Rohit Ghatol
unread,Sep 7, 2009, 10:54:12 AM9/7/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Auto-android
Hi all,
Here is code snippet I have been using.
I am reading from server in a thread. The first thing I do in the
thread is to show a process dialog (loading dialog). Once I get the
response from the server, I do a dimissDialog.
I am not sure, how do I check this condition with autoandroid. What I
want to do is
1. Launch Activity
2. Check if the Loading Dialog is shown (assertTrue)
3. Wait for say 5 seconds
4. Again check if the Loading Dialog is shown (assertNull)
// Sample code
public class MyList extends ListActivity{
private final static int DIALOG_INITIALIZE = 1;
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_INITIALIZE: {
processDialog = new ProgressDialog(this);
processDialog.setTitle("Loading...");
processDialog.setMessage("Loading from Server");
processDialog.setIndeterminate(true);
processDialog.setCancelable(true);
return processDialog;
}
}
return null;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
....// inside a handler
Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
//Get info from server
........
........
dismissDialog(DIALOG_INITIALIZE);
}
}
Thread thread = new Thread(new Runnable(){
public void run(){
showDialog(DIALOG_INITIALIZE);
//Do a server call
handler.sendEmptyMessage();
}
).start();
}
}
Cheers,
Rohit