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

  • Home
  • SEARCH
  • 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 9112503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:45:03+00:00 2026-06-17T03:45:03+00:00

I have two gridView, two ArrayList data and two differen ArrayAdapter, but why I

  • 0

I have two gridView, two ArrayList data and two differen ArrayAdapter, but why I see the same data both of them – “2”?

data1.add("1");
ArrayAdapter<String> listAdapter1 = new ArrayAdapter<String>(this,  R.layout.item3, R.id.editText1, data1) {
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.item3, null);
        }
        final String theData = getItem(position);
        final EditText editText = (EditText) convertView.findViewById(R.id.editText1);
        editText.setText(theData);
        editText.addTextChangedListener(new MyTextWatcher(position));                   
        return convertView;
    }
};
gvMain1.setAdapter(listAdapter1);

data2.add("2");
ArrayAdapter<String>  listAdapter2 = new ArrayAdapter<String>(this,  R.layout.item3, R.id.editText1, data2) {
    @Override
    public View getView(final int position, View convertView, ViewGroup parent){
        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.item3, null);
        }
        final String theData = getItem(position);
        final EditText editText = (EditText) convertView.findViewById(R.id.editText1);
        editText.setText(theData);
        editText.addTextChangedListener(new MyTextWatcher(position));                   
        return convertView;
    }
};
gvMain2.setAdapter(listAdapter2);
  • 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-17T03:45:05+00:00Added an answer on June 17, 2026 at 3:45 am

    I create class:

    public class MyArrayAdapter extends ArrayAdapter<String> {
        private final Activity context;
        private final ArrayList<String> names;
    
        public MyArrayAdapter(Activity context, ArrayList<String> names) {
            super(context, R.layout.item3, names);
            this.context = context;
            this.names = names;
        }
    
        static class ViewHolder {
    
            public EditText editText;
        }
    
       public ArrayList<String> getData()
       {
           return this.names;
       }
    
    
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
    
            ViewHolder holder;
    
            View rowView = convertView;
            if (rowView == null) {
                LayoutInflater inflater = context.getLayoutInflater();
                rowView = inflater.inflate(R.layout.item3, null, true);
                holder = new ViewHolder();
                holder.editText  = (EditText) rowView.findViewById(R.id.editText1);
                rowView.setTag(holder);
            } else {
                holder = (ViewHolder) rowView.getTag();
            }
    
            holder.editText.setText(names.get(position));
            holder.editText.addTextChangedListener(new MyTextWatcher(position));    
            return rowView;
        }
        class MyTextWatcher implements TextWatcher 
        {
            private int position;
    
            public MyTextWatcher(int position) 
            {
                    this.position = position;
            }
    
            public void afterTextChanged(Editable s) 
            {
                names.set(position, s.toString());
            }
    
            @Override
            public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,int arg3) 
            {
            }
    
            @Override
            public void onTextChanged(CharSequence arg0, int arg1, int arg2,int arg3) 
            {
            }
    
       }
    }
    

    And call it from my activity:

     final MyArrayAdapter myAd1=new MyArrayAdapter(this,data1);
    final MyArrayAdapter myAd2=new MyArrayAdapter(this,data2);
         gvMain1.setAdapter(myAd1);
         gvMain2.setAdapter(myAd2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ListView that uses a GridView to display several columns of data. Two
I have two gridView the same size. How to do synchronous scrolling. Could I
I have two Devexpress gridview in a page. I tried binding data to devexpress
I have two template fields in my data gridview. One template field is a
I have two tables/entities, event and eventRegistrations. I have a gridview showing events, but
I have two cascading dropdowns and one gridview control. on page load iam binding
I have a gridview that displays items details, I added two template fields one
I have two columns say Main and Sub . (they can be of same
Is there a way to have two rows in GridView footer?
I have two tables I am using to fill a gridview. The tables have

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.