checkBox中只用数字问题以及AsyncActivity中使用ProgressDialog

cb=(CheckBox)findViewById(R.id.cek); 
 
cb
.setOnClickListener(new OnClickListener() {  // checkbox listener 
   
public void onClick(View v) { 
       
// Perform action on clicks, depending on whether it's now checked 
       
if (((CheckBox) v).isChecked()) { 
            tv1
.setVisibility(0);  //visible==0 
            et3
.setVisibility(0); 
       
} else if (((CheckBox) v).isChecked() == false) { 
            tv1
.setVisibility(2); //gone=2   
                et3
.setVisibility(2); 
       
} 
   
} 
}); 

 

 

这里不能使用数字 直接使用gone等不然没有效果,

2.

class AddTask extends AsyncTask<Void, Item, Void> { 
 
   
protected void onPreExecute() { 
       // pDialog
= ProgressDialog.show(MyActivity.this,"Please wait...", "Retrieving data ...", true); 

 dialog = new ProgressDialog(viewContacts.this); 
        dialog
.setMessage(getString(R.string.please_wait_while_loading)); 
        dialog
.setIndeterminate(true); 
        dialog
.setCancelable(false); 
        dialog
.show(); 

   
} 


 
   
protected Void doInBackground(Void... unused) { 
        items
= parser.getItems(); 
 
       
for (Item it : items) { 
            publishProgress
(it); 
       
} 
       
return(null); 
   
} 
 
   
protected void onProgressUpdate(Item... item) { 
        adapter
.add(item[0]); 
   
} 
 
   
protected void onPostExecute(Void unused) { 
        pDialog
.dismiss(); 
   
} 
 
} 

你可能感兴趣的:(ProgressDialog)