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

  • Home
  • SEARCH
  • 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 6088695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:00:53+00:00 2026-05-23T12:00:53+00:00

Hello there i’m having a problem here i have an add and edit form

  • 0

Hello there i’m having a problem here

i have an add and edit form for my point of views databases
it has two EditText for the coordinates, for Longitude and Latitude
and it has a button to get the current coordinates
if i click the button, the two EditTexts filled with the coordinates
and the user can proceed to insert or edit the data

my code returning a java.nullPointerException, i don’t know why…

this is my code :

btn_getkoor.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                try{

                    LocationListener gpsLocation = new MyLocationListener();
                    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, gpsLocation); //new MyLocationListener());
                    Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

                    final TextView error_text = (TextView) findViewById(R.id.error_text);

                    if (location != null) {

                        EditText et_longitude = (EditText) findViewById(R.id.et_longitude);
                        EditText et_latitude = (EditText) findViewById(R.id.et_latitude);

                        et_longitude.setText(""+location.getLongitude());   // longitude textview
                        et_latitude.setText(""+location.getLatitude());     //latitude textview

                        locationManager.removeUpdates((LocationListener) location);
                        locationManager = null;

                    }else{
                        toastkeun("Terjadi Kesalahan dalam pengambilan koordinat");             //toast function
                        error_text.setText("Terjadi Kesalahan dalam pengambilan koordinat");    //textview for showing errors
                    }
                }catch(Exception e){
                    toastkeun(e.toString());
                }

            }
        });

Any solution?

I’m already set the Manifest file FYI

  • 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-23T12:00:53+00:00Added an answer on May 23, 2026 at 12:00 pm

    It is difficult to say from your code, though :

    If you haven’t done this, here is the code :

    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);     
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello there i have written some code in jquery to add new input type
Hello there I have a database that has 2 tables in it, one is
i have a file named hello.txt which has the content Hello,there!. I want to
Let's say I have these two arrays: string[] arr1 = new string[2]{Hello, Stack} string[]
Hello there i'm trying to create a form with Zend_Form that will enable my
Hello there I am having some thoughts on my file structure in codeigniter.What I'm
Hello there freaks & geeks. Here comes my question again, thanks for helping!. Lets
I have a div: <div> Hello there <img src=cnnc.png /> </div> <div id=cart> <div
I have two types of strings, hello and helloThere . What I want is
Hello there I am trying to add a Library to an Android application. I

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.