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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:28:57+00:00 2026-05-21T11:28:57+00:00

I have 25 buttons in my Layout. What is the efficient way to know

  • 0

I have 25 buttons in my Layout. What is the efficient way to know which button is clicked or to get their IDs ??

Thanks in advance..

  • 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-21T11:28:57+00:00Added an answer on May 21, 2026 at 11:28 am

    i don’t get where is problem

    in layout xml add onClick=”onClick” for every button then in Activity ad function

    public void onClick(View v) {
      switch(v.getId()){
        case R.id.Button1:
          break;
        case R.id.Button2:
          break;
        case R.id.Button3:
          break;
    //....
      }
    }
    

    EDIT (coz i can’t add coment to someone else answer:
    @Zach Rattner

    According to this http://developer.android.com/reference/android/widget/Button.html Zach you’re wrong

    However, instead of applying an
    OnClickListener to the button in your
    activity, you can assign a method to
    your button in the XML layout, using
    the android:onClick attribute

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

Sidebar

Related Questions

I have 3 buttons on each layout. When i clicked on button MOH in
I have a linear layout with several buttons in it. The button images are
I have Buttons attached to elements on the modules entrypoint html page using RootPanel.get(foo).add(button)
In my layout xml file I have several buttons like this which share the
Ok, i have two buttons in linear layout: <LinearLayout android:id=@+id/linearLayout1 android:layout_height=wrap_content android:layout_width=fill_parent> <Button android:id=@+id/aktiviraj_paket
How to align the buttons bottom of the screen.In the layout i have header
I have a listView, where each row has a button in the row layout.
I have buttons on a page that look like: <p> <a href=view.php> <input type=button
I have some buttons in an UIView. My problem is, that they get cut
i have one main relative layout in that i have buttons and in middle

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.