Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid setText causes crash
    text
    copied!<p>I am trying to build a small simple program with an image and a textview under it. Like a countdown. I've been trying to runt this program, and everything works except when I get to setText, the program crashes. What could be the problem? I have done a lot of searching and changing, but still get the same problem. </p> <pre><code>package com.ob.IsIt; import android.app.Activity; import android.os.Bundle; import android.widget.ImageView; import android.widget.TextView; public class Isit1337 extends Activity { ImageView image; TextView t; String until; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); until = "fnkar inte"; t=(TextView)findViewById(R.layout.main); run(); } private void run() { if(IsIt.check()) { image.setEnabled(false); } until = IsIt.timeLeft(); t.setText("test"); } } </code></pre> <p>The IsIt works, the IsIt.check returns a boolean and the IsIt.timeLeft returns a String. The xml code looks like this. </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:gravity="bottom|center|center_vertical|top" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/image" android:layout_width="277dp" android:layout_height="441dp" android:src="@drawable/blackno" /&gt; &lt;TextView android:id="@+id/t" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.46" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Thank you in advance! </p>
 

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