How to filter an ArrayList in android using Java

Guide on how to filter Arraylist on android using Java

7 March, 2022

9

9

0

So we all have seen that in android if we want to pass Data from one activity to another we generally do with the Intents and sometimes with bundle.

But sometimes we are in a need of large data filtering from one activity to another, let me clear it. Suppose if you want to filter an arrayList by using just another single activity apart from MainActivity then we are in a big difficulty.

So there is a away that we can do that with intents, but why do we make our code complex to understand if the same thing we can do it with Bundle class.

let me Clear it for you

Whenever we use intent.putExtra() to map the bundle with a name at runtime our application somtimes crashes while filtering the arraylist to another activity

so for that intent.putExtras() is used

Here is the Code to filter an arrayList in mainActivity.Java


Now in another activity we can get this arrayList using the same bundle Activity2.Java


So by doing this way we can filter any type of arrayList in android and we can reduce the use of lots and lots of activities.

java

android

9

9

0

java

android

Hasnain Makada
Elite @Showwcase | Prev: CCO @ShowwcaseHQ | Building out OSWH 👨‍💻 | MLSA - β | DevOps and Flutter 💙 | Blogger at Hashnode and Showwcase 📑

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2025. Showcase Creators Inc. All rights reserved.