android-listview

Android Array Adapter with ArrayList and ListView not updating when the arraylist is changed

偶尔善良 提交于 2019-12-31 13:30:22
问题 I have an android app with a screen that comprises of a ListView, which I am using to display a list of devices. These devices are held in an array. I am trying to use the ArrayAdapter to display what is in the array on the screen in a list. It works when I first load the SetupActivity class, however, there is the facility to add a new device in the addDevice() method, which means the array holding the devices is updated. I am using notifyDataSetChanged() which is supposed to update the list

How to keep checkbox selection in cursor adapter when switching cursor?

断了今生、忘了曾经 提交于 2019-12-31 07:30:29
问题 I have a ListView that I'm populating with information from the media store. I have checkboxes on each row to allow the user to select multiple rows. In the options menu, there are menu items that trigger new queries to the media store and using a CursorLoader i swap the cursor in the adapter when the cursor has loaded. In my adapter I'm using an ArrayList that keeps track of the checked items and one that keeps track of all items in the list. The list that keeps track of all items needs to

How to fetch Data From JSON

馋奶兔 提交于 2019-12-31 06:59:03
问题 I have following data from JSON { "MenuName": "starter dish", "SubMenu": [ "pizza dish1", "pizza dish2" ], "Price": [ "100", "110" ] }, From here i can easily fetch data from " Menuname " key as starter dish but when I fetch data from " Submenu " I get whole string as ["pizza dish1", "pizza dish2"] . Please suggest me way to differentiate both pizza dish1 and pizza dish2 回答1: Submenu and Price is not String it is JSONArray so you will need to use for-loop to get all values from Submenu

How to fetch Data From JSON

一个人想着一个人 提交于 2019-12-31 06:58:07
问题 I have following data from JSON { "MenuName": "starter dish", "SubMenu": [ "pizza dish1", "pizza dish2" ], "Price": [ "100", "110" ] }, From here i can easily fetch data from " Menuname " key as starter dish but when I fetch data from " Submenu " I get whole string as ["pizza dish1", "pizza dish2"] . Please suggest me way to differentiate both pizza dish1 and pizza dish2 回答1: Submenu and Price is not String it is JSONArray so you will need to use for-loop to get all values from Submenu

How to start new intent after search-filtering listview?

こ雲淡風輕ζ 提交于 2019-12-31 05:20:31
问题 Hi guys I have a question: I created a listview, with search-bar etc . So when I click on an item (through switch-case) the selected new activity opens and there are no problems. you can see the code here: Filtered list item opens the original list items' activity The problems start when I filter the listview, with the search-bar, and instead of opening the selected activity (let us say activity 10), it throws me back to activity 1 and so forth. What I have figured out so far is that most

How to attach multiple touch actions to a single list item?

醉酒当歌 提交于 2019-12-31 03:56:04
问题 I am using the following list layout for items that have associated comments . The number of comments are indicated by the box on the right side. Currently, I am using the onListItemClick handler to launch another details view. public class CustomListFragment extends ListFragment implements LoaderCallbacks<Cursor> { private Activity mActivity; private CursorAdapter mAdapter; private QueryParameters mQueryParameters; @Override public void onActivityCreated(Bundle savedInstanceState) { super

ListView With Nine-Patch Item Background Issues

百般思念 提交于 2019-12-31 03:08:14
问题 WARNING: The XML in this question is wrong, read the answer before you confuse yourself! I have been banging my head on the wall for a while now. The following posts have shed light on the subject, but failed to solve my issue: Android ListView State List not showing default item background and ListView item background via custom selector The proper nine-patch background shows perfectly when I select the list item, but I can not get the default nine-patch background to show initially. It

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

心已入冬 提交于 2019-12-31 02:41:07
问题 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> { Context context; List<Question> questions; public QuestionsListAdapter(Context context, List<Question> questions){ super(context, R.layout.list_item_question, questions);

How to communicate data between two fragments in a navigation drawer

吃可爱长大的小学妹 提交于 2019-12-31 02:22:08
问题 I have a navigation drawer which contains different fragments (each item display a fragment) and i'd like to pass data from a fragment to another.(I have just one activity that contain a navigation drawer in which a have a list of fragments). I have tried many solutions (Bundle and intent) but I couldn't solve my problem. Can any one help me pleaaase. This is my first Fragment A : package com.tutecentral.navigationdrawer; import android.app.Fragment; import android.content.Context; import

Show next row in listview when previous row's checkbox is checked

北城余情 提交于 2019-12-31 02:20:08
问题 I have Question regarding to Listview and CheckBox I m creating a custom ListView using following JSON data { "title": "Amount Field", "settingItems": [ { "title": "Manual Entry", "type": "boolean", "value": true }, { "title": "Predefined Amount", "type": "Amount", "value": 0.00 }, { "title": "Drop Down Amount Menu", "type": "boolean", "value": false }, { "title": "", "type": "Amount", "value": 0.00 } ] } Using above data I have managed my Listview also At the end of list i.e. at last item of