package com.raja.vedioapp;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Progress();
}
protected void Progress()
{
final ProgressDialog progress=ProgressDialog.show(MainActivity.this, "Progress Task", "Please Wait....",true);
new Thread(){
public void run()
{
try
{
Message ms=new Message();
ms.what=1111;
handler.sendMessage(ms);
}catch (Exception e)
{
System.out.println("error "+e);
}
progress.cancel();
}
}.start();
}
Handler handler=new Handler()
{
@Override
public void handleMessage(Message msg)
{
switch(msg.what)
{
case 1111:
for(int i=0;i<1000;i++)
{
System.out.println("Back Ground Thread Test"+i);
}
break;
}
}
};
No comments:
Post a Comment