title: Custom Progress bar in android
body: <p>I am new in creating the custom components. I am creating a Custom Progress bar by extending the <strong>ProgressBar</strong>. But getting this exception.</p>
  
  <pre><code>07-07 17:38:00.700: D/AndroidRuntime(3513): Shutting down VM
  07-07 17:38:00.700: W/dalvikvm(3513): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
  07-07 17:38:00.720: E/AndroidRuntime(3513): FATAL EXCEPTION: main
  07-07 17:38:00.720: E/AndroidRuntime(3513): android.view.InflateException: Binary XML file line #7: Error inflating class com.customprogress.TextProgressBar
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.view.LayoutInflater.createView(LayoutInflater.java:503)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.app.Activity.setContentView(Activity.java:1647)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at com.customprogress.TextProgressBar.&lt;init&gt;(TextProgressBar.java:22)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at com.customprogress.Progress$Click.onClick(Progress.java:27)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.view.View.performClick(View.java:2408)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.view.View$PerformClick.run(View.java:8816)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.os.Handler.handleCallback(Handler.java:587)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.os.Handler.dispatchMessage(Handler.java:92)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.os.Looper.loop(Looper.java:123)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.app.ActivityThread.main(ActivityThread.java:4627)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at java.lang.reflect.Method.invokeNative(Native Method)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at java.lang.reflect.Method.invoke(Method.java:521)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at dalvik.system.NativeStart.main(Native Method)
  07-07 17:38:00.720: E/AndroidRuntime(3513): Caused by: java.lang.NoSuchMethodException: TextProgressBar(Context,AttributeSet)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at java.lang.Class.getMatchingConstructor(Class.java:660)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at java.lang.Class.getConstructor(Class.java:477)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     at android.view.LayoutInflater.createView(LayoutInflater.java:475)
  07-07 17:38:00.720: E/AndroidRuntime(3513):     ... 20 more
  </code></pre>
  
  <p>My code for creating this is here.. TextProgressBar.class</p>
  
  <pre><code>public class TextProgressBar extends ProgressBar {
      Activity activity;
  
  
      public TextProgressBar(Activity activity) {
          super(activity);
          this.activity = activity;
          this.activity.setContentView(R.layout.custom_progress);
      }
  </code></pre>
  
  <p>And I am calling this class from my Progress.java Activity</p>
  
  <pre><code>public class Progress extends Activity {
      /** Called when the activity is first created. */
      Button buttonClick;
      TextProgressBar textProgressBar;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          buttonClick = (Button) findViewById(R.id.buttonClick);
          buttonClick.setOnClickListener(new Click());
      }
  
      class Click implements OnClickListener
      {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              textProgressBar = new TextProgressBar(Progress.this);
          }
  
      }
  }
  </code></pre>
  
  <p>The xml for custom_progress is here..</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical" &gt;
  
      &lt;com.customprogress.TextProgressBar
          android:id="@+id/progressBarWithText"
          android:layout_width="100dp"
          android:layout_height="100dp"
         /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Please help me out if anybody know the solution of this..
  Thanks in advance..</p>