Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android list view on click

I have a list view with 15 items. When I click on any item I want to change the screen(Intent). how can I change the activity on item selected in android? any tutorial or source code?

like image 817
vivek_Android Avatar asked Jun 07 '26 22:06

vivek_Android


1 Answers

You can use ListView's setOnItemClickListener, and start an new Activity in your implementation of this method. Following is sample code:

myListview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    public void onItemClick(AdapterView parent, View v, int position, long id){
        // Start your Activity according to the item just clicked.
    }
});
like image 175
Tony Avatar answered Jun 10 '26 13:06

Tony