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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:39:30+00:00 2026-05-24T09:39:30+00:00

i need to create around 26 buttons for simple task like display alphabets. i

  • 0

i need to create around 26 buttons for simple task like display alphabets. i can do this by using layout design.

if i create this button at run time will it give more performance(Considering memory, speed,apk size!)?

Important Requirements:

  • this layout will be used by 4 different activities.
  • I need to display 26 buttons at a time to user.
  • These button may contain background
    image.

edit: This layout is like pop up window for other four activities. user can press any alphabets in this layout. As soon as alphabets get selected layout will be closed

  • 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-24T09:39:31+00:00Added an answer on May 24, 2026 at 9:39 am

    Yikes. While XML is the best practice answer, 26 of anything screams for some dynamic run-time creation, or at least a combination of the two. You’re not going to see much difference in processing time or apk size either way – it will come down to code maintenance down the line.

    For instance, consider what will happen when you want to change or add a new attribute, say padding, for each of your letter buttons. Do you want to have to manually go change all those XML elements, or think about a clever regex to properly find/replace?

    I’d go with a combination of styles, <include> statement, and run time modification for a comprehensive, maintainable solution. First create a single button styled how you think you want all your buttons to look. Extract your “LetterButton” style out to style.xml and use the android:style="@style/LetterButton" attribute on your button instead. This will allow you to change your style in a single file and have it affect all your letter buttons.

    Next, extract the button itself into an <include> file. You can do this by right clicking on the GUI version of the button and choosing “Extract include…”. Then arrange your <include>-buttons however you need to, perhaps in a <TableLayout>. Make sure you give each one a unique id, like @+id/letter_button_0 up through _25. The text attribute for all these buttons can be anything, you’ll set those dynamically later.

    Finally, in your onCreate, define an array of ints of the form {R.id.letter_button_0, …}, and an array of Strings of the form {“A”, …}, and iterate over those, doing a button = findbyId(int), button.setText(String) to put a letter on each of your buttons.

    It may seem like more work this way, but you’re doing all the heavy lifting creating a smart UI, so that down the line you can change code in a single place (style or include) and all your buttons will be updated.

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

Sidebar

Related Questions

I need to create an XML schema that looks something like this: <xs:element name=wrapperElement>
I am working on a project where I need to create a boundary around
I need to create control to draw border around its child. So, I have
I need to create a custom application domain to work around a bug in
Need to create a custom DNS name server using C which will check against
I need to create a round navigation system, similar to the round nav button
I'm looking to add a tweet this button to a site. Simple enough, right?
Hi When I create a button in swing it adds a border around my
I need create custom dialog and put JPanel into it. Is it possible?
i need create an email list sending to many emails. what is best solution

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.