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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:44:45+00:00 2026-06-15T19:44:45+00:00

I have a ListView with a BaseAdapter , I want to make a filter

  • 0

I have a ListView with a BaseAdapter , I want to make a filter after the filed tipdoc,and my code doesn’t work ,I mean nothing is heapen when start to write in the EditText and I can’t find why,This is my code:

listView = (ListView) findViewById(android.R.id.list);
    adapter = new ImageAndTextAdapter(Documente.this, R.layout.list_row,nume,tipdoc,formatdoc);
    listView.setAdapter(adapter);
    edt = (EditText) findViewById(R.id.search_box);

    edt.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
            // When user changed the Text
             ArrayList<String> nume_sort = new ArrayList<String>();
             ArrayList<String> tipdoc_sort = new ArrayList<String>();
             ArrayList<String> formatdoc_sort = new ArrayList<String>();

            int textlength = edt.getText().length();
            nume_sort.clear();
            tipdoc_sort.clear();
            formatdoc_sort.clear();

            for (int i = 0; i < tipdoc.size(); i++)
            {
             if (textlength <= tipdoc.get(i).length())
             {
              if (edt.getText().toString().equalsIgnoreCase((String)      tipdoc.get(i).subSequence(0, textlength)))
              {
               tipdoc_sort.add(tipdoc.get(i));
              }
             }
            }

            listView.setAdapter(new ImageAndTextAdapter
             (Documente.this, R.layout.list_row,nume_sort,tipdoc_sort,formatdoc_sort));
        }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                int arg3) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable arg0) {
            // TODO Auto-generated method stub
        }
    });
}


  private class ImageAndTextAdapter extends BaseAdapter{
 private Context adContext;
 public int getCount() {
     return nume.size();
 }               
 public ImageAndTextAdapter(Context context,int layout,ArrayList<String> nume,ArrayList<String> tipdoc,ArrayList<String> formatdoc)
  { 
     super();
        this.adContext = context;
  }

 public View getView(int pos, View inView, ViewGroup parent){
     View v = inView;
     if (v == null) {
         LayoutInflater inflater = (LayoutInflater)adContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         v = inflater.inflate(R.layout.list_row, null);
     } 

     String num = String.format(nume.get(pos));
     ((TextView)v.findViewById(R.id.Nume)).setText(num);    
     String tdoc = String.format(tipdoc.get(pos));
     ((TextView)v.findViewById(R.id.TDoc)).setText(tdoc);
     if (formatdoc.get(pos).equals("doc")){
     ((ImageView)v.findViewById(R.id.list_image)).setImageResource(R.drawable.doc);
     }
     else if (formatdoc.get(pos).equals(".xlsx") || formatdoc.get(pos).equals("xls")) ((ImageView)v.findViewById(R.id.list_image)).setImageResource(R.drawable.xls);
     else ((ImageView)v.findViewById(R.id.list_image)).setImageResource(R.drawable.pdf);


     return v;
 }
@Override
public Object getItem(int position) {
    // TODO Auto-generated method stub
    return null;
}
@Override
public long getItemId(int position) {
    // TODO Auto-generated method stub
    return 0;
} 
 }
  • 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-15T19:44:46+00:00Added an answer on June 15, 2026 at 7:44 pm

    you have to change the value of nume var,because in your code its the same

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

Sidebar

Related Questions

I have created a BaseAdapter for a ListView. I want to order the elements
I have a listview, baseadapter and data from SQLite, including a BLOB. What if
HI Guyz i have created a sectioned custom listview using baseadapter its working fine
I have listview control.There is an option to remove selected items.After the user removes
I have a ListView with a custom list adapter (that extends BaseAdapter). My list
I have facing problem in listview i am getting data from server and after
i have a listView with a custom BaseAdapter.Every list item has a clickable button.
I have implemented an adapter for my ListView which extends BaseAdapter. My list items
I want get data in db to listview. but it have error I cannot
I have a listview that uses a customadapter based on the baseadapter. The listview

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.