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

  • Home
  • SEARCH
  • 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 7430107
In Process

The Archive Base Latest Questions

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

I’m using the vogella tutorial, and I’m almost positive I followed the instructions exactly,

  • 0

I’m using the vogella tutorial, and I’m almost positive I followed the instructions exactly, but when I try to use the app, it doesn’t function, it only shows the xml layout.

Code:

package convert.activity;

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 ConvertActivityActivity extends Activity {
private EditText text;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    text = (EditText) findViewById(R.id.editText1);

}

// This method is called at button click because we assigned the name to the
// "On Click property" of the button
public void myClickHandler(View view) {
    switch (view.getId()) {
    case R.id.button1: 
        RadioButton celsiusButton = (RadioButton) findViewById(R.id.radio0);
        RadioButton fahrenheitButton = (RadioButton) findViewById(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)));
            celsiusButton.setChecked(false);
            fahrenheitButton.setChecked(true);
        } else {
            text.setText(String
                    .valueOf(convertCelsiusToFahrenheit(inputValue)));
            fahrenheitButton.setChecked(false);
            celsiusButton.setChecked(true);
        }
        break;
    }
}

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

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

What on earth could possibly be wrong with it?
(The public class ConvevrtActivityActivity is it’s actual name)

EDIT: Here’s my XML too:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">

<EditText android:layout_height="wrap_content" 
    android:id="@+id/editText1"
    android:layout_width="match_parent" ></EditText>

<RadioGroup android:layout_height="wrap_content" android:id="@+id/radioGroup1"
    android:layout_width="match_parent">

    <RadioButton
        android:id="@+id/radio0"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="true"
        android:text="@string/celsius" >
</RadioButton>

    <RadioButton
        android:id="@+id/radio1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/fahrenheit" >
</RadioButton>
</RadioGroup>

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/calc" >
</Button>  


</LinearLayout>

LOGCAT:

02-08 21:05:39.392: W/ThrottleService(89): unable to find stats for iface rmnet0
02-08 21:07:18.561: D/dalvikvm(172): GC_CONCURRENT freed 385K, 6% free 9529K/10119K,         paused 9ms+8ms
02-08 21:12:06.030: A/BatteryStatsImpl(89): problem reading network stats
02-08 21:12:06.030: A/BatteryStatsImpl(89): java.lang.IllegalStateException: problem   parsing idx 1
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at    com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.jav    a:300)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at   com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.jav    a:250)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at     com.android.internal.os.BatteryStatsImpl.getNetworkStatsDetailGroupedByUid(BatteryStatsImpl    .java:5734)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at com.android.internal.os.BatteryStatsImpl.access$100(BatteryStatsImpl.java:76)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at  com.android.internal.os.BatteryStatsImpl$Uid.computeCurrentTcpBytesReceived(BatteryStatsImp    l.java:2457)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at  com.android.internal.os.BatteryStatsImpl$Uid.getTcpBytesReceived(BatteryStatsImpl.java:2446 )
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at com.android.internal.os.BatteryStatsImpl.writeSummaryToParcel(BatteryStatsImpl.java:5437)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at com.android.internal.os.BatteryStatsImpl.writeLocked(BatteryStatsImpl.java:4836)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at com.android.internal.os.BatteryStatsImpl.writeAsyncLocked(BatteryStatsImpl.java:4818)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at com.android.server.am.ActivityManagerService.updateCpuStatsNow(ActivityManagerService.java:1649)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at com.android.server.am.ActivityManagerService$3.run(ActivityManagerService.java:1531)
02-08 21:12:06.030: A/BatteryStatsImpl(89): Caused by: java.io.FileNotFoundException:    /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at   libcore.io.IoBridge.open(IoBridge.java:406)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at java.io.FileInputStream.<init>  (FileInputStream.java:78)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.jav    a:269)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     ... 10 more
02-08 21:12:06.030: A/BatteryStatsImpl(89): Caused by: libcore.io.ErrnoException: open   failed: ENOENT (No such file or directory)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at libcore.io.Posix.open(Native  Method)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at  libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     at libcore.io.IoBridge.open(IoBridge.java:390)
02-08 21:12:06.030: A/BatteryStatsImpl(89):     ... 12 more
02-08 21:12:06.439: D/dalvikvm(89): GC_CONCURRENT freed 1446K, 16% free 11329K/13383K,     paused 10ms+19ms
02-08 21:14:45.149: D/dalvikvm(172): GC_CONCURRENT freed 383K, 6% free 9529K/10119K,  paused 8ms+7ms
02-08 21:15:39.493: W/ThrottleService(89): unable to find stats for iface rmnet0
  • 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:05:12+00:00Added an answer on May 29, 2026 at 9:05 am

    you haven’t “tied” your click listener method to your button view. Change that portion of your layout to look like this:

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/calc" 
        android:onClick="myClickHandler">
    </Button>
    

    If you don’t recognize any of that stuff from the log it is probably unrelated to your application. What I meant was to put log statements into your java that will basically print to the log cat. That way you can use them to figure out where your applications are breaking while you are building them. something like this:

    Log.d("TAG","I'm inside the click callback!");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to construct a data frame in an Rcpp function, but when I
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.