Answers for "onitemclick adapter example"

0

onitemclick adapter example

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_billing_home);
        DbHandler db = new DbHandler(this);
        ArrayList<HashMap<String, String>> route_List = db.GetRouts();
        ListView lv = (ListView) findViewById(R.id.route_list);
        ListAdapter adapter = new SimpleAdapter(
                RouteDetailsActivity.this, route_List, R.layout.routelist_row,new String[]{"name","day","location"}, new int[]{R.id.cus_name, R.id.mobile, R.id.route});
        lv.setAdapter(adapter);
//        Button pick = (Button)findViewById(R.id.ConsrraintLayout);
        lv.setOnClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                String r_id = route_List.get(position).get(id);
                Intent intent = new Intent(RouteDetailsActivity.this, BillingCusDetailsActivity.class);
                intent.putExtra("r_id",r_id);
                startActivity(intent);
            }
        });
    }
Posted by: Guest on September-11-2021

Code answers related to "onitemclick adapter example"

Browse Popular Code Answers by Language