0

Here is my Code :

ListView listView;
SimpleCursorAdapter adapter;
String[] from = new String[]{mydb.ID, mydb.FNAME, mydb.LNAME, mydb.ADDRESS};
int[] to = new int[]{R.id.id, R.id.fname, R.id.lname, R.id.address};
Cursor cursor = mydb.fetch();
listView = (ListView) findViewById(R.id.listView);
adapter = new SimpleCursorAdapter(this, R.layout.list, cursor, from, to, 0);
adapter.notifyDataSetChanged();
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {

            id = (TextView) arg1.findViewById(R.id.id);
            int id_To_Search = Integer.valueOf(id.getText().toString());
            Bundle dataBundle = new Bundle();
            dataBundle.putInt("_id", id_To_Search);
            Intent intent = new Intent(getApplicationContext(), AddPatient.class);
            intent.putExtras(dataBundle);
            startActivity(intent);
            }
        })

I need to add buttons for the new activity. So I need to do this in ViewHolder method. How can i convert this to that method.?

Rajesh Satvara
  • 3,842
  • 2
  • 30
  • 50

0 Answers0