OnItemClick is a callback method invoked when an item in an Android AdapterView has been clicked.
Questions tagged [onitemclick]
274 questions
50
votes
6 answers
How to handle the click event in Listview in android?
The below is my testing code to create the list view, the list view display successfully, however, there is error in click event. I would like to create an intent to send a hardcode message to an new activity. However, it show error for the line…

user782104
- 13,233
- 55
- 172
- 312
23
votes
2 answers
RecyclerView Animation on Item Click
I am trying to implement my own recyclerview Animation - I would like to achieve this without using any external libraries. Here is what the theoretical animation should look like.
The user clicks an item on the List and an animation occurs which…

AndyRoid
- 5,062
- 8
- 38
- 73
15
votes
5 answers
What is the difference between "int" and "long" argument in onItemClick in Android
When we implement OnItemClickListener, we have to implement onItemClick method which is an abstract method in OnItemClickListener interface. In onItemClick method there are four arguments.
public void onItemClick(AdapterView> arg0, View arg1, int…

AnujAroshA
- 4,623
- 8
- 56
- 99
14
votes
3 answers
Focusable EditText in the ListView and onItemClick
In each ListView item I have EditText.
When I set android:focusable="false" for EditText then onItemClick on the ListView item is working, but EditText doesn't get cursor when I click inside.
If I'll set android:focusable="true" for EditText, then…

Sviatoslav
- 1,301
- 2
- 17
- 42
13
votes
4 answers
Get value of item on OnItemClick Listview
I try to get the value of a selected Item within a custom adapter on a listview. I try this with following code:
public void onItemClick(AdapterView> parent, View v,
int position, long id) {
View curr =…

Matthias Vanb
- 923
- 5
- 14
- 32
10
votes
2 answers
Android: How to call getActivity() in OnItemClickListener()?
I am trying to call getActivity() in the OnItemClickListener:
class ViewTest{ //called in a fragment
setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int…

user2212461
- 3,105
- 8
- 49
- 87
9
votes
6 answers
Recyclerview item click not always work and sometimes can work but with more more click (don't know how many click)
Recyclerview item click not always work and sometimes can work but with more more click (don't know how many click).If just click once that can't clicked.
Note few days ago I tried to click once and it's worked, but now when I tried to running again…

Eggy
- 522
- 5
- 29
4
votes
1 answer
onItemClick fires only on text not on the entire row of ListView
On an Android app targeting APIs 11 to 18, I have dynamically populated a ListView using an array of strings and added a listener to each row. The text usually covers approximately 50% of a row only. The problem is that if I click on the actual…

Javide
- 2,477
- 5
- 45
- 61
4
votes
2 answers
How do I get the cursor value of a ListView's item onItemClick?
I've created a database with tables (categories) with columns (_id, title etc). I want to read these categories' data from my database and list them in a ListView.
Here is my code:
public class MainActivity extends listActivity{
private…
user1517313
4
votes
4 answers
Android Gridview and Button OnItemclick
Here is my buttonAdapter class that i think is accurate:
package com.example.test;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import…

user1594295
- 51
- 1
- 1
- 2
3
votes
1 answer
Get data from SQLite database to intent through "onItemClick" on item in ListView Android
I really need your help.
I have a database with latitude and longitude data, here the example:
id_____name_____lat_________long
1_____hotel one___6.1234______-106.12345
2____hotel two____6.54321_____-107.23456
3___hotel…

forgiven24
- 49
- 2
- 10
3
votes
3 answers
List View onItemClick is not working
I have a Custom List View. Each row of the list view contains a checkbox, 2 text views and an image view. I have been tring to open another activity on click of any row of the list view but the onItemClick is not working at all.
public class…

TeeKay
- 1,025
- 2
- 22
- 60
3
votes
1 answer
Clicked drop-down item in AutoCompleteTextView does not respond on the first click
My app implements a HashMap, such that when a key is typed in the AutoCompleteTextView editText, and user clicks a dropdown item, the value gets displayed on a textView.
The only problem is that the clicked drop-down item does not respond on the…

Emzor
- 1,380
- 17
- 28
3
votes
4 answers
startActivity() on a RecyclerView Item
I need to start an activity based on the item a user clicks on a RecyclerView. The code below has the position as a reference. Does anyone knows how to get this done? I need something like Intent intent = new Intent (MainActivity.this,…

CBA110
- 1,072
- 2
- 18
- 37
3
votes
1 answer
what is parent and view in onItemClick?
I have a difficulty in understanding following method. In the documentation, the method description is as follows:
public abstract void onItemClick (AdapterView> parent, View view, int position, long id)
Parameters:
parent The AdapterView…

xyz
- 1,325
- 5
- 26
- 50