android-recyclerview

How to update my Recyclerview using kotlin android?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 03:25:07
问题 I have an actitvity with Recyclerview which display data. Now I want to update my RecyclerView once got a new data.For now each time I close and reopen my app the new data will be displayed. but i want it without close to update my view. I have tried this, but nothing will work, fun setupViewPager(viewPager: ViewPager, it: List<TransactionEntity>, incoming: TransactionAdapterDirection, mainActivity: MainActivity) { val cc: Context = mainActivity.applicationContext if(adapter.count < 2) { if

like unlike button recyclerView image

不问归期 提交于 2019-12-13 03:12:16
问题 I have an android app in which users can like and unlike an image.I'm using recyclerView.I Just disable the button(Like/Unlike) once user clicked. Problem, when I click on button like , the apps go to main activity and the button Like doesn't change to unlike What I have done : 1 ) layout that holds the each recycler view layout item 2 ) A view holder for creating each layout 3 ) A Model Class to holds the data 4 ) Recycler Adaptor which deals with the data for the Each Layout item Hier ist

Adapter FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? [duplicate]

陌路散爱 提交于 2019-12-13 03:09:25
问题 This question already has answers here : Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? (2 answers) Calling startActivity() from outside of an Activity context (24 answers) Closed 2 years ago . Users albums will be opened when the user is clicked. User's website http://jsonplaceholder.typicode.com/users and album's website http://jsonplaceholder.typicode.com/albums. I want to use intent MainActivity from

how to disable a button when the recyclerview is empty?

拈花ヽ惹草 提交于 2019-12-13 03:06:36
问题 I have a RecyclerView with one text view inside it, and I have one EditText and two buttons ( Add Button & Remove Button ) the RecyclerView takes all the values from the EditText after I press the Add Button , and I delete the last item in the RecyclerView with Remove Button but when the list is empty and I press Remove Button the app crashes. I would like to disable Remove Button when the list is empty. activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=

Execute transaction method using Realm continues to loop on each run android

☆樱花仙子☆ 提交于 2019-12-13 03:05:37
问题 In my app I am using Realm DB to store all the data in local database. I have some initial mock data which I want to show at the starting of the app. Previously I implemented begintransaction method. But after reading the documentation I have implented execute tranasction method. Beacuse this method is updating my new data easily. Now the problem is, whenever I click the option to show the recyclerview, the data is looping each time. for example I have 3 data. If I go back to previous page

android: recycler view adapter

痞子三分冷 提交于 2019-12-13 02:58:09
问题 I am new to recycler view widget , i want to get my data from my api url and list the data into my recycler view , i have these classes : recyclerAdapter , recyclerView , MainActivity , row . the data is loaded from api succesfully but the does not set the json string received from the api in the recycler view , and the recycler view is shown white and empty . any body can find the problem in my code ? MainActivity.java code is : public class MainActivity extends AppCompatActivity { final

How to handle UI changes from interaction with a view when using a RecyclerView?

我是研究僧i 提交于 2019-12-13 02:55:48
问题 If we have a RecyclerView that will have views of different type we can inflate the view we need based on an item type e.g. @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int type) { View view = null; switch (type) { case TYPEX: view = LayoutInflater .from(viewGroup.getContext()) .inflate(R.layout.typex, viewGroup, false); return new ViewHolderX(view); case TYPEY: view = LayoutInflater .from(viewGroup.getContext()) .inflate(R.layout.typey, viewGroup, false); return new

Change recyclerview item background when swiped

一个人想着一个人 提交于 2019-12-13 02:40:16
问题 Hi i am showing vertical list using recycler view and i am using a gradient background for recycler view .I am deleting items in recycler view when they are swiped left or right using ItemTouchHelper . ItemTouchHelper.SimpleCallback simpleCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT|ItemTouchHelper.RIGHT) { @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { return false; } @Override public

NestedScrollView and RecyclerView issues, how to separate them?

故事扮演 提交于 2019-12-13 02:33:28
问题 I'm not sure how to implement this.. I want to use: Collapsing Toolbar "normal" Layout (NestedScrollView) RecyclerView and navigate by the NavigationDrawer (so the layouts come together in my activity_main.xml) The issues comes up when I try to use the RecyclerView - because of the NestedScrollView (yeah, the rule "don't place multiple scrollables together" is true)... But how to achieve this? Is there a possibility to keep the layouts separated in some way? Info : I am replacing the content

Create views programmatically in a RecyclerView.ViewHolder and passing arguments to it

落花浮王杯 提交于 2019-12-13 02:25:57
问题 Can I create views programmatically in a ViewHolder instead of binding them from XML in the classic way as in all examples? Also, my views need an image filepath in order to be created, how do I pass that to the ViewHolder protected static class ImagePreviewViewHolder extends RecyclerView.ViewHolder { public ImageView imageView; public LinearLayout page; public ImagePreviewViewHolder(View itemView) { super(itemView); page = createPage(filePath); // How do I pass the filepath? } } 回答1: Did u