Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid App Crashes When I Try to Show HelloWorld After Button Is Clicked
    primarykey
    data
    text
    <p>I have written a simple app that is supposed to show a button and when that button is clicked, it will show the text: 'Hello World' - however all it is doing is crashing at the moment. </p> <p>The XML is: </p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;TextView android:id="@+id/hello" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="" tools:context=".GraphicsActivity" /&gt; &lt;Button xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/button_send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Write Something..." android:onClick="writeMsg" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>The Android source is here: </p> <pre><code>public class GraphicsActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_graphics); } public void WriteMsg() { Button button = (Button) findViewById(R.id.button_send); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { TextView tv = (TextView) findViewById(R.id.hello); tv.setText("Hello World"); setContentView(tv); } }); } } </code></pre> <p>As I say, all it does is crashes. By the way, I am running this in an emulator.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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