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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:44:41+00:00 2026-05-29T09:44:41+00:00

In the Developer.Android example here what does the newRadioButton.setId(R.id.snack); do? In these examples they

  • 0

In the Developer.Android example here what does the newRadioButton.setId(R.id.snack); do?

In these examples they use variable names that are suppose to help the learner infer what it does. So why did they choose to call it a snack here?
Did they call it a snack to try to lead me to think of it as a radio hint?

Edit Found out they are calling it a ‘snack’ only because the previous example used food themed variables

  • 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-29T09:44:43+00:00Added an answer on May 29, 2026 at 9:44 am

    I don’t know why they called it snack.
    But what the mean with :newRadioButton.setId(R.id.snack);
    that they give it an ID.
    They made the radiobutton on previousd 2 lines, and when you give it an ID, you can use the radiobutton in the code, for example:

    //Making RadioButton
    RadioButton newRadioButton = new RadioButton(this);
    
    //Give the RadioButton an ID
    newRadioButton.setId(R.id.snack);
    
    //making a variable called snack_choice
    RadioButton snackchoice;
    
    //Assign an radiobutton to the variable
    snack_choice = (RadioButton) findViewById(R.id.snack);
    
    //Use it
    if (snack_choice.isChecked()) {
                //do something
            }
    

    I hope you understand it.

    However, I prefer to make buttons in the XML file.

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

Sidebar

Related Questions

I was following some instructions here: http://saigeethamn.blogspot.com/2010/04/custom-listview-android-developer.html The example I'm following shows the list
So I have ran the sample app here: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.html I can't, however, figure out
I'm following the example here: http://developer.android.com/resources/tutorials/views/hello-tabwidget.html Everything works fine. The first time I click
From Android widget screen guidelines, http://developer.android.com/guide/practices/ui_guidelines/widget_design.html , we know that, home screen has 4*4
Extreme Android developer newbie here...well, new to Android development, not development in general. I
Is there something in the Android developer guidelines that disuades developers from providing the
I was following this example: http://developer.android.com/resources/tutorials/views/hello-autocomplete.html And I want to know how I can
I've followed the tutorial here: http://developer.android.com/resources/tutorials/views/hello-gridview.html I'm wondering how I get place text over
I've read the guide about application data backup in Android here http://developer.android.com/guide/topics/data/backup.html , but
Aloha, I've been following the guidelines here: http://developer.android.com/resources/tutorials/testing/helloandroid_test.html To create some simple test cases

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.