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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:09:44+00:00 2026-05-20T05:09:44+00:00

i’m dooing this tutorial and at one point he uses the R.id.xxxx where x

  • 0

i’m dooing this tutorial and at one point he uses the R.id.xxxx where x is the name/id of a control I’m using, if I understood it correctly.

Now I have two of those R thing’s -.-‘ and one is android.R and the other is dk.ilizane.android.temperatur.R which doesn’t contain any id at all so I kinda figured I will be using android.R.id but i’m looking for editText1, radio0, radio1 and it doesn’t contain any of those.

Is there anyone kind enough to try explain this to me? I’m trying to learn this so I would appreciate if the answer wasn’t just the correct code but an answer which I can

My code:

package dk.ilizane.android.temperatur;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Toast;

public class Omregn extends Activity 
{
    private EditText text;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        text = (EditText) findViewById(android.R.id.editText1);
    }

    public void myClickHandler(View view) {

    switch (view.getId()) 
    {
    case android.R.id.button1:
        RadioButton celsiusButton = (RadioButton) findViewById(dk.ilizane.android.temperatur.R);
        RadioButton fahrenheitButton = (RadioButton) findViewById(android.R.id.radio1);
        if (text.getText().length() == 0) 
        {
            Toast.makeText(this, "Please enter a valid number", Toast.LENGTH_LONG).show();
            return;
        }
        float inputValue = Float.parseFloat(text.getText().toString());
        if(celsiusButton.isChecked()){
            text.setText(String.valueOf(convertFahrenheitToCelsius(inputValue)));

        }else {
            text.setText(String.valueOf(convertCelsiusToFahrenheit(inputValue)));
        }
        if(fahrenheitButton.isChecked()){
            fahrenheitButton.setChecked(false);
            celsiusButton.setChecked(true);
        }
        else
        {
            fahrenheitButton.setChecked(true);
            celsiusButton.setChecked(false);

        }
        break;
    }

    }
    private float convertFahrenheitToCelsius(float fahrenheit){
        return ((fahrenheit - 32) * 5 / 9);
    }
    private float convertCelsiusToFahrenheit(float celsius){
        return ((celsius *9) / 5) + 32;
    }

}
  • 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-20T05:09:44+00:00Added an answer on May 20, 2026 at 5:09 am

    It should be in dk.ilizane.android.temperatur.R.id.radio1. If you look at the tutorial in the main.xml file the ids of the RadioButtons are radio0 and radio1. Your projects custom resources will be compiled into a class named R in your package. In Eclipse there should be a gen src directory that contains the java file.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have thousands of HTML files to process using Groovy/Java and I need to
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

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.