android-listview

Selecting/highlighting multiple items in listview with custom adapter - Android

為{幸葍}努か 提交于 2019-12-05 03:36:26
I followed a good tutorial, with some changes, to create a custom ListView that will allow me to display multiple images for each row in my ListView. What I would like to do is highlight by selecting multiple items in the list and then perform some sort of action to all of those list items by selecting an option on my Options Menu. However, the problem I seem to be running into is that I cannot select multiple items, even though I have added android:choiceMode="multipleChoice" to the ListView in the .xml file. I realize that this can be done using check boxes or radio buttons, but I would

listview display the data from database in android

不想你离开。 提交于 2019-12-05 03:17:41
问题 I am new to android. I would like to know that how to display the data from database in listview. It does not add a data to database.I just display whatever we store in database.please help me to achieve this...Thanks in advance... 回答1: Use these classes this may help you for database creation package com.example.grapes; import java.util.ArrayList; import java.util.List; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android

After maintaining collapse/expand state for N-level or Multilevel expandablelistview some subgroups are not displayed

 ̄綄美尐妖づ 提交于 2019-12-05 01:00:33
I worked a lot to create **N-level expandableListView. I am able to make it to any level but my requirement is to maintain the state of opened groups even after scroll. I tried with multiple ways but still unsuccessful. This Expandable listview is meeting with all company requirement other than this issue. *This is one way, which i tried. I am able to save the states within objects but few subgroups are not getting displayed. * I tried with onMeasure(width,height) method to maintain the height when dynamic generated list but still failed to get perfect one. Also i went through a number of

Android Listview in PopupWindow onitemclick not work on some device

混江龙づ霸主 提交于 2019-12-05 00:45:08
My ListView is inside PopupWindow. When i shown PopupWindow and click on Listview row in device ASUS K00z fonepad worke very well. But in HTC Z715e is not working (onitem click event not fired) 1.This is my listview item layout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ln_testpopitemcon" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="52dp" android:background="#3b8ed4" android:descendantFocusability="blocksDescendants"> <ImageView android:id="@+id/img_testiconmenu" android:layout_margin="10dp" android

Android: Removing items from a ListView/ArrayAdapter Activity

一曲冷凌霜 提交于 2019-12-05 00:43:38
问题 I have a list (of messages) and I want to give the user the ability to remove these items from the list. I have extended an ArrayAdapter and give it an ArrayList of my messages and would like to simply remove an item from that list and then refresh the ListView instead of reloading the entire list of sent messages. The problem is, if there's only one message and I remove it using listAdapter.remove(messageObject) , the adapter is still calling getView() and then throwing NullPointerExceptions

AdapterView.OnItemClickListener with more ListView

荒凉一梦 提交于 2019-12-05 00:16:31
问题 I have 2 ListView on a single fragment and I wonder if I can set for both same class that implements AdapterView.OnItemClickListener. I mean, Android Documentation says: public abstract void onItemClick (AdapterView<?> parent, View view, int position, long id) Added in API level 1 Callback method to be invoked when an item in this AdapterView has been clicked. Implementers can call getItemAtPosition(position) if they need to access the data associated with the selected item. Parameters parent

Align two TextViews, one left the other right, on a ListView without stretching the backgrounds

二次信任 提交于 2019-12-04 23:52:46
问题 So I've got two TextViews per row in a ListView . One should be left and the other right aligned. Both TextViews have a rounded rectangle as background which should just wrap the text inside. So I came up with this: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:id="@+id/text_right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout

Listview same height as content

[亡魂溺海] 提交于 2019-12-04 22:57:55
I used custom listview . Content comes from dynamic I want to same listview height same as content. I used wrap_content but this does not help If I remove scrollview then its work Code. "The vertically scrolling ScrollView should not contain another vertically scrolling widget (ListView)" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background_img" android:scrollbars="none" > <LinearLayout android:layout_width="match

Filtering list of apps in custom baseadapter

点点圈 提交于 2019-12-04 22:06:24
I am trying to implement a searchview for my listview of my installed apps with my baseadapter class. Currently it looks like this: The problem is that when I hit it crashes with 09-02 19:56:47.925 1628-1628/com.spicycurryman.getdisciplined10.app.dev E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.spicycurryman.getdisciplined10.app.dev, PID: 1628 java.lang.NullPointerException at com.spicycurryman.getdisciplined10.app.BlockActivity$2.onQueryTextSubmit(BlockActivity.java:126) because I'm not sure how set up my listview and adapter Currently this is my fragment class: package com

Start Activities from onItemClick of ListView in fragments

与世无争的帅哥 提交于 2019-12-04 21:46:26
So I have two fragments linking to layout files which display ListViews. The ListViews are defined in the xml and have entries from a string array. I want to click on items in the ListView and open new activities. There are 8 items in one ListView and 9 in the other. In the onItemClick code, how do I create intents to start activities based on the item clicked? I will create 1 class per item as its own activity. How can I start the activities in the classes via intents inside the onItemClick methods of this code? class CommunityFragment extends Fragment{ @Override public View onCreateView