android - Why isn't my progress bar showing anything? -


i have custom progress bar , when enter value , press button, have progress bar update. progress bar going have 3 values can 0 percent, 33 percent, 66 percent, or 100 percent. reason when go page progress bar , enter value textview , enter button, it's showing loading circle reason never ends. i've posted code needed progress bar, know why it's not showing correct progress bar , why it's showing loading circle?

custom_progressbar.xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">  <!-- define background properties color etc --> <item android:id="@android:id/background">     <shape>         <gradient             android:startcolor="#000001"             android:centercolor="#0b131e"             android:centery="1.0"             android:endcolor="#0d1522"             android:angle="270"             />     </shape> </item>  <!-- define progress properties start color, end color etc --> <item android:id="@android:id/progress">     <clip>         <shape>             <gradient                 android:startcolor="#007a00"                 android:centercolor="#007a00"                 android:centery="1.0"                 android:endcolor="#06101d"                 android:angle="270"                 />         </shape>     </clip> </item> 

progressbarshirts.java

package ankitkaushal.app.healthysizing;  import android.graphics.drawable.drawable; import android.sax.textelementlistener; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.view; import android.view.window; import android.widget.button; import android.widget.edittext; import android.widget.progressbar; import android.widget.textview; import android.widget.toast;  public class progressbarshirts extends actionbaractivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_progress_bar_shirts);          final databasehelper db = new databasehelper(this);         final textview currentsizedisplay = (textview) findviewbyid(r.id.currentsizeshirts);         button enternewsizebutton = (button) findviewbyid(r.id.newsizeenterbuttonshirts);         final edittext newsize = (edittext) findviewbyid(r.id.newsizeshirts);         final string currentsize = db.getcurrentshirtsize();         currentsizedisplay.settext("your current size: " + currentsize);         drawable draw = getresources().getdrawable(r.drawable.custom_progressbar);          enternewsizebutton.setonclicklistener(new view.onclicklistener() {              @override             public void onclick(view v) {                 string size = newsize.gettext().tostring().touppercase();                 currentsizedisplay.settext("your current size: " + size);                 db.updatesizeshirts(size);             }          });          progressbar shirts = (progressbar) findviewbyid(r.id.progressbarshirts);         shirts.setprogressdrawable(draw);         string startsize = db.getstartsizeshirts();         string newcurrentsize = db.getcurrentshirtsize();         string limit = db.getlimit("setlimitshirts");         shirts.setmax(100);          if (startsize.equals("xl") && limit.equals("s")) {              if (newcurrentsize.equals("l")) {                 // fill progress bar 1/3                  shirts.setprogress(33);             }              if (newcurrentsize.equals("m")) {                 // fill progress bar 2/3                  shirts.setprogress(66);             }              if (newcurrentsize.equals("s")) {                 // fill progress bar 100 percent                  shirts.setprogress(100);                  // give toast saying you've reached limit                 toast.maketext(this, "you've reached limit! ", toast.length_long).show();                  // set values in database null                 db.removelimit("setlimitshirts");             }         }     } } 

activity_progress_bar_shirts.xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent" android:layout_height="match_parent"     android:background="#29a9d2"     android:orientation="vertical"     android:weightsum="1">      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:textappearance="?android:attr/textappearancemedium"         android:text="track progress"         android:id="@+id/trackprogressshirts"         android:layout_gravity="center_horizontal"         android:textcolor="#ffffff"         android:textsize="30dp"         android:layout_margintop="5dp" />      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:textappearance="?android:attr/textappearancemedium"         android:text="current size: large"         android:id="@+id/currentsizeshirts"         android:layout_gravity="center_horizontal"         android:textsize="30dp"         android:layout_margintop="80dp"         android:textcolor="#ffffff" />      <edittext         android:layout_width="350dp"         android:layout_height="wrap_content"         android:id="@+id/newsizeshirts"         android:layout_margintop="20dp"         android:hint="enter new size"         android:layout_gravity="center_horizontal"         android:gravity="center_horizontal"         android:textsize="30dp" />      <button         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="enter new size"         android:id="@+id/newsizeenterbuttonshirts"         android:layout_gravity="center_horizontal" />      <progressbar         style="?android:attr/progressbarstylelarge"         android:layout_width="300dp"         android:progressdrawable="@drawable/custom_progressbar"         android:layout_height="wrap_content"         android:id="@+id/progressbarshirts"         android:layout_gravity="center_horizontal|bottom"         android:layout_margintop="170dp"         android:max="100"         android:minwidth="300dp"         android:minheight="100dp"         android:maxwidth="300dp"         android:maxheight="100dp"         android:indeterminateonly="true"         android:progress="0" />  </linearlayout> 


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -