Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5957757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:26:49+00:00 2026-05-22T18:26:49+00:00

Hi. I am an Android beginner trying to make an IntentFilter that can filter

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:26:50+00:00Added an answer on May 22, 2026 at 6:26 pm

    Reading your comment above in the question (“Multiple markers at this line – Syntax error on token “)”, delete this token, etc.), I still think it is a bracket (or parenthesis) mismatch problem that does not let Eclipse understand the code. It could be in another method. Check carefully all your file. You may try to remove most of your code (just copy it to notepad) until you narrow the issue.


    From the dev guide (emphasis mine):

    An intent filter is an instance of the IntentFilter class. However, since the Android system must know about the capabilities of a component before it can launch that component, intent filters are generally not set up in Java code, but in the application’s manifest file (AndroidManifest.xml) as elements. (The one exception would be filters for broadcast receivers that are registered dynamically by calling Context.registerReceiver(); they are directly created as IntentFilter objects.)

    I would add this to your manifest instead:

    <intent-filter android:label="@string/screen_off">
      <action android:name="android.intent.action.SCREEN_OFF" />
      <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I'm trying
I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I'm trying
I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I'm trying
I am a beginner Android developer and I am trying to make a game
I am a beginner coder trying to learn how to make android apps. I
Android comes with lots of system resources ( android.R ) that can be used
Can Android OS that is installed on actual devices be emulated in VMWare or
I am a beginner android developer and I am trying to have a button
I'm a beginner android developer , I was trying to run this Linear Layout
I am a beginner of Android apps and am using Eclipse. I have found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.