Tag: listview

“Content has view with id attribute 'android.r.id.list' that is not a ListView Class.” when create a list view in a fragment

Here is the problem. I have a list view, and it looks fine in the building, but it broke the error. Content has view with id attribute ‘android.r.id.list’ that is not a ListView Class. I haven’t added the listview into the XML, something like :@android:list, the reason I didn’t do that is I could find […]

How do I make a specific item in the navigation drawer to appear as selected?

I have been frustrated with this problem for quite a while, but I can’t seem to make an item in the navigation drawer to appear as selected neither programmatically nor when the user selects it. I am trying to achieve the following http://i.stack.imgur.com/PIHEm.png (I cannot post images yet) I have followed the example navigation drawer […]

What is the working of setTag and getTag in ViewHolder pattern?

I have a simple code snippet for implementing custom listview. My code is as follows: WeatherAdapter.java : public class WeatherAdapter extends ArrayAdapter<weather>{ Context mcontext; int mlayoutResourceId; weather mdata[] = null; View row; public WeatherAdapter(Context context, int layoutResourceId, weather[] data) { super(context, layoutResourceId, data); mlayoutResourceId = layoutResourceId; mcontext = context; mdata = data; } @Override public […]

Textview`s LinkMovementMethod blocks listitem touch event

I have some problem with Listview. Listview has list items that consist of imageview and textview. Textview contains clickable links. When I set LinkMovementMethod to textviews, listitems doesn`t receive onclick event. I still cannot find any right solution=(. Can anyone explane how to solve it or give an example of using textview with clickable links […]

Android Checkbox listview select all (disable/enable)

This question already has an answer here: Selecting All Items in a Listview on checkbox select 4 answers

onListItemClick is not working for listview?

Hi onListItemClick for listview is not working. Here i am fetching datas from SQLite using AsyncTask and displaying it in a list view. And i wants to do some actions when a list in a listview has clicked. But the click is not happening. I had tried a lot for this. Please help me. Here […]

Android, Custom ListAdapter get TextView-Text

I coded an own Adapter and added it to my ListActivity via an ListView. The reason why I wrote an own Adapter is, that i had to make some layout changes to the list-entrys. In every entry of the list i’ve got 3 TextViews. <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”?android:attr/listPreferredItemHeight” android:padding=”6dip”> <TextView android:id=”@+id/myNr” android:layout_width=”40dip” […]

Why doing listview.setAdapter(_adapter) twice crashes app?

The key issue I have is doing lv_apps.setAdapter(_adapter) TWICE is what crashes my app. (Basically, when i call populateListView_trial() the 2nd time, app crashes — and the offending line is lv_apps.setAdapter(_adapter) Stacktrace is below the functions private void populateListView_trial() { blockedApps = loadArrayBlockedApps(); if(isTimerRunning()) { blockedApps = loadArrayBlockedApps(); temp_blockedList = new ArrayAdapter<String>( MainActivityCircularSeekbar.this, android.R.layout.simple_list_item_1, blockedApps); […]

Get position in ListView

I use ListView to show several items. My row.xml as below: <TextView android:text=”text” android:id=”@+id/tvViewRow” android:layout_width=”wrap_content” android:layout_height=”wrap_content”> </TextView> <Button android:text=”Click me!” android:id=”@+id/BtnToClick” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:onClick=”myClick”> </Button> And I define myClick in Activity as below: public void myClick (View v) { LinearLayout vwParentRow = (LinearLayout)v.getParent(); //How to get the position } How to know the position which […]

my listview doesn't fill parent

<RelativeLayout android:layout_width=”fill_parent” android:layout_height=”fill_parent” <TextView android:id=”@+id/tv_test” android:text=”Test ” android:layout_width=”wrap_content” android:layout_height=”wrap_content” /> <ListView android:id=”@+id/list_test” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:layout_below=”@id/tv_test” ></ListView> </RelativeLayout> And everything is in a ScrollView, i don’t know why but the relative layout seems to set a wrap content. And it makes the ListView small and not taking the whole place. I don’t know if it’s useful […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.