mercredi 9 novembre 2016

Click checkbox to update progressbar

I am using sqliteDatabase to save my data.My app is a todo list that allows a user to enter a list of items that they want to do, every item that is added has a checkbox so that when the item is clicked the progressbar status should change from 0 to a certain percentage depending on how many items I have on my list. For example, if I have 3 items on my list and I click checkbox for 1 item the progressbar percentage should be 35%. How do I do this? Currently this is how I was doing it but its not working

 new Thread(new Runnable() {
       public void run() {
       while (mProgressStatus < mydb.getAllItems().size()) {
       mProgressStatus = array_list.size();

       // Update the progress bar
        mHandler.post(new Runnable() {
        public void run() {
         mProgress.setProgress(mProgressStatus);
         }
         });
         }
         }
        }).start();




Aucun commentaire:

Enregistrer un commentaire