listViewInfo = (ListView)findViewById(R.id.listView1);
        tempListAdapter = new SimpleAdapter(this, weatherlist, 
R.layout.list_row,
            new String[] {"city", "low", "high"}, new int[] {R.id.CITY_CELL, 
R.id.LOW_CELL, R.id.HIGH_CELL});
listViewInfo.setAdapter(tempListAdapter);
tempUpdate(); 
listViewInfo.setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(AdapterView<?> a, View v,
 final int position, long id) {
// TODO Auto-generated method stub
AlertDialog.Builder adb = new AlertDialog.Builder(
EditCity.this);
adb.setTitle("Delete?");
adb.setMessage("Are you sure you want to delete ");
// final int positionToRemove = position;
adb.setNegativeButton("Cancel", null);
adb.setPositiveButton("Ok",
new AlertDialog.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
// TODO Auto-generated method stub
try
{ 
weatherlist.remove(map); 
listViewInfo.setAdapter(tempListAdapter); 
}catch(Exception e)
{
// 
}
}
});
adb.show();
}
});
    }
}

This can remove only 1 row

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to