Skip to content

Instantly share code, notes, and snippets.

@dvas0004
Created April 17, 2014 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvas0004/10993182 to your computer and use it in GitHub Desktop.
Save dvas0004/10993182 to your computer and use it in GitHub Desktop.
progress dialog nugget
uploadButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v)
{
final ProgressDialog progressDialog = new ProgressDialog(getActivity());
//perform upload action
Thread thread = new Thread()
{
@Override
public void run() {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.setTitle("File Upload");
progressDialog.setMessage("Please Wait...");
progressDialog.isIndeterminate();
progressDialog.show();
}
});
uploadFile();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
}
});
}
};
thread.start();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment