title: android list view with text image and button, using the SimpleCursorAdapter
body: <p>I only have a ListView containing TextView. I would like to add an image and a button to each row in the list, such that when i click on the button, it will send the data gotten from SimpleCursorAdapter and bring me to another activity.</p>
  
  <p>I have got two xml files. one that contains the ListView and the other xml file contains the TextView, ImageView and Button. </p>
  
  <p>I have read many articles in stackoverflow and online, but i still cant get it working. I think there is something which is got to do with the getView(), onClickListener for the button but i do not know how to link it together with the SimpleCursorAapter class. As in my case, i did not extend SimpleCursorAdapter but used it directly. I am confused about how to allow it to access the xml file which contains the button and image. my current code is like this:</p>
  
  <pre><code>public class BoardsActivity extends ListActivity {
  private static final int ACTIVITY_SUBSCRIBE = 0;
  private AnnouncementDbAdapter dbAdapter;
  private Cursor cursor;
  private Button subscribeButton;
  //private LayoutInflater mInflater;
  
  @Override
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.subscribe_to);
      // mInflater = (LayoutInflater) getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
      dbAdapter = new AnnouncementDbAdapter(this);
      //      dbAdapter.open();
      //      fillData();
  
  
  @Override
  protected void onResume() {
  super.onResume();
  dbAdapter.open();
  fillData();
  
  @Override
  protected void onPause() {
  super.onPause();
  dbAdapter.close();
  
  private void fillData() {
  cursor = dbAdapter.fetchAllBoards();
  startManagingCursor(cursor);
  
  String[] from = new String[] {AnnouncementDbHelper.BNAME };
  int[] to = new int[] {R.id.subscribeactivity_bname};
  
  SimpleCursorAdapter board = new SimpleCursorAdapter(this,R.layout.subscribe_to_row, cursor, from, to);
  setListAdapter(board);
  
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
  super.onListItemClick(l, v, position, id);
  Cursor details = dbAdapter.fetchBoard(id);
  startManagingCursor(details);
  
  Intent i = new Intent(this, BoardDetailsActivity.class);
  i.putExtra(AnnouncementDbHelper.BID, id);
  startActivityForResult(i, ACTIVITY_SUBSCRIBE);
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
  super.onActivityResult(requestCode, resultCode, intent);
  dbAdapter.open();
  fillData();}
  </code></pre>
  
  <p>How can i get the image from Drawables and when the user clicks on the button, it goes to another activity?</p>