android-recyclerview

RecyclerView every few items are the same - expandable item

余生颓废 提交于 2019-12-14 03:48:32
问题 I have a problem with recyclerView. I'm using this layout to expand cardView in recyclerView: https://github.com/AAkira/ExpandableLayout . If I click on some item to expand and than scroll down every 7th element is also expanded. What can I do to stop that effect? I know that this is caused beacause recyclerView remembers state of view holder and mIsViewExpanded in method onBindiewHolder is set to true every 7th item. Thanks in advance for any solutions! Here is code of my viewholder: class

sectionedrecyclerview: Could not create new header dynamically

假装没事ソ 提交于 2019-12-14 03:26:47
问题 I have an activity with two sliding tabs(fragments). I want to create a header for Recyclerview dynamically, so that the user will get a dialogBox with an edittext in it. As soon as user clicks OK after typing the header name in the edittext, the string gets passed from activity to fragment. I have succeeded in transferring header name from activity to fragment using interface. A method in fragment will receive that string. Method: @Override public void setDatainfo(String datainfo) { Log.d(

Using LinearLayout instead of RecyclerView in DrawerLayout

ぐ巨炮叔叔 提交于 2019-12-14 03:23:11
问题 Since I'm using a fixed menu for the navigation drawer I tried to use LinearLayout in DrawerLayout's second child instead of RecyclerView/ListView to make it easier to code. But the result is a full-screen linearlayout. Is there any way to use a regular view (like linearlayout) in DrawerLayout? <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"

Firebase : RecyclerView: No adapter attached; skipping layout

烈酒焚心 提交于 2019-12-14 03:21:32
问题 I just started out with Firebase and its been great so far. However, when I try to hook my data in a card view using Firebase UI and Firebase RecyclerAdapter, I get the following error on my log cat which says $ E/RecyclerView: No adapter attached; skipping layout This is my MainActivity.java package helloworld.firebase.com.helloworld; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import

Multi selection in RecyclerView?

笑着哭i 提交于 2019-12-14 03:04:19
问题 Hello I am trying to implement multi select in recycler view android for showing an icon when clicked on that particular view, I have tried the below code and is working fine for that particular position, however there are other several views that too are getting updated, so please check and let me know what am I missing Here is my adapter code: public class ContactsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{ Context context; ArrayList<String> alContactName, alContactEmail,

How to update RecyclerView on dataset changes?

怎甘沉沦 提交于 2019-12-14 02:51:24
问题 I'm using ActiveAndroid ORM and UltimateRecyclerView in my Android application. I don't know how to display a data in a list using this popular libraries. I know, the data is saved to database correctly. Using the following method, I'm getting a cursor to the data I want to display. public Cursor eventsCursor() { // `Event` is an ActiveAndroid model class String query = new Select() .from(Event.class) .orderBy("time") .toSql(); return ActiveAndroid.getDatabase().rawQuery(query, null); } I

Getitem method in firestore recycler adapter returning null

梦想与她 提交于 2019-12-14 02:24:07
问题 This is the error i get: FATAL EXCEPTION: main Process: neoncore.com.onepiece, PID: 19429 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[])' on a null object reference at com.google.android.gms.internal.zzevb$zza.zza(Unknown Source) at com.google.android.gms.internal.zzevb.zza(Unknown Source) at com.google.android.gms.internal.zzevb.zza(Unknown Source) at com.google.firebase.firestore

Android CursorLoader with selection and selectionArgs[]

孤街浪徒 提交于 2019-12-14 02:17:47
问题 I am using Loader for RecyclerView.Adapter to list items. I want to list specific items from database table. So i did: public Loader<Cursor> onCreateLoader(int id, Bundle args) { String selectionArgs1[]={"1","13","14"}; String selection1 = DatabaseOpenHelper.COLUMN_ID + " in ("; for (int i = 0; i < selectionArgs1.length; i++) { selection1 += "?, "; } selection1 = selection1.substring(0, selection1.length() - 2) + ")"; String[] projection1 =... return new CursorLoader(getActivity()

ListAdapter with DiffUtil.ItemCallback always considers objects the same

拥有回忆 提交于 2019-12-14 02:09:09
问题 I`m trying to use ListAdapter with Room and LifeData. But i faced strange behavior of DiffUtil.ItemCallback - objects are always the same in areContentsTheSame() method. No problem with adding and removing object, but problem with changing the content. Item class: @Entity(tableName = "item") data class Item(var num: Int) { @PrimaryKey(autoGenerate = true) var key: Int = 0 } Adapter class class LifeAdapter : ListAdapter<Item, LifeAdapter.ViewHolder>(DiffCallback()) { private class DiffCallback

How can I shuffle the contents of a RealmResults object

家住魔仙堡 提交于 2019-12-14 01:58:25
问题 I have a RealmResults object which holds output of a .where.findAll() query. I am showing contents of this object in a RecyclerView, but since the contents of the RealmResults object are static, it shows same set of records evertime the RecyclerView is opened. I want to shuffle (randomize) the contents of RealmResults so that I can show different values that are in the RealmResults in my RecyclerView. Please suggest some possible ways in which I can perform the same. 回答1: You should not