I am trying to show a progressbar when a button is clicked. When i test the app it force closes / stops. My app works fine before the progressbar code is added in.
also
try following code...
handler1 = new Handler()
{
@Override
public void handleMessage(Message msg)
{
switch(msg.what)
{
case 1:
static_class.digi_pd = ProgressDialog.show(Create_Digitizing_Job.this, "Loading...", "Please Wait..", true,false);
static_class.digi_pd.setCancelable(false);
break;
case 2:
static_class.digi_pd.dismiss();
break;
}
}
};
thread1 = new Thread()
{
@Override
public void run()
{
try
{
handler1.sendEmptyMessage(1);
// write your code here....
handler1.sendEmptyMessage(3);
handler1.sendEmptyMessage(2);
}
catch (Exception e)
{
Log.w("thread error...",""+e);
//e.printStackTrace();
}
}
};
thread1.start();