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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:13:51+00:00 2026-05-30T07:13:51+00:00

hi i am doing one app here when i click button that time i

  • 0

hi i am doing one app here when i click button that time i need to disaply a to z values in one textview radomly.in textview each time i need to display one value only.so i using one string array i disply in text view one value.and apply random fun also it working fine.then same page another place i need to disply some buttons like a,b,c….z.using anthoer string array i displyed those buttons.but the problem is when i click ‘a’ button means that time i need to compare button value to textview value, now in first button ‘a’ is there that in textview also ‘a’ is there means i need to perform some action like button should be highlet.button and textview values not equles means i need perform nothing. i treid using below code but i i am not getting.please can u any one suggest me…

   ButtonList .class:

        public class ButtonList extends Activity implements OnClickListener{
    /** Called when the activity is first created. */
     private static final Random rgenerator = new Random();
         String[] dishes = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j"};
      String[] dishes1 = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j"};
       String q = dishes1[rgenerator.nextInt(dishes1.length)];
            LinearLayout linear;
         TableLayout table;
       int dishQuantity =10;
       TextView text1;
          Button[] plus = new Button[dishQuantity];
          TableRow[] row = new TableRow[dishQuantity];
           String s1,s2;
          @Override
         public void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
                linear = new LinearLayout(this);
              text1 =new TextView(this);
         text1.setText(q);
                s1=text1.getText().toString();
                  table = new TableLayout(this);
                         linear.setOrientation(LinearLayout.HORIZONTAL);
                      for (int i=0; i<dishQuantity; i++) {
                      row[i] = new TableRow(this);
               plus[i] = new Button(this); 
                         plus[i].setText(dishes[i]);
                          plus[i].setOnClickListener(this);
                      row[i].addView(plus[i]);
                           table.addView(row[i],60,30);
                        s2=plus[i].getText().toString();
                }
                        linear.addView(table);
                    linear.addView(text1); 
                          setContentView(linear);
          }
              public void onClick(View v) {
                // TODO Auto-generated method stub
                     if (s1.equals(s2)) {

                         ((Button) v).setEnabled(false);
                          }

                 }
              }
  • 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-05-30T07:13:52+00:00Added an answer on May 30, 2026 at 7:13 am

    It nice if you get text from textview and button at on button’s click,

    public void onClick(View v) {
                    // TODO Auto-generated method stub
    s2 = ((Button) v).getText().toString();
    s1 = text1.getText().toString();
    
    if (s1.equals(s2)) {
        ((Button) v).setEnabled(false);
        }
       }
    
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one console app that is doing some lengthy syncing to an ftp
We are doing some optimization of our app that heavily uses EWS and one
Some people have suggested that when doing an estimate one should make a lower
Okay, here's my situation. I have a WPF app that I have created that
So here's a weird one. I've been doing a combination of interface builder and
I can't create more than one table on a Chrome App dadabase Here is
In one area of my application I am creating a display that builds itself
I m doing unit test for one of my app in WP7. I want
I'm doing one research on video encoding tools for flv. I tested flvtool2 and
i am doing one small application , wheich have login functionality, in the user

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.