Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple progress dialog onClick and hide when finish operation
    primarykey
    data
    text
    <p>I want show a progress dialog (with a progressbar or circle this is indifferent to me) when i click the button. Actually i can show it but i don't know how hide it after finish the operations inside at onclick. This is the code:</p> <pre><code>copy.setOnClickListener(new OnClickListener() { public void onClick(View v){ ProgressDialog progressDialog = new ProgressDialog(getActivity()); progressDialog.setProgressStyle(R.style.NewDialog); progressDialog.setMessage("Loading..."); progressDialog.show(); String datafolder = Environment.getDataDirectory().getAbsolutePath()+File.separator+"app"; File customfolder=new File(Environment.getExternalStorageDirectory().getAbsolutePath().toString()+File.separator+"BackupApps"); String comando = "cp -r /data/app /sdcard/BackupApps"; Process suProcess = null; try { suProcess = Runtime.getRuntime().exec("su"); } catch (IOException e3) { // TODO Auto-generated catch block e3.printStackTrace(); } DataOutputStream os = new DataOutputStream(suProcess.getOutputStream()); try { os.writeBytes(comando + "\n"); } catch (IOException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } try { os.flush(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { os.writeBytes("exit\n"); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { os.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); </code></pre> <p>How can i do it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload