• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Problems with listview and checkbox event  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having problems with what's suppose to be a simple thing to code. I create a list view with two columns: a checkbox and a text view. When the user clicks on the text view, I fire up an intent and when the user clicks on the checkbox (one or more of them) I want to grab the id and show a 'delete this textview' icon in the action bar. I don't understand how to listen for the event when the users checks a checkbox.

This sums up what I'm trying to accomplish


This is my main.xml which contains the List View:


The custom layout which is used to display the checkbox and the textview in the listview (msg.xml):


Main class:


If anyone can help I would be very grateful, I've been struggling with this for 2 days now.
 
Ranch Hand
Posts: 38
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code is a sample for CheckBox on Checked Event.

CheckBox box = (CheckBox) findViewById(R.id.checkBox1);
box.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
// Your Logic here
}
}
});


Is this what you are looking for ?.
 
A berm makes a great wind break. And Iwe all like to break wind once in a while. Like this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!