我只想在 new 时显示进度条MainActivity(detail)
。MainActivity(detail)
用于向用户发送邮件。我所需要的只是单击按钮时,应该显示进度条并开始。然后当发送邮件时,进度条隐藏或结束。
到目前为止,这是我的代码:
OnClickListener listener=new OnClickListener()
{
@Override
public void onClick(View v)
{
pb=(ProgressBar)findViewById(R.id.progressBar1);
pb.setVisibility(View.VISIBLE);
if(isNetworkAvailable())
{
// TODO Auto-generated method stub
SharedPreferences pref=getSharedPreferences("Pref", MODE_PRIVATE);
String str=pref.getString("un1", "");
String str1=pref.getString("pa1", "");
SQLiteDatabase db=context.openOrCreateDatabase("IPCA", MODE_PRIVATE,null);
Databasesignup dbs=new Databasesignup(context,"IPCA", null,1);
dbs.onCreate(db);
Cursor cursor=dbs.view(db,str,str1);
ArrayList<String> al=new ArrayList<String>();
while(cursor.moveToNext())
{
al.add(cursor.getString(0));
al.add(cursor.getString(1));
al.add(cursor.getString(5));
}
String string=al.get(0);
String string1=al.get(1);
String string2=al.get(2);
String k=iv.getTag().toString();
dbs.insert1(db,string,str,string2,k);
final String detail ="\nName: "+string+"\nEmail: "+string1+"\nMobile: "+string2+"\nInterest: "+k;
new MainActivity(detail);
cursor.close();
db.close();
Toast.makeText(getApplicationContext(),"You will be contacted soon", Toast.LENGTH_LONG).show();
}`