Step 1 :
Make an android
project named “RingDialogueProgress”.
Step 2 :
Paste the following
code in MainActivity.java file.
package
com.example.ringdialogueprogress;
import
android.app.Activity;
import
android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
public class MainActivity extends Activity
{
ProgressDialog
barProgressDialog;
Handler
updateBarHandler;
@Override
protected void onCreate(Bundle
savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void
launchRingDialog(View view)
{
final ProgressDialog
ringProgressDialog = ProgressDialog.show(MainActivity.this, "Please wait
...",
"Downloading
Image ...",true);
ringProgressDialog.setCancelable(true);
new Thread(new Runnable()
{
@Override
public void run()
{
try
{
// Here you should
write your time consuming task...
// Let the progress
ring for 10 seconds...
Thread.sleep(10000);
}
catch (Exception e)
{
}
ringProgressDialog.dismiss();
}
}).start();
}
}
Step 3 :
Paste the following
code in activity_main.xml file.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="launchRingDialog"
android:text="ProgressDialog Ring" />
</LinearLayout>
Is there have a tutorial for webcams using Android
ReplyDelete