2011-02-04 61 views
0

好吧,我..我有一個問題... 我需要創建一個對話框3 CheckedTextView。當我打開對話框時,應檢查第二項...如何做到這一點?代碼...Android:警報對話與CheckedTextView

@Override 
protected Dialog onCreateDialog (int id) { 

     AlertDialog.Builder builder = new AlertDialog.Builder(this);    
     builder.setTitle("Something.."); 
     builder.setInverseBackgroundForced(true); 


     ListView listView = new ListView(this); 

     listView .setAdapter(new ArrayAdapter(Settings.this, android.R.layout.select_dialog_multichoice, new String {a ,b, c})); 

     builder.setView(listView); 

回答

0

試試這個listView.getAdapter()。getItem(1);.如果您的第二個列表項是複選框,則將其設置爲通過setChecked(true)進行檢查;