custom-adapter

Implement Expandable ListView using Custom Adapter

浪尽此生 提交于 2019-11-30 05:24:05
问题 I want to implement a custom adapter for Expandable ListView which consist of an ImageView, and 2 TextViews. I have successfully implemented the Simple Expandable ListView with Array Adapter. What changes must be done in the following two classes (first class is Adapter class and second is the Activity to display Expandable ListView) to implement the desired Custom Layout? Below are classes that need to be changed: Below is the Adapter Class: package com.example.travelplanner; import java

The OnCheckChanged listener works only for the first checkbox in a customlistview

a 夏天 提交于 2019-11-29 17:35:36
The listener for checkbox in my custom listview works only for the first checkbox. I think this has something to do with the position in getView(). I'm attaching my code with this question please suggest me a work around for this problem. public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder holder; LayoutInflater inflater = context.getLayoutInflater(); if(convertView==null) { convertView = inflater.inflate(R.layout.custom_list, null); holder = new ViewHolder(); holder.txtViewTitle = (TextView) convertView.findViewById(R.id.title_text); holder

notifyDataSetChange not working on RecyclerView [duplicate]

孤街醉人 提交于 2019-11-29 16:08:55
问题 This question already has an answer here: Update ListView in the main thread from another thread 6 answers I'm working with Android's new RecyclerView but I can't get my custom adapter to refresh whenever I call one of the "notify" methods. I've tried calling notifyDataSetChanged, notifyItemRangeInserted and notifyItemInserted and none of them seem to work. Here's the code for my custom adapter. I'm basically trying to refresh a list of Strings: package com.mycompany.myapp.adapters; import

Repeating items in ListView?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 07:45:23
Everything was working fine but now I am not getting what is happening,I have 10 items to display in the listView,its working fine till the 6th item and after that it repeats again from the 1st item again?? public class GroupDetailsAdapter extends BaseAdapter { List<GetSetGroupDetails> group_details = new ArrayList<GetSetGroupDetails>(); Context context; Typeface face; public GroupDetailsAdapter(List<GetSetGroupDetails> group_details, Context context) { super(); this.group_details.clear(); this.group_details = group_details; this.context = context; face = Typeface.createFromAsset(context

Storing the state of checkbox in listview while using custom BaseAdapter in android?

倾然丶 夕夏残阳落幕 提交于 2019-11-29 00:44:01
i have a listview which is having image, text and checkbox i have inflated this using BaseAdapter. i want to send only those images which are selected but how to store the state of checkbox ? may be i am wrong as i am using baseadapter. you can suggest any other way to do that. please look below my Baseadapter class ImageInfoAdapter extends BaseAdapter{ @Override public int getCount() { if(viewcount == 0){ return 0; } return viewcount; } @Override public Object getItem(int position) { return isSentAlList.get(position); } @Override public long getItemId(int position) { return position; }

AutoCompleteTextView with Custom Adapter filtering not working

半腔热情 提交于 2019-11-28 13:02:59
I have a autocomplete text view in my android project which is working fine but it only works if first value is entered in it. So for making it more customizable, I have added the below class public class CustomArrayAdapterWIthFilter extends ArrayAdapter<String> implements Filterable { List<String> items = null; List<String> originalItems = null; private MyFilters myFilters = null; Context mContext; public CustomArrayAdapterWIthFilter(@NonNull Context context, @LayoutRes int resource, @NonNull List<String> objects) { super(context, resource, objects); this.items = new ArrayList<>(); items

Onclicklistner not working in fragment listview

假装没事ソ 提交于 2019-11-28 12:28:07
I have a listview with custom adapter in listfragment and also set onclicklistner for listview. But Onclicklistner does not work. Here is my code: public class BasicFragment extends ListFragment { ListView lv; MyCustomAdapter adapter; @Override public void onCreate(Bundle si) { super.onCreate(si); } @Override public void onActivityCreated(Bundle b) { super.onActivityCreated(b); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_basic, container, false); lv = (ListView) view.findViewById

Loading Image using AsyncTask

夙愿已清 提交于 2019-11-28 06:15:08
问题 I am trying to create a custom List Adapter which has an Image for every item it needs to download from the internet. When I first enter the Activity - the app freezes for a while till the images are downloaded and then the Activity List is loaded. As I can make out the images are being downloaded before the activity loads. How can I download the images after the activity has loaded. I think I need to use Async Task. But since I am loading the images in the Custom Array Adapter not sure how

Repeating items in ListView?

限于喜欢 提交于 2019-11-28 01:26:51
问题 Everything was working fine but now I am not getting what is happening,I have 10 items to display in the listView,its working fine till the 6th item and after that it repeats again from the 1st item again?? public class GroupDetailsAdapter extends BaseAdapter { List<GetSetGroupDetails> group_details = new ArrayList<GetSetGroupDetails>(); Context context; Typeface face; public GroupDetailsAdapter(List<GetSetGroupDetails> group_details, Context context) { super(); this.group_details.clear();

search a value from sqlite database and retrieve in listview

£可爱£侵袭症+ 提交于 2019-11-27 21:44:23
How to find the exact data in sqlite database and retrieve it in a listactivity ? I tried like this but I didn't get the value. search = (EditText) findViewById(R.id.alertsearch); search.addTextChangedListener(new TextWatcher(){ @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub list2.clear(); db = openOrCreateDatabase(Contactsnew.DB_NAME, MODE_PRIVATE, null); Cursor cTitle=db.rawQuery(" SELECT * FROM "+ Contactsnew.TABLE02 + " WHERE " + Contactsnew.userid + " = " + GetSet.getUserId() + " AND " + Contactsnew.TITLE + " LIKE ? " ,new String []{search.getText(