0

I am following IntelliJ IDEA's introduction to Android (using v 12.1.6):

http://confluence.jetbrains.com/display/IntelliJIDEA/Make+the+application+interactive

In section 3 it asks you to use add the following event handler:

private void InitializeApp()
{
message = (TextView) findViewById(R.id.message);
droid = (ImageView) findViewById(R.id.imageView);

// Define and attach listeners
droidTapListener = new View.OnClickListener()  {
    public void onClick(View v) {
       TapDroid();
    }
};
droid.setOnClickListener(droidTapListener);
}

but this just leads to these compile errors:

java: cannot find symbol
 symbol:   variable droidTapListener
 location: class com.example.app2.MyActivity
java: cannot find symbol
symbol: method TapDroid()
  java: cannot find symbol
  symbol:   variable droidTapListener
  location: class com.example.app2.MyActivity

I suspect the documentation is out of date, but can someone explain how to fix this?

Thanks,

Mark

4

1 に答える 1

1

直前の 2 行を見逃していました。

private View.OnClickListener droidTapListener;

このメンバーを MyActivity クラスに追加し、InitializeApp メソッドで初期化します。

于 2013-10-26T15:41:13.973 に答える