Button causes Fatal Exception: main, and how to insert "$"
<p>I'm programming a gas calculator that has two outputs (Total Cost of Gas and Total Gallons); how can I put a "$" in front of <code>totalCost</code> but not in front of <code>totalGas</code>?</p>

<p>Also when I run the program in the emulator, when I click on the reset button it force closes the program and I get a <code>FATAL EXCEPTION: main</code> error. </p>

<p>EDIT: I figured it out. I forgot to import myClickHandler on the reset button. </p>

<p>Here's the java file:</p>

<pre><code>package com.example.gas;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import com.example.gas.R;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity 
{

    private EditText totalMiles;
    private EditText price;
    private EditText mpg;
    private TextView totalGas;
    private TextView totalCost;

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        totalMiles = (EditText) findViewById(R.id.milesTxt);
        totalCost = (EditText) findViewById(R.id.costTxt);
        totalGas = (EditText) findViewById(R.id.gasTxt);
        price = (EditText) findViewById(R.id.priceTxt);
        mpg = (EditText) findViewById(R.id.mpgTxt);
    }

    public void myClickHandler(View view)
    {
        NumberFormat nf = new DecimalFormat("#,###.00");
        switch (view.getId())
        {
            case R.id.calcBtn:
                float inputMiles = Float.parseFloat(totalMiles.getText().toString());
                float inputMPG = Float.parseFloat(mpg.getText().toString());
                float inputPrice = Float.parseFloat(price.getText().toString());
                float result1 = inputMiles/inputMPG;
                String output1 = nf.format(result1);
                totalGas.setText(output1);
                float result = result1 * inputPrice;
                String output = nf.format(result);
                totalCost.setText(output);
                break;

            case R.id.resetBtn:
                totalMiles.setText("");
                totalCost.setText("");
                totalGas.setText("");
                price.setText("");
                mpg.setText("");
                break;
        }
    }
}
</code></pre>
