Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8512493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:17:35+00:00 2026-06-11T04:17:35+00:00

I have a array list in which I bind the data This is a

  • 0

I have a array list in which I bind the data
This is a example

MyStrings =new ArrayList<String>();
MyStrings.add("Dog");
MyStrings.add("Cat");
MyStrings.add("Can");
MyStrings.add("Ant");
MyStrings.add("Str");

Now I have a string String sweet="c";
Now what OI want is to filter that Arraylist based on my string(sweet)
so the items of the MyStrings will be only Cat and Can

EDIT
I am really sorry for the trouble I got you but my main problem is that sweet is a editable
Ive tried using this code

      public void onTextChanged(CharSequence s, int start, int before,int count) {  
        //adapter2.getFilter().filter(s);
        //int length = filterEditText.getText().length();
        filterME  = filterEditText.getText();
        List<String> MySortStrings =new ArrayList<String>();
        for(int i=0;i<MyStrings.size();i++)
        {
            String newString = MyStrings.get(i);
            if (newString.startsWith(filterME)){

            }
        }
        //adapter2 = new LazyAdapterGetFriends(MyFriends.this,x);
         //list.setAdapter(adapter2);
    }

using this declaration

    LazyAdapterGetFriends adapter2;
ArrayList<String> MyStrings;
//List<String> MyStrings;
EditText filterEditText;

Sorry for my wrong question..
Foolish me

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:17:37+00:00Added an answer on June 11, 2026 at 4:17 am
    List<String> MyStrings =new ArrayList<String>();
    List<String> MySortStrings =new ArrayList<String>();
    MyStrings.add("Dog");
    MyStrings.add("Cat");
    MyStrings.add("Can");
    MyStrings.add("Ant");
    MyStrings.add("Str");
    String sweet="c";
    for(int i=0;i<MyStrings.size();i++)
    {
        if(MyStrings.get(i).startsWith(sweet.toUpperCase()))
        {
            MySortStrings.add(MyStrings.get(i));
        }
    }
    
    System.out.println(MySortStrings.size());
    

    The list MySortStrings contains the Cat & Can

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an string data array which contains data like this 5~kiran 2~ram 1~arun
I have a Array list which contains Objects of Restaurants ArrayList<Restaurants> array_sort = new
I have an array list of objects in my application. private static ArrayList<Player> userList=new
I have an array list named newSymptomList which contains a list of Symptom id's
I have a collection (or list or array list) in which I want to
So I have this method which will take an ArrayList of Integers, I compare
I have an XML Data Source which contains a list of key/value pairs. I'm
I have a array list which have a list of a type, but all
Hi I have an array list which has some numbers in it like {23,16,45,26,2,5,9}
I have an array that contains a list of vertices which I copy to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.