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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:27:03+00:00 2026-06-07T12:27:03+00:00

I have add buttons in GridView, that buttons add programmatically, the number of buttons

  • 0

I have add buttons in GridView, that buttons add programmatically, the number of buttons depend on word length each button has a character of word and hide that button when click, but i want to delete that when click it.

Here is the code

SpellAdapter.java

public class SpellAdapter extends BaseAdapter{


    public Context context;
    public char[] word;
        public String spellWord1;
    public SpellAdapter(Context context, char[] word, String orglWord)
    {
        this.context=context;
        this.word=word;
        spellWord1 = orglWord;
    }

    public int getCount() {
        count=word.length;
        return count;
    }

    public Object getItem(int position) {

        return null;
    }

    public long getItemId(int position) {

        return 0;
    }


    public View getView(final int position, View convertView, ViewGroup arg2) {

        View v = convertView;
        if (v == null) 
        {  
             LayoutInflater vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             v = vi.inflate(R.layout.buttonlist, null);
        } 

        final Button btn= (Button)v.findViewById(R.id.letterbtn);

        btn.setText(word[position]+"");

        btn.setOnClickListener(new OnClickListener(){

            public void onClick(View v) 
            {
                letters=btn.getText();
                String word = letters.toString();
                btn.setVisibility(View.GONE); // Here invisible the button.

            }


        });

        return v; 
    }   
}
  • 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-07T12:27:08+00:00Added an answer on June 7, 2026 at 12:27 pm

    Don’t provide as many buttons as words.length. Use a different data structure, let’s say a boolean array, that will hold wether or not each button has been clicked once already (all false at start).

    Then when a button is clicked, toggle the boolean value.

    When implementing the getCount method of your adapter, then loop through the array and count any flag indicating that a button still has to be shown.

    Getview will be little more complex : you will receive an index, it will be the number of “false” in your array. So count them and get the right button to display.

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

Sidebar

Related Questions

I have add buttons in GridView using base adapter, that buttons depend on word
I've got a gridview that renders as a table. I have an Add button
I have a gridview and I add some buttons programmatically to this grid. I
I have a code in jquery mobile that will add buttons dynamically in a
I have two ListBoxes, lstAvailableColors and lstSelectedColors. Between each listbox are two buttons, Add
I have two validation groups: parent and child I have an add button that
Basically I have a webcontrol that contains a gridview with an export button. When
I have a gridview with a column of asp buttons that I toggle the
I have a asp gridview with button field column on that button click I
I have a gridview in ASP.net 2.0 that has a small peace of javascript

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.