Android Loop progress bar (in Android default form) instance code _android

Source: Internet
Author: User
Tags anonymous

Android development, there are a lot of features in practical applications have played a large role, such as the implementation of the Android progress bar, below to introduce the Android Ring progress bar (the default form), the details are as follows:

. xml

<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android"
xmlns:tools= "http:// Schemas.android.com/tools "
android:layout_width=" match_parent "
android:layout_height=" Match_parent "
android:orientation= "vertical"
tools:context= ". Mainactivity ">
<button 
android:id=" @+id/mybut "
android:layout_width=" Wrap_content " android:layout_height= "Wrap_content"
android:text= "Find Network"/>
</LinearLayout>

. java

 package com.example.progressdialog; import android.os.Bundle; import android.app.Activity;
Import Android.app.ProgressDialog;
Import Android.view.View;
Import Android.view.View.OnClickListener;
Import Android.widget.Button; public class Mainactivity extends activity {private Button but=null; @Override protected void onCreate (Bundle Savedinstan Cestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); this.but= (Button)
Super.findviewbyid (r.id.mybut);
This.but.setOnClickListener (New Onclicklistenerimp ()); public class Onclicklistenerimp implements onclicklistener{public void OnClick (View v) {//Create our progress bar final Progressdialo
G Prodia=new ProgressDialog (mainactivity.this);
Prodia.settitle ("Search Network");
Prodia.setmessage ("Please wait patiently");
Prodia.onstart (); Anonymous inner class new Thread () {public void run () {try{thread.sleep (3000);} catch (Exception e) {} finally{//Anonymous inner class to access the data in the class, the data must be
Final Prodia.dismiss ()//Hidden dialog box}}}.start ();
Prodia.show (); }
}
}

The above content is small series to introduce the Android Ring progress bar (Android default form) of the relevant knowledge, I hope to help you!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.