FAQ Database Discussion Community


App crashes on setAdaptor() call

java,android,android-listview
Basically i was trying to achieve a simple task that: Gallary opens Select image(s) Your app appears on Share list(Click your app) Now SendingActivity will be the one that contain ListView and all selected images appear with their names and images. Here is my solution FirstActivity.java public class FirstActivity extends...

Can't center Navigation Drawer items vertically

android,android-listview,navigation-drawer
Main activity layout (removed the irrelevant elements): <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/black" <RelativeLayout android:id="@+id/layout_relative_in_drawer" android:layout_width="match_parent" android:layout_height="match_parent"...

ListView & onItemClick - When click, open new activity [on hold]

java,android,listview,android-listview,onclicklistener
actually my ListView is here: ListView lv = (ListView) findViewById(android.R.id.list); ArrayAdapter<String> ad = new ArrayAdapter<String>(getApplicationContext(),android.R.layout.simple_list_item_1,ls); lv.setAdapter(ad); What I want is when I click on an item in my ListView it should open a new activity for that item where I can show some description of the item e.g. if the...

Change ListView's ScrollBar/FastScroll color?

android,android-listview,material-design
My app has an orange theme all over but the ScrollBar/FastScroll is appearing green. I've tried to search a lot but can't find any way to change this. It just stays the way it is. I found a "android:fastScrollTextColor" property but that changes the color of the B inside the...

Update ListView footer

android,android-listview,android-view,android-view-invalidate
I've a ListView with a footer View that contains a TextView that can be changed dynamically according to the language selected. When I select a different language I update my ListView items: mBaseAdapter.updateItems(items); BaseAdapter: public void updateItems(List<Map.Entry<Integer, String>> items) { mItemsResIdList = new ArrayList<>(items); notifyDataSetChanged(); } And to update my...

Error when pressing an item in a listview

android,android-activity,android-listview,android-database
I am developing a listview complete with a database. When tapping an item of listview, the application closes and displays this error: 05-25 18:47:59.506 13297-13297/? I/art﹕ Not late-enabling -Xcheck:jni (already on) 05-25 18:47:59.664 13297-13297/? E/MediaPlayer﹕ Should have subtitle controller already set 05-25 18:47:59.737 13297-13313/? D/OpenGLRenderer﹕ Render dirty regions requested: true...

Moving from one ListView to another ListView

android,listview,android-activity,android-listview,listactivity
I am new in android development and create list item here is my code of both classes. I am trying to move from Menu to another activity(Prepaid) which also implemented list view. Problem is it can not move to Prepaid activity. Also my Header is missing from menu class, how...

Failed to retrieve data from a database, to complete a listview

android,android-activity,android-listview,android-database
I'm using databases to complete a listview. But I've run into a problem that is not solved. The problem arises when I create a variable lugar of the class Lugar. Here is the class code Lugar: public class Lugar { private String nombre; private String direccion; private GeoPuntoAlt posicion; private...

Implemented Android AlphabetIndexer but it's not showing

android,android-listview
I have followed a few stackoverflow threads, tutorials and what I can gather from the documentation but just can't get the AplhabetIndexer working in Android. The goal is to have an indexed ListView that users can quickly scroll using the letters on the right as per the standard contacts app...

Change text color of android.R.layout.simple_list_item_multiple_choice

android,android-listview,multichoiceitems
I am trying to figure out how I can change the text color of android.R.layout.simple_list_item_multiple_choice I know you can create your own listview with checkboxes but I really do not want to have to do that as the android.R.layout.simple_list_item_multiple_choice works perfectly, I would just like to know how to change...

Update the ListView after renaming a ListView item within a Popup Menu in a BaseAdapter in Android

android,listview,android-listview,android-arrayadapter,popupmenu
I have a ListView which has a custom Adapter and a PopupMenu giving some options on the list item, including a rename option. After renaming the list item I want to refresh the ListView and display the renamed list item also. Following is my code. DocumentsFragment public class DocumentsFragment extends...

ListFragment appearing twice on phone

java,android,xml,android-listview,android-listfragment
I'm seeing an undesired appearance of my list fragment when I run my app on the phone emulator. On the tablet emulator it appears once but on the phone emulator it appears twice. How can I fix this error for the list to appear on the phone emulator only once?...

Layout takes time to start

android,android-layout,android-listview
I have a ListView that I have created. But whenever I click on one of the list items it takes about 5 seconds to open. This is because I have about 90 views in that list item layout. These views are TextViews which I used to hold text for a...

open application After incoming or outgoing call diconnection

android,android-intent,android-listview,broadcastreceiver
I am creating an application, where I am getting call history in a listview, now what I am trying is after any incoming or outgoing call disconnection,I want to open that listview, but I don't know my app is not opening. my listview page is not displayed after any call,...

ListView Custom Adapter that includes Images from galery

android,listview,android-listview,imageview,custom-adapter
When creating a custom ListView adapter, usually I extend it from Array Adapter<String> but I want to make a ListView containing photos from the Gallery of the phone. I managed to get the Bitmap from the Gallery referring to the picture the user chose and put it in a regular...

How do I permanently change the background color of a row in a Listview?

android,xml,android-listview
I want to change the background color of a row in my listview. Right now I'm doing this with public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { view.setBackgroundColor(Color.parseColor("#ff0000"));// } Which works - but when I scroll down on my listview so that the row with the...

data not appear in listview till i scroll it

android,android-listview
first record content appear and the other records not appear untill i scroll the list,So if this list has 3 records which mean that i can't scroll so the first record content only appeared reocrd XML <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffffff"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Basket ID: "...

Listview - list item selection and initial setting (custom made items)

android,android-layout,android-listview
Working nicely with custom shape list items! Question 1: how can I work with custom shapes for list items? Question 2: how can I show which list item is selected? Question 3: how can I initially set a list item? EDIT: after a long search I found (with the help...

Prevent double selected in ListView

android,listview,android-listview
Hay i had tried to select ListView and change color background of view in selected position to transparent red, but every i tapped or selected an item other item color background also changed too. How to only select and change color background of item i selected ? this is my...

Colouring for Wearable ListView Items

java,android,listview,android-listview
Is there a way to change the text colour of list items on Android Wear? I've only previously seen this before and hence done this for phones but don't think the same code can be used for Wear. Activity code public class MainActivity extends Activity implements WearableListView.ClickListener{ private WearableListView mListView;...

Android SwipeRefreshLayout with empty TextView not working properly

android,android-listview,swiperefreshlayout
What i want to do is , allow user to swipe and refresh the list, it does not matter if the data is there or not. But when data is there in the listview only the listview should be visible, and when data is not there , Empty textview should...

Android seekbar update text view in list view

android,android-listview,android-seekbar
I have created a listView which is having seekBar and textView in every item. Do I need to update the textView based on the seekBar movement.ListView row is getting created based on numbers of rows in database table.How can I achieve this?.My code as follows activity_list_criteria.xml <LinearLayout android:layout_width="fill_parent" android:layout_height="35dp"> //Label...

setOnClickListener not firing with custom adapter and custom ListView

java,android,listview,android-listview
I've been spending a few hours on a problem and I still can't figure it out. The setOnClickListener in HotelOverviewFragment is not firing when I click an item in my ListView. However, the setOnClickListener does work from my custom adapter (NowArrayAdapter). My question is: why the setOnClickListener not working in...

add data before sending in android dynamic listview

android,json,listview,dynamic,android-listview
I have dynamic listview activity it transfer the item to another activity that have edit text(name,phone,table) and another dynamic listview under that. the each item have edit text it should send with each item. public class OrderAdapter extends BaseAdapter { private Context ctx; private LayoutInflater mInflater; private List<Item> orderItems; private...

Get adapter from OnActivityCreate()

java,android,android-fragments,android-listview,notifydatasetchanged
I am trying to call notifyDataSetChanged() on an adapter in a Fragment, from the MainActivity, in order to refresh the view/list after changing data. I create the adapter inside OnActivityCreate(), so I'm having trouble finding out how I can get the adapter, so that I can create a method to...

list view did not show any value in android studio

android,json,listview,android-listview
currently I'm try to develop my project which is using PHP and Android Studio. I'm using list view. I have already google other tutorial but did not found any answer and still have problem using list view. 05-30 23:10:15.592 7820-7849/com.example.ayim.madoc D/All Products:﹕ {"success":1,"patient":[{"id":"1","name":"Ikhwan Johari"},{"id":"2","name":"Ruminah Bedah"},{"id":"3","name":"Kamal Sado"}]} 05-30 23:10:15.592 7820-7849/com.example.ayim.madoc W/System.err﹕...

Why When I scroll my ListView with CheckBox selected it becomes unselected?

android,listview,checkbox,android-listview
I have seen some posts here talking about this but I did not see any answer accomplishing to my problem. I have this ListView with some TextViews and one CheckBox, everything is OK except that when I scroll the list some checked become unchecked. Here is my getView adapter code:...

Android ListView adding too many items

android,for-loop,android-listview,android-edittext,android-linearlayout
I am currently adding TextViews inside a LinearLayout inside a ListView element using a for loop, because the amount of TextViews I have to add in there is variable. I am adding the items to the ListViews like you normally do. The problem is, when I scroll the items start...

How to access outer class non-final variable from inner class in a Android ListView?

android,listview,android-listview
Here is my scenario. I am making a listview extending a ArrayAdapter class. In that class I am making a text and a check box dynamically. In that view I want to capture what check box clicked by user. Here is my ArrayAdapter class's getView method...... public View getView(int position,...

Remove space between app border and a List view

android,android-listview
I'm developing an android app which uses a list view using android studio.But when i use it a space is being displayed between list view and app borders.how can i remove that space?? Like in this pic I need my app to be designed .The following code is XML code...

Android toolbar context menu for listview items

android,android-listview,menu,contextmenu,android-toolbar
I am looking for help on how to implement a context menu in the toolbar for ListView items, like WhatsApp does it. The only tutorials I found so far are about a dialog that pops up, which is not what I want. Can someone help me or provide links with...

List shows as not null but ArrayAdapter throws NullPointerException

java,android,android-listview,nullpointerexception,android-arrayadapter
Can anyone please help me? I just don't understand why does it throw null pointer exception. I work with ksoap2,WCF web methods and android. I checked the "list" in debugger mode and it is not null. Here is my code: public class MainActivity extends Activity { String loginMemberId = "a001";...

Navigation drawer listview position not refreshing

android,android-listview,navigation-drawer,baseadapter
I have one NavigationDrawer in my Application and I have five items in my drawer: Home Accounts stock help logout Now if user click on logout it is displaying two items: Home Login Now the issue is when user click on login it always getting view of Accounts public class...

Android List view buttons text color changing when scrolling top to bottom?

android,android-listview
I have a ListView and i populated that ListView with TextView and Button using custom adapter.I had generated a click event for that Button in custom adapter.In that click event i am trying to change the button text and color,up to here its working fine but when i scroll the...

CardView and RecyclerView divider behaviour

android,android-layout,android-listview,android-cardview,android-recyclerview
I am trying to use RecyclerView with CardView as an single item of the list. I want to implement horizontal list, with LayoutManager it is really easy. So I started to implement it. It seems that everything works, but not as I expected here is the result using CardView as...

Android Studio cannot recognize “setAdapter()” method

java,android,listview,android-listview,android-studio
I have been trying to understand how to populate a ListView and to do that I tried making a simple app that takes a string array and puts it on a listview. I created a ListView object 'myListView' and tried calling the 'setAdapter()' function for this object. But the 'setAdapter'...

Layout Items not appearing in Listview

android,android-layout,listview,android-fragments,android-listview
I have a simple Hacker News (https://news.ycombinator.com/) application that displays each article in a list view. I have successfully been able to retrieve the news and even populate a Listview, however, the listview is only being partially populated, as far as I can tell. My adapter list item looks like...

Losing images from NetworkImageView after Scrolling list up-down

android,android-listview,android-volley,networkimageview
I have a ListView that grabs news with images associated with it using Volley Json. At first it loads everything but when i scroll the list and come back, it sometimes shows images and sometimes not. After scrolling 2-3 times listview loses every image. Same procedure works perfectly with my...

Searchable List View

android,android-listview,listadapter
So i'm trying to make a searchable list view using a custom array adapter. I finally got the search working but the results are not exactly accurate. Its actually a hit and miss kinda thing e.g Searching for Drupal gets me Google Plus, you knw what I saying? So here's...

ListView Adapter executing onclick methods on multiple rows simultaneously for a single click event

android,listview,android-listview,android-adapter
In my app I have a listview in a tab fragment. Each row of listview is a cardview , which has multiple views in it.(Buttons, textviews etc.) I have created a custom adapter class for this listview. This adapter class takes the data from local DB and inserts it in...

ListFragment is not updated with notifydatasetChanged

android,android-listview,android-listfragment,notifydatasetchanged
I am stuck with listfragment as the fragment listview is not updated with new item addition in allData arrayalist. The data come from server which is passed to listfragment class with the help of interface and result arrives in passData(ArrayList> allData). I had checked the size, it is alright in...

Set particular item unclickable ListView android

android,android-listview,onitemclick
I am having custom adapter which extends ArrayAdapter. I am having different layouts for different items. I like to make items that are from particular type unclickable. Here is my code: package android.adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Switch; import android.widget.TextView; import java.util.ArrayList; import...

AddView() to Expandable ListView

android,listview,android-listview,xamarin
i got a Expandable ListView. I Need to integrate dynamically View(Relative layout with textview) into ListView. I have an axml file(it's like template for my dynamic views). I'm doing like this View _view = LayoutInflater.Inflate(Resource.Layout.DynamicControl,null); After that,i'm trying to put into Expandable list(called "_List") : _List.AddView(_view,0); //where 0 is position(index)...

Populating a ListView with random data

android,xml,android-layout,android-fragments,android-listview
Here is my fragment's onCreateView : ` String[] pelda = { "12345", "blabla", "hhahho", }; List<String> elorejelzes = new ArrayList<String>(Arrays.asList(pelda)); elorejelzesAdapter = new ArrayAdapter<String>(getActivity(), R.layout.lista_elem_elorejelzes, R.id.lista_elem_elorejelzes_textview, elorejelzes); View rootView = inflater.inflate(R.layout.fragment_idojaras_kijelzo, container, false); ListView listView = (ListView) rootView.findViewById(R.id.listView); listView.setAdapter(elorejelzesAdapter); return...

Listview onItemClickListener obtaining data

android,arrays,listview,android-listview,parse.com
I have a String array saved in the internal storage and I'm using it to retrieve the Names of specific users from Parse.com. This is the code: SharedPreferences settings = getSharedPreferences("NotificationIDs", Context.MODE_PRIVATE); Set<String> myStrings = settings.getStringSet("myStrings", new HashSet<String>()); final ListView idList; idList = (ListView) findViewById(android.R.id.list); final ArrayAdapter<String> str = new...

EditText in ListView loses content in scroll

android,listview,android-listview
I've been digging to find a solution on my problem finding answers but none of them have worked for me. :/ I have a listview with edittext in each list item and when scrolling down and go up again content of the edited edittext has been lost or other edittext...

Having problems while trying to populate a todo listview using a custom adaptor?

java,android,listview,android-listview
I want a user to input data through an editable text and I want to receive that data through a custom made listview, for that I am trying to use a custom adapter to add a textfield into my listview, through the tostring() method I have converted the data from...

ScrollingViewBehavior for ListView

android,android-listview,android-support-library,android-recyclerview
I have two activities using AppBarLayout with a Toolbar and TabLayout from support library 22. The layout of both is pretty similar: A Toolbar at the top, below it TabLayout, below it a ViewPager containing 3 Fragments. The first activity's Fragment has a RecyclerView, the second activity's Fragment is using...

Clicked Animation is gone after design with

android,listview,android-listview
while using a ListView to show some data to the user, By default the ListView items have a "Clicked" Animation when the user clicks them [as shown in the picture] Now, i wanted to design the items in the ListView and added android:background="@drawable/border" to their XML layout definition when drawable/border.xml...

android listview ArrayAdapter string cannot be cast to HolderView

java,android,listview,android-listview,android-arrayadapter
In my application, listviews with custom arrayadapter crashes when scrolling the listview and the error is: 06-17 09:01:21.319: E/AndroidRuntime(32453): java.lang.ClassCastException: java.lang.String cannot be cast to SlideMenuListArrayAdapter$ViewHolder Note that slideMenuAdapter is my custom adapter, i bind it using arraylist of objects. this is the code of getView() @Override public View getView(int...

Android - How to put a item click in ListView with Hashmap and List

java,android,listview,android-listview
In my app, I use an AsyncTask named GetImageTask to get an image from an URL with an int given by the user. Example : url = "http://example.com/image.php?index=" + int I put the image in a ImageView and in my "doInBackground", I create two HashMap for add element in two...

ListView Footer causes ArrayIndexOutOfBoundsException

java,android,android-listview,indexoutofboundsexception,baseadapter
I've a ListView with a footer (simple LinearLayout with a TextView and a ImageView), and a BaseAdapter with 2 View types: @Override public int getViewTypeCount() { return 2; } My problem is when I scroll the list to the bottom and reach the footer because this exception is thrown: java.lang.ArrayIndexOutOfBoundsException:...

Listview getView method not getting called

android,listview,android-listview,baseadapter,swiperefreshlayout
This type of question has been asked so many times but none of the solutions on SO are working for me so I am asking again for help. I have a custom ListView which implemented pull-to-refresh and was working fine until I decided to use the new SwipeRefreshLayout and now...

How to set data to custom row TextView in ListView

android,android-listview,android-adapter
I want to show data which i get from server, in my custom ListView This is my row_category.xml for custom row <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <ImageView android:id="@+id/imageView1" android:layout_width="80dp" android:layout_height="80dp" android:layout_marginLeft="10dp" android:layout_marginTop="5dp"...

ListView adds empty view to root/parent instead of self?

android,android-listview,android-5.0-lollipop
I'm trying to add a custom empty view to a ListView as shown in this Q&A. But the ListView seems to add the empty view to its parent, or maybe to the root ViewGroup, rather than to itself. Am I doing something wrong here? I created a small layout file...

Android Persistent ListView recycling

java,android,android-listview,android-adapter
I have been fighting with this problem for days. Looking for the solution on stackoverflow or anywhere a solution is given, tried all of them even tried recyclerView but nothing helped. My PROBLEM is that I've a listview and two textView on a listItem. So whenever I click on list...

Loading listview using SharedPreferences throwing OutofMemoryError

android,listview,android-listview,sharedpreferences
I am using edittext and button in mainactivity, onclicking I want to add the text to listview which it does properly. I am also saving it using sharedpreferences,so that when I go back to mainactivity or restart app ,it automatically loads listview,but on clicking button ,I get OutOfMemoryerror at this...

Android contextual action bar with custom ListView not allowing multiple selection

android,android-listview,menuitem,contextual-action-bar,android-contextmenu
I followed Android API guide implementing CAB and I have several problems: Multiple selection not exist Selected items (rows) not colored to indicate they are selected How to change: [A] color of the CAB [B] Show some text on the CAB The current output is single selection, without coloring the...

Having problems while trying to implement a CheckBox in a custom todolist using a custom adapter?

android,listview,checkbox,android-listview
I am adding data through an editable text to a listview, listview is custom made and each row contains a textview and a checkbox, for now I want a toast message to appear whenever I click on a checkbox of each row for that I am implementing View.OnClickListener on the...

ListView setAdapter() doesn't work

android,listview,android-fragments,android-listview
I am using a ListView widget in a Fragment class. Not in ListFragment, because I am using other widgets in the same fragment. Therefore using the ListFragment class will cause the ListView to take the entire screen. However, using an instance of the ListView class, "setAdapter()" causes an app crash....

list view in fragments null pointer exception

java,android,android-fragments,android-listview,swiperefreshlayout
I am trying to setup swipe to refresh in my fragment, which fetches objects from parse. But every time, I seem to get an null pointer exception on setadapter and list view. Although both of them are correctly initialized are not null. My recentsadapter: package com.astuetz.viewpager.extensions.sample; import android.content.Context; import android.view.LayoutInflater;...

Use async task to modify element in a contact listview

android,json,android-listview,android-asynctask
i want to check if a phonenumber of my contacts is in a database. So far i created a listview with a custom adapter and can display contact name, number and image. I added a fourth field that should display if the phonenumber is in the database. i use asynctask...

Delete Database and ListView in Android

android,listview,android-listview
I have problem delete DataBase using ListView. I can delete the DataBase, but when I open again ListView I get an error. I got two class which is UserList.class and MySQLiteHelpre.class. In my UserList.class, I extend it to Activity and add method onItemLongClick. 06-03 09:13:43.880 18615-18615/com.sinergi.los.activity E/AndroidRuntime﹕ FATAL EXCEPTION: main...

How Can I launch event when user touch during 2 second on listview?

android,android-listview
I need to launch add event when user keep during 2 seconds on listview. After that vibrate device and show dialog asking "Add to favorite?". I've trying whit this. lv.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.AXIS_PRESSURE){ long eventDuration = android.os.SystemClock.elapsedRealtime() - event.getDownTime();...

Implement 'Undo' Swipe to remove from listview android

android,listview,android-listview
I am using romannurik/Android-SwipeToDismiss to implement swipe to remove item from listview. Everything is working fine for me up till now as i want to implement the undo feature with this library. I have gone through the code and coudn't find any thing to help me with this thing. Can...

Add scrollView and highlight on a Linear Layout in Android

android,android-layout,android-listview
I have Linearlayout that have have multiple linear layouts in which one of the main layout have a LinearLayout and Listview. LinearLayout contains multiple ImageView and TextView now I want to add ScrollView on this LinearLayout. But if I am adding the ScrollView my ListView got hidden and onClick of...

Android custom listview display last item on first position

java,android,listview,android-listview
when i insert a new product into listview, the product will be display on the last position in the listview. Now i want to display the most recent added product on the first position in my listview. For example, my array product initially display like this in the listview, 0...

How to constant the index for Search in AndroidListViewWithSearch

android,android-listview,android-search
I'm trying to make a search function with listview. Each item in listView have it own activity to be start. My problem was I'm using index position for search. If the I search "Mango", the index will automatically change to 0 (which the problem is) and start activity1. "Mango" should...

ListView item is not clicking

java,android,listview,android-listview,listviewitem
I have fragment with ListView. A problem with ListViewItem having web-html links. Is not clickable. @drawable/items_selector is not working and onItemClick is not call when android:autoLink="web" "android:descendantFocusability="blocksDescendants" is not helped. And this solution not works. I need listview item like a "hangouts" or other apps whith work item selected and...

Is it possible to center a single item on a listview?

android,xml,listview,android-listview
I have a custom listview in a relative layout and I was wondering if it is possible to center a single item in a listview? The custom adapter handles two TextView fields from the custom_listview.xml For example: My List view A B C D E F G I've included my...

How to delete the complete view on click of delete button in android

android,android-layout,android-activity,android-listview,android-arrayadapter
I have made a custom view that contains an image,text and a delete button. I want to delete the the particular view when I click the delete button associated with it. Please tell how to implement this. Here is my MainActivity.java package com.khurana.nikhil.list1; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.LayoutInflater; import...

Reload youtubeplayer in activity? [closed]

android,android-listview,youtube-api,player
Please help me, I want when user click item in listview -> Reload activity with video clicked (Like youtube app android) Pleale help me the idea. Thanks You can view here Update my source code: public class YoutubePlayerActivity extends AppCompatActivity implements YouTubePlayer.OnInitializedListener { private static final int RECOVERY_DIALOG_REQUEST = 1;...

Having problems to implement a setOnClickListener - Fragment

android,android-fragments,android-listview
I'm having problems to implement an onclick to the items I have in my list. the error is below: 06-14 16:15:43.861 11651-11651/wk.gon250.dublinbike E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: wk.gon250.dublinbike, PID: 11651 java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead at android.widget.AdapterView.setOnClickListener(AdapterView.java:778) at tab.Tab2.onCreateView(Tab2.java:67) The code of my...

Android's List View. Parameterized type in AdapterView.OnItemClickListener

java,android,android-listview,parameterized-types
I have a ListView with a hypothetical SquirrelAdapter. Something like this: public class SquirrelAdapter extends ArrayAdapter<Squirrel> { private LayoutInflater layoutInflater; private Context context; private int resource; public SquirrelAdapter (Context context, int resource, List<Squirrel> squirrels) { super(context, resource, squirrels); layoutInflater = LayoutInflater.from(context); this.context = context; this.resource = resource; } @Override public...

Can't get the right view in a list by view.getTag()

android,listview,android-listview,view
I have a custom card list view.. the view contains an imageView and three buttons.. What i want to do is when i click on a button i want to set the image of the card that holds that button in imageView object.. What happens is that setSelectedimage() sets the...

When putting listview inside a RelativeLayout it always looking for R.id.list

android,android-layout,listview,android-listview
I was trying to put an imageview and a listview inside a relative layout, but i'm always having an error like this Your content must have a ListView whose id attribute is 'android.R.id.list' then i tried just putting ListView as the parent and it works but i want to display...

How to get Images from Internet and past it in a ListView?

android,json,android-listview,android-arrayadapter,listadapter
I'm doing my BlogApp. It gets all data from the Internet. I added three TextViews, but I have problem with getting images from JSON. I've tryed different ways but I still don't understand how exactly do this. Here is a part of my code: private void handleBlogResponse() { mProgressBar.setVisibility(View.INVISIBLE); if...

Why elements adding at the end of ListView?

android,android-layout,android-listview,android-adapter
I am working with custom ListView. Why items were added to the end of list view? I have only 3 items. 15000.00 is added first (so it is not reversed). ...

custom ArrayAdapter ViewHolder : imageView changes for several items in Listview not for one only android,listview,android-listview,imageview
ok i encounter a problem with this custom ArrayAdapter public class AuthorsAdapter extends ArrayAdapter<Entity> { View row; static class ViewHolder { TextView textViewTitle; TextView textViewEntitySummary; ImageView imageViewPicture; } public AuthorsAdapter(Context context, LinkedList<Entity> entity) { super(context, 0, entity); } @Override public View getView( final int position, View convertView, final ViewGroup parent)...

Cancelling asynctask for list view adapter before its finished

android,android-listview,android-asynctask,adapter
I need to cancel my asynctask populating a list view adapter before it has finished by pressing back button. By this code @Override public View getView(final int position, View convertView, ViewGroup parent) { if(convertView==null){ LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);convertView=inflater.inflate(R.layout.seatadapter, null); TextView text3=(TextView)convertView.findViewById(R.id.text3); ProgressBar progressBar1=(ProgressBar)convertView.findViewById(R.id.progressBar1);...

Unable to use string resources for list view items

java,android,android-fragments,android-listview,android-listfragment
I'm trying to use string resources for my 2-line list view items rather than hard-coding them but I get this error. How can I fix that? Before using string resources public class ListData { public static final String[][] items = { {"America","America Description"}, {"Europe","Europe Description"}, }; } After using string...

An activity with two listviews in android

android,android-layout,android-activity,layout,android-listview
MainAcitivity public class MainActivity extends Activity { ListView list, listYear; String[] web = { "Google Plus", "Twitter", "Windows", "Bing", "Itunes", "Wordpress", "Drupal" } ; String[] year = { "2012", "2013", "2014", "2015", "2016", "2017", "2018" } ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); list=(ListView)findViewById(R.id.list); list.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, web));...

Change row color of a ListView with Cursoradapter and bindView

android,listview,android-listview,android-cursoradapter
I got some trouble, when I click on my Listview I would like to change the color of the selected row, but a several row change color instead of the one I want. If I click on another row i want that the previous clicked row keep his color. There's...

Animation on reordering ListView Item

android,listview,animation,android-listview,adapter
I have a ListView with items containing two TextViews. When I click on one of the TextViews, I reorder the list (by sending the clicked item to the bottom of the list) and I want to make an animation for that. I have an OnClickListener on the TextView in the...

Replace list in master activity with another list and remove old list from view

java,android,android-fragments,android-listview,android-listfragment
When staring my app a list (list_main) is displayed in the master fragment. There is also a 2nd list fragment that is supposed to open when I clicking the 1st list item from my main list fragment, however after clicking the 1st list item, the main list fragment DOES disappear...

Ending multiselect in a listview removes list item padding

android-layout,android-listview,recyclerview,android-4.1-jelly-bean
I can only reconstruct this behavior with a JellyBean device (Android 4.1.2 on a Samsung Galaxy S3). With KitKat or Lollipop this problem did not occur. I have a RecyclerView with a list of items which possible multiselect. When I select a few items in the list (the multiselect gets...

Adding objects to listview dynamically from other class in android

android,android-activity,android-listview
My project includes an "accept/deny incoming data" window that on "accept" should add the incoming data dynamically to a listview and the database that the listview gets the data from. My listadapter is an inner class. My code in the main class relating to the populating of the listview: public...

Android disable scroll and click for listview

android,listview,android-listview
I have a simple layout, a listview, and two icons for filtering and sorting options. When I click on the either of the two options I have a layout that is placed above the listview and covers only 60% of the screen thereby making the listview below it partially visible....

Null Pointer Exception while setting value of TextView in an Array Adapter class - Android

java,android,listview,android-listview,nullpointerexception
I'm getting a NullPointerException while trying to start an Activity which contains a ListView . In the getView method of the adapter class, the exception happens when the setText function of a textView is being called . The code bellow is my adapter class: public class QuestionsListAdapter extends ArrayAdapter<Question> {...

How to implement a chat list view with heterogenous row types (image video and text) using listview?

android,android-listview,chat,android-recyclerview
I'm building a normal chat application. Image,text and videos can be sent hence I need multiple row styles in my list. I used listview. But Listview returned (after recycling rows) wrong rows many times and my attempt failed. Any Idea how to do this? Can this be done using RecyclerView?...

Resetting an Inflated ListView's height, Listview height

android,android-listview,android-studio
I have a main activity and its layout is a scrollView and has a "linear layout" called [taskLayout]. setContentView(R.layout.my_jobs_view_single_holder); final LinearLayout taskLayout = (LinearLayout)findViewById(R.id.TaskLayout); Then i'm inflating another view and adding the view to the main scrollviews.TaskLayout section. LayoutInflater pickup_inflater = (LayoutInflater)getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = pickup_inflater.inflate(R.layout.my_jobs_view_single_pickup,null);...

Android, Listview on Scroll Item position issue

android,android-listview,listviewitem,onscroll
I am facing a problem. I am working on QuickBlox Private chat. I want to show date and time with only last message of sent and get. I achieve that but issue is that when ever I scroll that message listview date and time change position and every scroll it...

ListAdapter refuses application after changing array type to int

java,android,arrays,android-listview,android-listfragment
After changing the array type of my list items to 'int' my list adapter refuses application of it. How can I fix this? ListData.java public class ListData { public static final String[][] items = { {R.string.america,R.string.america_description}, {R.string.europe, R.string.europe_description}, }; } within FilterListFragment.java: private void initialize(View view) { //Set up list...

Position of items in listview is changing when I scroll the listview?

android,android-layout,android-listview
My application has an listview and listview's rows consist of imageView and Textview. I had a problem about image redownloading and other data when I scoll up and down the listview. There are some rows in Listview. All data of my list item is change when i scroll the listview.So...

Simple ListLiew with 2 columns?

android,listview,android-listview
I'm trying to setup a simple listview with 2 columns, I would just like it to hold a name and age. I think may be able to use a grid view, but i don't know how many names it will need to hold, and if grid views are scrollable or...

Attaching layout directly to listview bottom

android,android-layout,listview,android-listview
I have three layouts in my page. Two linearlayouts which represent 2 stripes with information in them and a listview in the third linear layout. I succesfully attached one of the linearlayouts to the top of the page, however I want the second linearlayout (bottom control bar) to be attached...

adapter.notifyDataSetChanged() not working when I update ArrayList

android,android-listview
I have seen a lot of post about this case but I don't find a solution for me. I use SwipeRefreshLayout.OnRefreshListener and this is my code in onRefresh() method. This doesn't work. new Handler().postDelayed(new Runnable() { @Override public void run() { Aviso aviso = new Aviso(); aviso.setTitle("MMMMMMMMMMMMMMMMMMMMMM"); aviso.setDescription("Deskribapena"); aviso.setPubDate("Wed, 19...

Android ripple background color

android,android-activity,android-listview,navigation-drawer,rippledrawable
I am using a ripple effect on my navigation drawer. I have set it like this and applied it to my ListView: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_activated="true" android:drawable="@color/black_200" /> <item android:state_pressed="true" android:color="@color/black_200"> <ripple android:color="@color/black_400" /> </item> <item android:drawable="@color/white" /> </selector> I want the ripple background to remain the same like the...

performFiltering() sql exception while filtering android.

android,listview,android-listview,android-sqlite
I am trying to filter SimpleCursorAdapter ListView But I am getting sql exception in filtering. I am trying to find those contacts who's name start's with user's entered text. String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1"; cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, selection, null, null); adapter.setFilterQueryProvider(new FilterQueryProvider() { public Cursor runQuery(CharSequence constraint) {...

List view item touch feedback not applied to whole row

java,android,xml,android-fragments,android-listview
Whenever I tap one of my list view items, only the text area within the item gets highlighted and not the rest of the row. How can I fix this error to enable touch feedback the whole row of any list view item? Java public class MainActivity extends ActionBarActivity {...