Ich habe eine Listenansicht mit einigen Werten. Ich brauche einen Dialog in der Listenansicht beim Klicken auf den Gegenstand. Mein Problem ist, wenn das Klicken auf ein Element im Listenansichtsdialog gleich der Anzahl der Elemente in der Listenansicht erscheint. Ich möchte nur einen Dialog für jeden Artikel klicken, der die entsprechenden Artikeldetails anzeigt.Alarmdialog im Listenelement Klick Listener
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
// TODO Auto-generated method stub
float due = (float) 0.0;
if(list != null){
for(int i = 0; i< list.getChildCount();i++){
View vie = list.getChildAt(i);
TextView amt = (TextView) vie.findViewById(R.id.amt);
TextView alloc = (TextView) vie.findViewById(R.id.alloc);
EditText ed = (EditText) vie.findViewById(R.id.edit);
String amnt = amt.getText().toString();
String allc = alloc.getText().toString();
// due amount is net amount minus allocation amount
due = Float.valueOf(amnt) - Float.valueOf(allc);
AlertDialog.Builder alertDial = new AlertDialog.Builder(Collection.this);
LayoutInflater inflater=Collection.this.getLayoutInflater();
//this is what I did to added the layout to the alert dialog
View layout=inflater.inflate(R.layout.alert_layout,null);
alertDial.setView(layout);
final TextView dues=(TextView)layout.findViewById(R.id.textViewdue);
final EditText received=(EditText)layout.findViewById(R.id.rcvd);
dues.setText("Float.toString(due)");
AlertDialog alertDialog = alertDial.create();
// show alert
alertDialog.show();
}
}
}
Und auch kann ich nicht Werte in bearbeiten Text in Dialog eingeben. Bitte hilf mir.
hey es funktioniert..aber warum konnte ich keinen Wert eingeben, um Text zu bearbeiten? Ich muss eine meiner Ansichten in der Liste mit dem Text bearbeiten Wert aktualisieren. Bitte weißt du warum? – Bivin