title: Setting up buttons for Android
body: <p>Here is my problem. I setup the buttons exactly the way they are setup in the Android documentation, but I am getting a warning, and the button will not do anything.</p>
  
  <p>Here is my Java code:</p>
  
  <pre><code>package com.variDice;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.*;
  
  public class VariDiceActivity extends Activity {
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          //die1Clicked();
      }
  
      private void die1Clicked() {
          ImageButton die1button = (ImageButton)findViewById(R.id.die1button);
          die1button.setImageResource(R.drawable.icon);
      }
  }
  </code></pre>
  
  <p>...and the XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:weightSum="1" android:layout_gravity="center_horizontal"&gt;
  
      &lt;ImageView 
          android:id="@+id/varidice_icon"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:src="@drawable/icon"&gt;&lt;/ImageView&gt;
      &lt;ImageButton
          android:id="@+id/die1button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:background="@null"&gt;&lt;/ImageButton&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>...and the warning:</p>
  
  <p><code>The method die1Clicked from the type VariDiceActivity is never used locally.</code></p>
  
  <p>I must say that I am completely new to Android development. I made my app for the iPhone, and I am now trying to make a version for the android. The iPhone version was sooo much easier, because of the better interface builder (so I can just make an action and connect it to the button that way), so this is almost impossibly hard for me to understand. In other words, I do not understand how you connect an action to the button. Could somebody please tell me what I am doing wrong?</p>