how to filter the recycler view card view and show that card on top that is as 1st cardView based on some boolean flag?Strange out of memory issue while loading an image to a Bitmap objectFling gesture detection on grid layoutViewPager PagerAdapter not updating the ViewSwift Beta performance: sorting arraysAndroid - How to create a view like this using recycler view?ANDROID: Multiple Card Views inside recycler viewFiltering CardView with RecyclerView, not updating cards, always showing first cardshow to create recycle view with card view once click card view it's open new fragment activity?how to do something when a particular card is fully loaded in Recycler view?

"I you already know": is this proper English?

Why did Germany launch its spy satellites from Russia?

How to avoid unconsciously copying the style of my favorite writer?

What do I do when a student working in my lab "ghosts" me?

How to judge a Ph.D. applicant that arrives "out of thin air"

Send a single HTML email from Thunderbird, overriding the default "plain text" setting

Why was Sauron preparing for war instead of trying to find the ring?

Where to place an artificial gland in the human body?

Why isn't there a ";" after "do" in sh loops?

Basic Questions on Wiener Filtering

Is it normal practice to screen share with a client?

Character is called by their first initial. How do I write it?

Why does RPM for a fixed-pitch propeller change with an aircraft's pitch?

Examples of simultaneous independent breakthroughs

Can the 2019 UA Artificer's Returning Weapon and Radiant Weapon infusions stack on the same weapon?

High income, sudden windfall

Can two figures have the same area, perimeter, and same number of segments have different shape?

Does academia have a lazy work culture?

Integral of the integral using NIntegrate

Word for showing a small part of something briefly to hint to its existence or beauty without fully uncovering it

Keeping an "hot eyeball planet" wet

Is this photo showing a woman posing in the nude before teenagers real?

What is "I bet" in German?

Assuring luggage isn't lost with short layover



how to filter the recycler view card view and show that card on top that is as 1st cardView based on some boolean flag?


Strange out of memory issue while loading an image to a Bitmap objectFling gesture detection on grid layoutViewPager PagerAdapter not updating the ViewSwift Beta performance: sorting arraysAndroid - How to create a view like this using recycler view?ANDROID: Multiple Card Views inside recycler viewFiltering CardView with RecyclerView, not updating cards, always showing first cardshow to create recycle view with card view once click card view it's open new fragment activity?how to do something when a particular card is fully loaded in Recycler view?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















how to sort/filter recycler view card view and show that card view on top of all card view in android.
I have some boolean flag as true on check of true I need to show that particular card on top as 1st card view then others below and how to achieve this ?










share|improve this question
























  • Should the other items be shown when a new sort query is entered? What is this new query, is it only a Boolean or is it string based sort?

    – Haroun Hajem
    Mar 26 at 17:42











  • yes other item should be shown below , only boolean

    – hema
    Mar 26 at 17:46


















0















how to sort/filter recycler view card view and show that card view on top of all card view in android.
I have some boolean flag as true on check of true I need to show that particular card on top as 1st card view then others below and how to achieve this ?










share|improve this question
























  • Should the other items be shown when a new sort query is entered? What is this new query, is it only a Boolean or is it string based sort?

    – Haroun Hajem
    Mar 26 at 17:42











  • yes other item should be shown below , only boolean

    – hema
    Mar 26 at 17:46














0












0








0








how to sort/filter recycler view card view and show that card view on top of all card view in android.
I have some boolean flag as true on check of true I need to show that particular card on top as 1st card view then others below and how to achieve this ?










share|improve this question
















how to sort/filter recycler view card view and show that card view on top of all card view in android.
I have some boolean flag as true on check of true I need to show that particular card on top as 1st card view then others below and how to achieve this ?







android sorting android-recyclerview android-cardview






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 13:03









Chandrani Chatterjee

1,0587 silver badges20 bronze badges




1,0587 silver badges20 bronze badges










asked Mar 26 at 17:30









hemahema

14 bronze badges




14 bronze badges












  • Should the other items be shown when a new sort query is entered? What is this new query, is it only a Boolean or is it string based sort?

    – Haroun Hajem
    Mar 26 at 17:42











  • yes other item should be shown below , only boolean

    – hema
    Mar 26 at 17:46


















  • Should the other items be shown when a new sort query is entered? What is this new query, is it only a Boolean or is it string based sort?

    – Haroun Hajem
    Mar 26 at 17:42











  • yes other item should be shown below , only boolean

    – hema
    Mar 26 at 17:46

















Should the other items be shown when a new sort query is entered? What is this new query, is it only a Boolean or is it string based sort?

– Haroun Hajem
Mar 26 at 17:42





Should the other items be shown when a new sort query is entered? What is this new query, is it only a Boolean or is it string based sort?

– Haroun Hajem
Mar 26 at 17:42













yes other item should be shown below , only boolean

– hema
Mar 26 at 17:46






yes other item should be shown below , only boolean

– hema
Mar 26 at 17:46













2 Answers
2






active

oldest

votes


















0














Make adapter with multiple view holder and bind specific layout as first as your condition
multiple item recyclerview






share|improve this answer























  • I have singel api response from that response which ever item flag I get true that need to shown on top and rest below

    – hema
    Mar 26 at 17:43












  • how to filter out that particular card view the one with boolean true and show on top

    – hema
    Mar 26 at 17:44



















0














Add the method inside the adaptre, hope it helps:



 public void sortItem() 
ArrayList<Item> items = new ArrayList<>();
Item top =null ;
for(Item item : data)
if(!item.isTop)
items.add(item);
else
top = item;


if(top!=null)
items.add(0, top);

data.clear();
data.addAll(items);
adapter.notifyDataSetChanged();






class Item

public Boolean isTop;




if You want get sorted list right away You can sort the list and submit yo recycler view adaper inside the activity:



ArrayList<Item> items = new ArrayList<>();
Item top =null ;
for(Item item : data)
if(!item.isTop)
items.add(item);
else
top = item;


if(top!=null)
items.add(0, top);

yourAdapter.submitList(items)





share|improve this answer




















  • 1





    I would mark this as a approved answer.

    – Haroun Hajem
    Mar 26 at 17:44











  • where to call sort item method in adapter in bindView holder?

    – hema
    Mar 27 at 2:31











  • @hema if you want get sorted list you can sort the list and submit yo recycler view adaper

    – Serg Burlaka
    Mar 27 at 11:30











  • @hema check my answer again. I have expanded the answer.

    – Serg Burlaka
    Mar 27 at 11:33













Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363059%2fhow-to-filter-the-recycler-view-card-view-and-show-that-card-on-top-that-is-as-1%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Make adapter with multiple view holder and bind specific layout as first as your condition
multiple item recyclerview






share|improve this answer























  • I have singel api response from that response which ever item flag I get true that need to shown on top and rest below

    – hema
    Mar 26 at 17:43












  • how to filter out that particular card view the one with boolean true and show on top

    – hema
    Mar 26 at 17:44
















0














Make adapter with multiple view holder and bind specific layout as first as your condition
multiple item recyclerview






share|improve this answer























  • I have singel api response from that response which ever item flag I get true that need to shown on top and rest below

    – hema
    Mar 26 at 17:43












  • how to filter out that particular card view the one with boolean true and show on top

    – hema
    Mar 26 at 17:44














0












0








0







Make adapter with multiple view holder and bind specific layout as first as your condition
multiple item recyclerview






share|improve this answer













Make adapter with multiple view holder and bind specific layout as first as your condition
multiple item recyclerview







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 26 at 17:41









Ahmad SherazAhmad Sheraz

1




1












  • I have singel api response from that response which ever item flag I get true that need to shown on top and rest below

    – hema
    Mar 26 at 17:43












  • how to filter out that particular card view the one with boolean true and show on top

    – hema
    Mar 26 at 17:44


















  • I have singel api response from that response which ever item flag I get true that need to shown on top and rest below

    – hema
    Mar 26 at 17:43












  • how to filter out that particular card view the one with boolean true and show on top

    – hema
    Mar 26 at 17:44

















I have singel api response from that response which ever item flag I get true that need to shown on top and rest below

– hema
Mar 26 at 17:43






I have singel api response from that response which ever item flag I get true that need to shown on top and rest below

– hema
Mar 26 at 17:43














how to filter out that particular card view the one with boolean true and show on top

– hema
Mar 26 at 17:44






how to filter out that particular card view the one with boolean true and show on top

– hema
Mar 26 at 17:44














0














Add the method inside the adaptre, hope it helps:



 public void sortItem() 
ArrayList<Item> items = new ArrayList<>();
Item top =null ;
for(Item item : data)
if(!item.isTop)
items.add(item);
else
top = item;


if(top!=null)
items.add(0, top);

data.clear();
data.addAll(items);
adapter.notifyDataSetChanged();






class Item

public Boolean isTop;




if You want get sorted list right away You can sort the list and submit yo recycler view adaper inside the activity:



ArrayList<Item> items = new ArrayList<>();
Item top =null ;
for(Item item : data)
if(!item.isTop)
items.add(item);
else
top = item;


if(top!=null)
items.add(0, top);

yourAdapter.submitList(items)





share|improve this answer




















  • 1





    I would mark this as a approved answer.

    – Haroun Hajem
    Mar 26 at 17:44











  • where to call sort item method in adapter in bindView holder?

    – hema
    Mar 27 at 2:31











  • @hema if you want get sorted list you can sort the list and submit yo recycler view adaper

    – Serg Burlaka
    Mar 27 at 11:30











  • @hema check my answer again. I have expanded the answer.

    – Serg Burlaka
    Mar 27 at 11:33















0














Add the method inside the adaptre, hope it helps:



 public void sortItem() 
ArrayList<Item> items = new ArrayList<>();
Item top =null ;
for(Item item : data)
if(!item.isTop)
items.add(item);
else
top = item;


if(top!=null)
items.add(0, top);

data.clear();
data.addAll(items);
adapter.notifyDataSetChanged();






class Item

public Boolean isTop;




if You want get sorted list right away You can sort the list and submit yo recycler view adaper inside the activity:



ArrayList<Item> items = new ArrayList<>();
Item top =null ;
for(Item item : data)
if(!item.isTop)
items.add(item);
else
top = item;


if(top!=null)
items.add(0, top);

yourAdapter.submitList(items)





share|improve this answer




















  • 1





    I would mark this as a approved answer.

    – Haroun Hajem
    Mar 26 at 17:44











  • where to call sort item method in adapter in bindView holder?

    – hema
    Mar 27 at 2:31











  • @hema if you want get sorted list you can sort the list and submit yo recycler view adaper

    – Serg Burlaka
    Mar 27 at 11:30











  • @hema check my answer again. I have expanded the answer.

    – Serg Burlaka
    Mar 27 at 11:33













0












0








0







Add the method inside the adaptre, hope it helps:



 public void sortItem() 
ArrayList<Item> items = new ArrayList<>();
Item top =null ;
for(Item item : data)
if(!item.isTop)
items.add(item);
else
top = item;


if(top!=null)
items.add(0, top);

data.clear();
data.addAll(items);
adapter.notifyDataSetChanged();






class Item

public Boolean isTop;




if You want get sorted list right away You can sort the list and submit yo recycler view adaper inside the activity:



ArrayList<Item> items = new ArrayList<>();
Item top =null ;
for(Item item : data)
if(!item.isTop)
items.add(item);
else
top = item;


if(top!=null)
items.add(0, top);

yourAdapter.submitList(items)





share|improve this answer















Add the method inside the adaptre, hope it helps:



 public void sortItem() 
ArrayList<Item> items = new ArrayList<>();
Item top =null ;
for(Item item : data)
if(!item.isTop)
items.add(item);
else
top = item;


if(top!=null)
items.add(0, top);

data.clear();
data.addAll(items);
adapter.notifyDataSetChanged();






class Item

public Boolean isTop;




if You want get sorted list right away You can sort the list and submit yo recycler view adaper inside the activity:



ArrayList<Item> items = new ArrayList<>();
Item top =null ;
for(Item item : data)
if(!item.isTop)
items.add(item);
else
top = item;


if(top!=null)
items.add(0, top);

yourAdapter.submitList(items)






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 27 at 11:31

























answered Mar 26 at 17:42









Serg BurlakaSerg Burlaka

99410 silver badges20 bronze badges




99410 silver badges20 bronze badges







  • 1





    I would mark this as a approved answer.

    – Haroun Hajem
    Mar 26 at 17:44











  • where to call sort item method in adapter in bindView holder?

    – hema
    Mar 27 at 2:31











  • @hema if you want get sorted list you can sort the list and submit yo recycler view adaper

    – Serg Burlaka
    Mar 27 at 11:30











  • @hema check my answer again. I have expanded the answer.

    – Serg Burlaka
    Mar 27 at 11:33












  • 1





    I would mark this as a approved answer.

    – Haroun Hajem
    Mar 26 at 17:44











  • where to call sort item method in adapter in bindView holder?

    – hema
    Mar 27 at 2:31











  • @hema if you want get sorted list you can sort the list and submit yo recycler view adaper

    – Serg Burlaka
    Mar 27 at 11:30











  • @hema check my answer again. I have expanded the answer.

    – Serg Burlaka
    Mar 27 at 11:33







1




1





I would mark this as a approved answer.

– Haroun Hajem
Mar 26 at 17:44





I would mark this as a approved answer.

– Haroun Hajem
Mar 26 at 17:44













where to call sort item method in adapter in bindView holder?

– hema
Mar 27 at 2:31





where to call sort item method in adapter in bindView holder?

– hema
Mar 27 at 2:31













@hema if you want get sorted list you can sort the list and submit yo recycler view adaper

– Serg Burlaka
Mar 27 at 11:30





@hema if you want get sorted list you can sort the list and submit yo recycler view adaper

– Serg Burlaka
Mar 27 at 11:30













@hema check my answer again. I have expanded the answer.

– Serg Burlaka
Mar 27 at 11:33





@hema check my answer again. I have expanded the answer.

– Serg Burlaka
Mar 27 at 11:33

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363059%2fhow-to-filter-the-recycler-view-card-view-and-show-that-card-on-top-that-is-as-1%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript