android-adapter

Implementing multi selection in Android RecyclerView

谁说我不能喝 提交于 2019-12-08 03:56:53
问题 I need some help with Multi/Single selection. Found what I was looking for here, because of its simplicity. I'm using a GridLayoutManager I have over 90 items in my adapter, a CardView with a TextView and an ImageView , while using the procedure described in the post. When I select one, or more than one item, as I scroll down, other items "seems" to be selected because the background replicates, but they are not selected. Tried placing the setOnClickListener , in onBindViewHolder and also in

How to get the selected Tab of a viewPager?

风流意气都作罢 提交于 2019-12-08 02:06:13
问题 I created a viewpager using the lib viewpagerindicator. The activity extends FragmentActivity, so I have a problem to get which tab is selected. My adapter is given by the code below. class GoogleMusicAdapter extends FragmentPagerAdapter implements IconPagerAdapter { public GoogleMusicAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { // add each fragment in the right place if(position == 0){ // return TestFragment.newInstance(CONTENT[(position + 1) %

Android - why lost values EditText when scrolled RecyclerView?

ⅰ亾dé卋堺 提交于 2019-12-07 21:31:20
问题 I am using from bellow code for converting numbers to currency format when text changes but when I scrolled the recyclerView I lost true data. What can I do : public class ManagePriceProductsAdapter extends RecyclerView.Adapter<ManagePriceProductsAdapter.ViewHolder> { private List<ManagePriceProductsModel.DataValue> managePriceProductsModelList; private Context context; private getListDiscountInterface getListDiscountInterface; private int vendorId = -1; public ManagePriceProductsAdapter

wrong images are displaying first and then correct images are displaying during scrolling of listview

寵の児 提交于 2019-12-07 12:24:19
问题 I am using listview with images in my application.But whenever I scroll the list the wrong images are shown first and then the correct images are displaying.I dont know why it is happening like this.I think already loaded images are displaying until the position is set. Here is my adapter class,please help me where I am going wrong public class MySimpleArrayAdapter extends ArrayAdapter<String> { private Activity context; ArrayList<String> namear,msgar,idar,profimage,postimage,commentsnum

HorizontalScrollView: CustomAdapter with getView() doesn't reuse convertViews like ListView

无人久伴 提交于 2019-12-07 12:22:46
问题 In one of my past projects I implemented a "Time Picker Carousel". It is based on a HorizontalScrollView . The user can pick a time while scrolling this view. The time value is calculated from the X-Offset of the HorizontalScrollView . I wanted to share this project at github, but while cleaning up the code I realized some bad performance issue. The HorizontalScrollView is populated with a custom ArrayAdapter . The getView() uses a Holder for the convertView . I thought it might work as an

RecyclerView No adapter attached; skipping layout, Data not showing

懵懂的女人 提交于 2019-12-07 09:52:29
I'm making a music player application where I'm using a loader to load song data to the adapter which is to be shown using a RecyclerView. However, I'm getting this weird error of my adapter methods not working. Only the constructor method of adapter is getting called. I'm also getting "No adapter attached; skipping layout" despite going through all the available solutions here in stack overflow. Few points to be noted: I've tried all the solutions for "No adapter attached; skipping layout" in recyclerview No adapter attached; skipping layout thread and all associated duplicate threads. The

Absolute position in BaseAdapter of GrivView

微笑、不失礼 提交于 2019-12-07 07:23:40
问题 I'm trying to write BaseAdapter to my GrivView but in public View getView(int position, View convertView, ViewGroup parent) { ... } the position while rendering next elements is: visible elements --------------- | 1 2 3 | | 4 5 6 | <--- screen | 7 8 9 | --------------- nonvisible elements | 1 2 3 | <-- below visible area | 4 5 6 | where real is: visible elements --------------- | 1 2 3 | | 4 5 6 | | 7 8 9 | --------------- nonvisible elements | 10 11 12 | | 13 14 15 | I'm aware it's correct

Set ListView Height dynamically based on multiline textview inside it

被刻印的时光 ゝ 提交于 2019-12-07 02:53:41
问题 I am using a base adapter to set data in a listview dynamically. I tried to set listview height dynamically. It works perfectly if the textview inside it is single line. However if the textview is multiline, the height is not set properly. The height is set considering single line textview only. How can I set correctly set the height of listview items containing multiline textview. Here's the code: Fragment code: ListView mlistNews=(ListView)rootView.findViewById(R.id.news_listView);

Force RecyclerView to call onCreateViewHolder

Deadly 提交于 2019-12-07 01:55:20
问题 I have a RecyclerView that can show items as list, small grids or large grid and this can be change at runtime. Depending on what style user chooses i inflate different layout in onCreateViewHolder . I also use layoutManger.setSpanSizeLookUp() to switch between styles. My code looks like this layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { if(showType == ProductAdapter.SHOW_TYPE_SMALL_GRID) return 1; else return

ListView like in universal image loader sample app

别来无恙 提交于 2019-12-07 01:34:47
问题 I am using universal image loader for displaying thumb images in the list view. I have implemented the basic steps in the adapter and everything is working. The problem is if i have 10 items in the list and i can see first 5 as soon as i scroll down new images are displayed but when i scroll back up the images are replaced again with correct once , what i want is first 5 images which are shown at the starting should not be replaced . So that when i scroll back up and down the images are not