I want set progress bar until the next activity start.That mean i want to remove black screen while loading next page or activity.How to solve this problem?
yes I'm using button onClick and using listView to move next activity.
I want set progress bar until the next activity start.That mean i want to remove black screen while loading next page or activity.How to solve this problem?
yes I'm using button onClick and using listView to move next activity.
Button b1 = new Button(this);
b1.setOnTouchListener(new OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event)
{
int action = event.getAction();
if(action==0)
{
}
else if(action == 1)
{
final ProgressDialog dialog = ProgressDialog.show(myFirstActivity.this,"Please wait","Loading...",true);
new Thread()
{
public void run()
{
try
{
Thread.sleep(2000);
} catch (InterruptedException e)
{
e.toString();
e.printStackTrace();
}
finally
{
dialog.dismiss();
}
}
}.start();
}
return false;
}
});
b1.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent i1 = new Intent(myFirstActiviyt.this,Second.class);
startActivity(i1);
}
});
Try this
try answer on this link
show progressbar on button click when going from 1 intent to other and data is coming from server