Questions tagged [onitemclick]

OnItemClick is a callback method invoked when an item in an Android AdapterView has been clicked.

268 questions
48
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
  • 12,011
  • 51
  • 154
  • 289
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
  • 4,754
  • 8
  • 33
  • 70
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,275
  • 6
  • 46
  • 90
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,243
  • 2
  • 16
  • 40
13
votes
3 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
  • 30
9
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
  • 2,615
  • 6
  • 40
  • 71
7
votes
5 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…
E-Place
  • 393
  • 4
  • 21
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,069
  • 2
  • 34
  • 52
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
  • 9
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
  • 777
  • 1
  • 11
  • 46
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,320
  • 16
  • 27
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
  • 982
  • 2
  • 16
  • 36
3
votes
2 answers

Get Clicked ListView item attributes

I have a Windows 8 application with a ListView: There is some Event objects (a separate class with string attributes like EventType, Description,…
fueledbygyros
  • 147
  • 1
  • 12
1
2 3
17 18