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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:43:19+00:00 2026-06-03T07:43:19+00:00

I’m making an Android soundboard. I currently have 12 pages for this specific category.

  • 0

I’m making an Android soundboard. I currently have 12 pages for this specific category. Each page has its own activity and each page as 10 buttons.

Someone asked me today why I don’t just use one activity and switch the setcontentview (XML) between the pages rather then having so many activities.

I thought about it and it doesn’t seem like a bad idea. But I’m curious on if it really would be better.

This means that this one activity would have a 100+ switch case statement for its onclick and onlongclick methods. It would have over 200 variables. I would have to add over 200 listeners (although I think i could set the 10 listeners as I load the specific page rather than all at the beginning. I could also release the current ones before the new XML is displayed).

Will Android be able to handle a single activity like this? I plan on adding more sounds so maybe one day I might have 20 pages or so.

  • 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-03T07:43:20+00:00Added an answer on June 3, 2026 at 7:43 am

    Yes, make it all one activity. Different Activities should only really be used for completely different use cases. Consider using a ListView or a GridView, or a ‘ViewPager` inside of one Activity.

    If you do end up using a ListView or anything that takes an Adapter, your Activity should look like this:

    class MyActivity extends Activity{
    
     int mySounds[] = {R.raw.s1, R.raw.s2}; //etc. could also be a 2d array, one for each page of sounds.
    
     protected void onCreate(Bundle b)
     {
       setContentView(R.layout.myactivity);
    
       ListView lv = (ListView) findViewById(R.id.myactivity_listView);
    
       lv.setAdapter(new SoundAdapter(this));
    
     }
    
    class SoundAdapter extends BaseAdapter{
      Context cont;
      SoundAdapter(Context c){
       this.cont = c;
      }
    
      getView(int id, View convertView){
       if(convertView == null){
         ...
         //inflate view to be a row/gridcell
       }
    
       convertView.setOnClickListener(new SoundClickListener(mySounds[id]));
      }
    
    
    
    }
    
     class SoundClickListener extends View.OnClickListener{
    
       int resId;
    
       public SoundClickListener(int resId)
       {
         this.resId = resId;
       }
    
       protected void onClick(View v){
         playSoundWithId(resId);
       }
    
     }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.