Android : How to add multiple Text view and edittext in dialog alert

on Saturday, September 20, 2014


I want to create a dialog alert as it show in android when we tap on a wi-fi to get connect to the wi-fi. I have create d a dialog alert but its not showing all the textview and edittext. Please help


here's my code



AlertDialog.Builder password = new AlertDialog.Builder(context);
password.setTitle("Connect to Network");

final TextView ssid = new TextView(context);
ssid.setText(wifiScanList.get(position).SSID);
password.setView(ssid);
final TextView bssid=new TextView(context);
bssid.setText(wifiScanList.get(position).BSSID);
password.setView(bssid);
final TextView capab=new TextView(context);
capab.setText(wifiScanList.get(position).capabilities);
password.setView(capab);
final EditText pass =new EditText(context);
password.setView(pass);

password.setPositiveButton("Connect", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
checkPassword= pass.getText().toString();
finallyConnect(checkPassword, position);
dialog.dismiss();


}
});
password.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub

dialog.cancel();
}
});
AlertDialog passdialog = password.create();
passdialog.show();

0 comments:

Post a Comment