android-recyclerview

recyclerview not loading adapter values in a fragment

半城伤御伤魂 提交于 2019-12-24 05:53:45
问题 I have a base navigation drawer activity, which will load a fragment. The fragment. The fragment has a recycler view in its layout. The recycler view has an adapter which use Glide to load images from internet. I'm not able to get the image loaded. (Have added the Internet permission in manifest). My Base activity is: import android.net.Uri; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.v4.app.Fragment; import android.support.v4.app

Recyclerview Images Misplacing and disappear while scrolling up/down

本小妞迷上赌 提交于 2019-12-24 05:48:21
问题 I'm retrieving Video thumbnails and displaying it in recycledview's imageview, problem that I'm facing with was Image's getting misplaced and disappeared while Scrolling Up/Down. When I'm using runnable class Recyclarview gets freezes. private static Bitmap retrieveVideoFrameFromVideo(String videoPath) { Bitmap bitmap = null; MediaMetadataRetriever mediaMetadataRetriever = null; try { mediaMetadataRetriever = new MediaMetadataRetriever(); if (Build.VERSION.SDK_INT >= 14) {

Custom Dialog Button called inside RecyclerView's onBindViewHolder

会有一股神秘感。 提交于 2019-12-24 05:35:41
问题 I'm trying to have the OnClick of the Custom Dialog remove and update the item clicked from RecyclerView. final Dialog rightDialog = new Dialog(context1); ... TextView textOKRight = (TextView) rightDialog.findViewById(R.id.text_ok); textOKRight.setText("NEXT"); textOKRight.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // MainAdapter.ViewHolder ccd = new MainAdapter.ViewHolder(itemView, listener); // ccd.removeCaller(); rightDialog.dismiss(); } });

recyclerView does not call the onBindViewHolder when scroll in the view

早过忘川 提交于 2019-12-24 05:06:09
问题 This is what noticed: When it starts, the data item index 0, 1, ..., 5 are displayed in the view. And saw the onCreateViewHolder() and onBindViewHolder() got called for them. Then scroll out the top item, and saw the the onCreateViewHolder() and onBindViewHolder() got called for the index 6. Then scroll down to bring back the item index 0 into view. Since it was not recycled so no onBindViewHolder() is called. This is by design, but having a case would like the onBindViewHolder to be called.

DividerItemDecoration doesn't show up in RecyclerView

人盡茶涼 提交于 2019-12-24 03:27:50
问题 I found that DividerItemDecoration work fine with simple, one line list items, but with more complex one it refuses to show up. Here's the XML of list item: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" android:orientation="horizontal" xmlns:android="http://schemas.android.com/apk/res/android" > <ImageView android:layout_width="60dp" android:layout

RecyclerView adapter custom listener interface

旧时模样 提交于 2019-12-24 02:14:54
问题 I have a RecyclerView with a custom listener that I want to implement in my main activity so that it gets notified when the RecyclerView item gets clicked. However, I'm not sure where to put setMyAdapterListener in the adapter. Where would I put it? public class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private Context context; private List<Data> data; private MyAdapterListener myAdapterListener; public MyAdapter(Context context, List<Object> data) { this.context =

on click RecyclerView go to another activity with data in android

我的未来我决定 提交于 2019-12-24 01:13:27
问题 i am using RecyclerVeiw to display some images and on click its should start New Activity showing id, name of the RecyclerView. I implemented the code but its now working, its not clickable. below is my adapter import android.content.Context; import android.content.Intent; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com

How to implement ViewHolder using sealed class in Kotlin

≡放荡痞女 提交于 2019-12-24 01:12:12
问题 I saw an interesting viewholder implementation in this tweet https://twitter.com/AndroidDev/status/972502799496790018 override fun onBindViewHolder(holder: SealedAdapterViewHolder, position: Int) { return when (holder) { is HeaderHolder -> holder.displayHeader(items[position]) is DetailsHolder -> holder.displayDetails(items[position]) } } Unfortunately i can't figure out how to implement thouse holders. And I didn't find any examples of this trick. In my viewholders I have to extend

How to get respective text and image from the respective recyclerview item in floaty upon clicking a button?

醉酒当歌 提交于 2019-12-24 01:04:51
问题 I'm retrieving some data from Firebase and showing it using RecyclerView . My RecyclerView has cards in it in which the text and images are getting retrieved. The card has a button on it which starts a floaty. The floaty has a ImageView and a TextView in which the image and text from the card from which the button was clicked should be shown. The problem is that when clicking that button of the first card, the floaty is getting started and showing the image and text from that respective card,

refresh fragment after changing data in database

此生再无相见时 提交于 2019-12-24 00:55:59
问题 there is a MainActivity with it's fragment named FragmentOne . i have a List of items in this fragment and these data are save in my database i make changes from NavigationView in MainActivity .. i try to delete all rows from my database. it works, but after that i need to refresh my FragmentOne, how can i refresh the FragmentOne UI ? i have a method named updateUI in my FragmentOne but how could i access that method? when i make that method public everything just goes wrong! i tested