Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You just need to intialize the <code>Button</code> and <code>EditText</code> inside your <code>MainActivity.java</code></p> <p><code>XML Layout File</code></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;EditText android:id="@+id/edit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="top" /&gt; &lt;Button android:id="@+id/formula" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Formula" android:gravity="bottom" /&gt; </code></pre> <h2> </h2> <pre><code> public class MainActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Button F=(Button)findViewById(R.id.formula); EditText editText = (EditText) findViewById(R.id.edit); F.setOnClickListener(new View.onClickListener() { public void onClick() { sendMessage(); } } } public void sendMessage() { String message = editText.getText().toString(); Intent intent = new Intent(MainActivity.this, FormulaActivity.class); intent.putExtra("EXTRA_MESSAGE", message); startActivity(intent); } } </code></pre> <hr> <pre><code>public class FormulaActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); String message = intent.getStringExtra("EXTRA_MESSAGE"); TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); // Set the text view as the activity layout setContentView(textView); } </code></pre>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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