Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.lang.ClassCastException: android.widget.TextView
    primarykey
    data
    text
    <p>I've this layout xml, named pagina.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_vertical" &gt; &lt;TextView android:id="@+id/descrizione" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;Button android:id="@+id/scelta1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:text="Button" /&gt; &lt;Button android:id="@+id/scelta3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/scelta1" android:layout_alignLeft="@+id/scelta1" android:layout_marginBottom="16dp" android:text="Button" /&gt; &lt;Button android:id="@+id/scelta2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/scelta3" android:layout_alignLeft="@+id/scelta3" android:layout_marginBottom="18dp" android:text="Button" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>I want to write the description of the element, but when I assign to a variable the textview element, the emulator crashes. This is the code:</p> <pre><code>public int posizione; public String stanza; public string[] azioni; public int[] vai; public XmlPullParser xpp; public EditText descr; public Button scelta_1, scelta_2, scelta_3; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pagina); try { carica_stanza(posizione); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XmlPullParserException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } descr = (EditText) this.findViewById(R.id.descrizione); scelta_1= (Button) this.findViewById(R.id.scelta1); scelta_2= (Button) this.findViewById(R.id.scelta2); scelta_3= (Button) this.findViewById(R.id.scelta3); } </code></pre> <p>Help me to understand!</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