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 7009305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:50:43+00:00 2026-05-27T21:50:43+00:00

i have a list view with a search bar, i want to sort the

  • 0

i have a list view with a search bar, i want to sort the items as i type the text in the edit text. i have been trying to do it whole day but was not able to complete, can you guys help me do it. i would be grateful to you thanks in advance

  • 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-05-27T21:50:43+00:00Added an answer on May 27, 2026 at 9:50 pm

    please refer this code

    package com.android.swfPlayer;
    
    import java.util.ArrayList;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.text.Editable;
    import android.text.TextWatcher;
    import android.util.Log;
    import android.widget.ArrayAdapter;
    import android.widget.EditText;
    import android.widget.ListView;
    
    public class SwfAndroidActivity extends Activity {
        /** Called when the activity is first created. */
        private EditText edtField;
        ListView l1;
        ArrayList<String> array = new ArrayList<String>();
        ArrayList<String> type_name_copy = new ArrayList<String>();
        String[] array1 = { "abd", "bcd", "cdg", "sada", "fs", "fsf", "fsf" };
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            array.add("abd");
            array.add("bcd");
            array.add("cdg");
            array.add("sada");
            array.add("abd");
            array.add("fs");
            array.add("fsf");
            array.add("afsf");
    
            l1 = (ListView) findViewById(R.id.listView1);
            edtField = (EditText) findViewById(R.id.editText1);
            listUpdate(array);
    
            edtField.addTextChangedListener(new TextWatcher() {
                @Override
                public void onTextChanged(CharSequence s, int start, int before,
                        int count) {
                }
    
                @Override
                public void beforeTextChanged(CharSequence s, int start, int count,
                        int after) {
                }
    
                @Override
                public void afterTextChanged(Editable theWatchedText) {
                    ArrayList<String> type_name_filter = new ArrayList<String>();
    
                    String text = theWatchedText.toString();
    
                    for (int i = 0; i < array.size(); i++) {
    
                        if ((array.get(i).toLowerCase()).contains(text
                                .toLowerCase())) {
                            type_name_filter.add(array.get(i));
    
                        }
                    }
    
                    type_name_copy = type_name_filter;
    
                    listUpdate(type_name_copy);
                }
            });
    
        }
    
        public void listUpdate(ArrayList<String> data) {
            l1.setAdapter(new ArrayAdapter<String>(this,
                    android.R.layout.simple_list_item_1, data));
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this list view that is taking up the whole page. I want
I have a list view and above that one edit text. In edit text,
I want to implement search bar in my application which will filter list view
I have a list view with 10 columns and I want each row to
I have a list view that displays a collection of items, each item has
I have a list view full of items that contain multiple widgets each such
I have implemented a Custom List View which displays text along with image. The
I have list view and its adapter stored as global variables. I am not
In my application, I have list view. Selecting another item in it, triggers an
I have a list view binded to a data source. How can I enable

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.