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 7646455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:12:48+00:00 2026-05-31T10:12:48+00:00

EDIT: Please note that while I received an answer, I don’t understand what’s wrong

  • 0

EDIT: Please note that while I received an answer, I don’t understand what’s wrong or why the solution fixes it. I’m still looking for a debunk…

I am receiving the error:

error: (identifier) expected

on the line

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);

where the identifier expected points to the “(“.

[Note: I actually get four of these errors pointing to the “(“, “0”, “0”, and the “)”.]

I always get this error when I slip up with syntax – but I cannot find it this time. My code is relatively short so I pase it, but please know that the code works completely fine when I comment out the offending line above.

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.view.View.*;
import android.view.View;
import android.content.Context;
import java.lang.CharSequence;
import android.widget.Toast;
import android.location.*;


public class Entrance extends Activity
{

/** Called when the activity is first created. */
@Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button bGPS = (Button)findViewById(R.id.button_gps);
        bGPS.setOnClickListener(bGPSListener);
    }

LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);

LocationListener locationListener = new LocationListener()
{
    public void onLocationChanged(Location location)
    {
        Context context = getApplicationContext();
        CharSequence text = "Location found.";
        int duration = Toast.LENGTH_SHORT;

        Toast toast = Toast.makeText(context, text, duration);
        toast.show();
    }

    public void onStatusChanged(String provider, int status, Bundle extras) {}

    public void onProviderEnabled(String provider) {}

    public void onProviderDisabled(String provider) {}
};

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);   

private OnClickListener bGPSListener = new OnClickListener()
{
    public void onClick(View v)
    {
        Context context = getApplicationContext();
        CharSequence text = "Hello toast!";
        int duration = Toast.LENGTH_SHORT;

        Toast toast = Toast.makeText(context, text, duration);
        toast.show();
    }
};
}
  • 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-31T10:12:50+00:00Added an answer on May 31, 2026 at 10:12 am

    you can’t just envoke method any there inside class atleast put it is seperate section like this

    {
    locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please note the Edit below for a lot more information, and a possible solution
EDIT: Please note that this question is OUTDATED; RVM got way easier to use
**EDIT: There are several options below that would work. Please vote/comment according to your
Edit: From another question I provided an answer that has links to a lot
I'm not sure what kind of terminology to use in this so please edit
Please let me know if you have any idea about it. Thanks EDIT What
Why new()/delete() is slower than malloc()/free()? EDIT: Thanks for the answers so far. Please
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
As i Understand export keyword can be used so that one can expose template

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.