click in buttons in list view

fl0wblue

New Member
i have function retrieve information (Student id -Student name) from database so each item in list will have (text view for student id and student name) with button (delete student) i try to test the button delete student so if the user press it it will display a toast message that have student id but the problem it is not work and there is no error in console or even the log cat so what do you think how can i solve it ?\[code\]ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) //one of the list { // getting values from selected ListItem StudentID = ((TextView) view.findViewById(R.id.StudentID)).getText() .toString(); b=(Button)findViewById(R.id.DeleteStudent); b.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { Toast.makeText(getBaseContext(),StudentID ,Toast.LENGTH_LONG).show(); } }); } });\[/code\]also i try to make the code of buttons outside the list but it display an errorhow do you think i can solve it ?
 
Back
Top