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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:49:06+00:00 2026-06-17T22:49:06+00:00

So I generated some button. The numbers it depends on the user (when clicked

  • 0

So I generated some button. The numbers it depends on the user (when clicked a button, create a new one).

This is how I made it:

   RelativeLayout layout = (RelativeLayout) findViewById(R.id.layoutcprompt);
    RelativeLayout.LayoutParams OBJ = new RelativeLayout.LayoutParams (140,80);
    if ((commandsi%6)==0) {adjust=adjust+86; commandsi=1;}
    OBJ.leftMargin =(140*(commandsi-1))+10;
    OBJ.topMargin =250+adjust;
    Button command = new Button(this);
    command.setLayoutParams(OBJ);
    command.setId(ID);
    command.setText(edittxt.getText().toString());
    edittxt.setText("");
    command.setBackgroundResource(R.drawable.costum_button);
    command.setTextColor(Color.WHITE);
    command.setTextSize(14);
    layout.addView(command);
    command.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Button b = (Button)view;
            scommand=b.getText().toString();
        }
    });
    command.setVisibility(View.VISIBLE);

I want to remove/delete them, but I don’t know how…. I gave them a unique id, but I still dunno how can I remove them :/

  • 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-17T22:49:07+00:00Added an answer on June 17, 2026 at 10:49 pm

    I cannot comment another post, but using

    command = new Button(this)
    

    might involve an implicit memory Leak on this! (which can be the Activity). Rather use Context object. Or remove the button at least.

    Then because you have the parent of your Button. Just remove it:

    ViewGroup layout = (ViewGroup) findViewById(R.id.layoutcprompt);
    View command = layout.findViewById(ID);
    layout.removeView(command);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a flash application that will keep track of user generated
I generated some of my C# code with an external tool. Each generated class
We've generated some (well a lot) of classes using HyperJAXB. All of the classes
While renewing iOS Developer program I have found Apple generated some Company ID instead
I am dealing with some generated spans and I would like to find which
I have a form with some generated input fields like theese: <input value=March name=month[March]
I have been given some generated code which looks like so: <form id=form1 method=post
Take the following JSON string (generated by some ExtJS code - but that's irrelevant):
I have a trivia page that is dynamically generated by some javascript code. It
I'm trying to use XSL-stylesheets in order to transform some generated XML-data to HTML-output.

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.