Reputation: 445
i want to load a SoundPool inside onClick, but when i use:
c = sound.load(this, R.raw.ak47s, 1);
I get an error: the method load in a SoundPool is not applicable for the arguments.
I know i can't use "this" inside load, so what to use ?
Upvotes: 0
Views: 443
Reputation: 137322
If this is done in the Activity ExampleActivity, you should write:
c = sound.load(ExampleActivity.this, R.raw.ak47s, 1);
You need to fully-qualify this, as it is in an enclosed class instance.
Upvotes: 1