kotozna
kotozna

Reputation: 331

IntelliJ introductory examples gives compile errors

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

Upvotes: 0

Views: 66

Answers (1)

JB Nizet
JB Nizet

Reputation: 691635

You missed the two lines just before:

private View.OnClickListener droidTapListener;

You add this member to the class MyActivity and initialize it in the InitializeAppmethod

Upvotes: 1

Related Questions