Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can't <code>findViewById()</code> earlier than <code>onCreate()</code>. This is because there's no layout loaded yet, and thus no views even exist.</p> <p>In other words, this code:</p> <pre><code>public class MainActivity extends Activity { RadioButton RD1 = (RadioButton) findViewById(R.id.ctof); RadioButton RD2 = (RadioButton) findViewById(R.id.ftoc); EditText input = (EditText) findViewById(R.id.ipdata); EditText output = (EditText) findViewById(R.id.opdata); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } </code></pre> <p>Needs to be like this:</p> <pre><code>public class MainActivity extends Activity { public RadioButton RD1, RD2; public EditText input, output; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RD1 = (RadioButton) findViewById(R.id.ctof); RD2 = (RadioButton) findViewById(R.id.ftoc); input = (EditText) findViewById(R.id.ipdata); output = (EditText) findViewById(R.id.opdata); } </code></pre> <hr> <p><code>input.toString()</code> is not the value typed in the text box. For that, you want <code>input.getText().toString()</code>.</p> <hr> <p>In your <code>activity_main.xml</code> file, <code>&lt;Button ... android:onClick="docon"&gt;</code> means clicking the button will fire the method <code>docon()</code>. You need to rename the method <code>doconvert()</code> or edit the XML.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload