Note that there are some explanatory texts on larger screens.

plurals
  1. PONew to Android, following tutorial but getting errors right at the beginning
    primarykey
    data
    text
    <p>I decided to convert my iOS apps to Android, and started reading/using the book 'Android Apps for Absolute Beginners'. In Chapter 7, there is a simple tutorial which produces a button changing its state depending on whether pressed or not. I am stuck right at the start! All I have done is create the project, add the file <code>button1.xml</code> into the <code>drawable-xhdpi</code> folder and add in 3 graphic png files @ 96x96 called <code>button1_pressed.png</code> etc.</p> <p>I then added these lines of code to <code>button1.xml</code>:</p> <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android "&gt; &lt;item android:state_pressed="true" android:drawable="@drawable/button1_pressed" /&gt; &lt;item android:state_focussed="true" android:drawable="@drawable/button1_focussed" /&gt; &lt;item android:drawable="@drawable/button1_normal" /&gt; </code></pre> <p></p> <p>Here is the MainActivity.java:</p> <pre><code>package third.example.userinterfacedesign; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } </code></pre> <p>}</p> <p>and here is the <code>activity_main.xml</code>:</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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; </code></pre> <p></p> <p>Here is an image showing the errors: <img src="https://i.stack.imgur.com/8KX1J.jpg" alt="enter image description here"></p> <p>What is wrong here?</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.
    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