Hi. I am an Android beginner trying to make an IntentFilter that can filter multiple actions. Unfortunately, when I begin using the addAction
method, Eclipse throws an error:
"Syntax error on token "addAction", Identifier expected after this token"
even though I have imported the required file. This is probably a settings issue even though I am unsure why rest of the code doesnt show any problems.
Here is my code stub:
import android.content.Intent;
import android.content.Context;
import android.content.IntentFilter;
...
private Context mContext;
IntentFilter filter = new IntentFilter();
filter.addAction("android.intent.action.SCREEN_OFF");
I observed one more thing--as I type ' filter.' nothing shows up, just the message "No Default Proposals"
Can anybody help me?
filter
variable are out of the scope or something else...