4

I have successfully created one custom dialog box. Dialog box is working good. I am using ListView to list out all files in the particular paths. My Custom Dialog box contains File Name and Check Box. Selected files can be moved or deleted. All these working fine.

I need to add Progress Bar inside the dialog Box. Because Files can be deleted or moved would take some time. How do add Progress Bar. Please help me.

Sample Screen Shot :- (How do add Progress Bar in the Green Color)

enter image description here

Thank You.

Hiral Vadodaria
  • 19,158
  • 5
  • 39
  • 56
Bala
  • 445
  • 5
  • 11
  • 26

2 Answers2

3

Bala the custom layout which you have created as a dialog insert the code for the horizontal progressBar having color green from Horizontal SCrollBar with Custom Color.

Community
  • 1
  • 1
AkashG
  • 7,868
  • 3
  • 28
  • 43
  • Insert it above the two buttons delete and move. – AkashG Jul 26 '12 at 10:57
  • AkashG Please Explain me, What code we will put on the `btnDelete.setOnClickListener`. Give me sample code part to guide me. – Bala Jul 26 '12 at 11:24
  • on delete button you have to implement file.delete() in order to delete the particular file you selected. – AkashG Jul 26 '12 at 11:52
  • Sorry, My question is not there. File has been deleted success. How do load Progress Bar. For example i have selected 2 files and then i select a delete button. File has been deleted success. But progress bar has no action. How do perform 2/2 Progress Bar. Thank you for responsible. – Bala Jul 26 '12 at 12:02
  • @Bala below are the tw links through which you can show the progress of the files deleted. – AkashG Jul 26 '12 at 12:50
2

You have written you know how to create a custom dialog but i want to post it first:

final Dialog dialog = new Dialog(MyActivity.this, R.style.CustomDialogTheme);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.info_dialog);
dialog.setTitle("Info");
dialog.setCancelable(false);

    Button deleteButton = (Button) dialog.findViewById(R.id.deleteButton);
ProgressBar progressBar = (Button) dialog.findViewById(R.id.progressBar);

deleteButton.setOnClickListener(new OnClickListener() {
     @Override
     public void onClick(View v) {
     // start progress
     }
     });    

dialog.show();

And for info_dialog.xml file use

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<ProgressBar
    android:id="progressBar"
    style="@android:style/Widget.ProgressBar.Horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />


</LinearLayout>
Tuna Karakasoglu
  • 1,262
  • 9
  • 28
  • Coders I have added one progress bar in the custom dialog box. What code we can used to inside the delete button about process the progress bar. Guide me. – Bala Jul 26 '12 at 11:39
  • please see my edited post. you can do stuff onclick of deleteButton. if you use tread or something for deletion you should end the progress on thread finish. for further info you can look here: http://www.mkyong.com/android/android-progress-bar-example/ – Tuna Karakasoglu Jul 26 '12 at 11:57
  • Thanks CodersParadise. Thank You. – Bala Jul 27 '12 at 09:53