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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:36:29+00:00 2026-06-05T11:36:29+00:00

In my application , I am dynamically generating two linearlayouts and adding them to

  • 0

In my application , I am dynamically generating two linearlayouts and adding them to ScrollView.

Each LinearLayout has a Button and an Edit Text, I want that when the Button of the second LinearLayout is clicked , the 1st Linearlayout gets disabled .

Code:

package com.integrated.mpr;

import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;


public class Page1 extends Activity implements OnClickListener{

    int i;
    int[][] id = new int[pos][3];

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        int p =0;
        Log.d("value of ", ""+pos);
        for(int i =0;i<2;i++){
            for(int j =0;j<3;j++){
                id[i][j] = p;
                p++;
            }
        }

        //In each row 1st column is the id for button
        //2nd column id for edittext
        //3rd column id for Linearlayout

        ScrollView sv = new ScrollView(this);

        LinearLayout ll = new LinearLayout(this);
        ll.setOrientation(LinearLayout.VERTICAL);

        for(i=0;i<2;i++){

            LinearLayout llay = new LinearLayout(this);
            llay.setOrientation(LinearLayout.VERTICAL);
            llay.setId(id[i][2]);

            EditText et = new EditText(this);
            et.setId(id[i][1]);

            Button stop = new Button(this);
            stop.setText("Submit");
            stop.setId(id[i][0]);
            stop.setOnClickListener(this);

            llay.addView(et);
            llay.addView(stop);
            ll.addView(llay);

        }

        sv.addView(ll);
        this.setContentView(sv);

    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub

        if(v.getId()==id[1][0]){
            //when te second Button is clicked
            // now here disable the 1st linear layout
            //Can't think how to do it
        }

        }
}
  • 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-05T11:36:31+00:00Added an answer on June 5, 2026 at 11:36 am

    Get your LinearLayout and set it to View.GONE

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
    
        if(v.getId()==id[1][0]){
            LinearLayout ll = (LinearLayout) findViewById(id);
            ll.setVisibility(View.GONE);
        }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am having a application where i am generating the uibuttons dynamically want to
In my application , I am dynamically generating a linearlayout that contains an edittext
Our application has many controls that are created dynamically. For example, a navigation pane
I am developing an application using WPF to dynamically render content, including text and
I have an application which loads up c# source files dynamically and runs them
I am developing a web application such a way that my codes dynamically generating
I'm having an issue with my android application. I want to dynamically create 4
I want to get the absolute root Url of an ASP.NET application dynamically. This
I am creating an asp.net mvc 2 application generating my view model dynamically depending
In my sharepoint web-part application. I am dynamically generating LinkButtons as below. and this

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.