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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:41:39+00:00 2026-05-28T13:41:39+00:00

I have written following code to get location name package demo.gps.locname; import java.io.IOException; import

  • 0

I have written following code to get location name

package demo.gps.locname;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

//import com.VertexVerveInc.GPSLocator.R;
//import com.VertexVerveInc.GPSLocator.GPSLocatorActivity.GPSLocationListener;
//import com.VertexVerveInc.GPSLocator.GPSLocatorActivity.MapOverlay;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
//import com.google.android.maps.Overlay;

//import android.app.Activity;
import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
//import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;

public class GPSLocationActivity extends MapActivity {
    /** Called when the activity is first created. */
    private LocationManager locationManager;
    private LocationListener locationListener;
    private TextView tv;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

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

        locationListener = new GPSLocationListener();

        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
                0, locationListener);
        tv =(TextView)findViewById(R.id.tv);
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }

    private class GPSLocationListener implements LocationListener 
    {
        @Override
        public void onLocationChanged(Location location) {
            if (location != null) {
                GeoPoint point = new GeoPoint(
                        (int) (location.getLatitude() * 1E6), 
                        (int) (location.getLongitude() * 1E6));

                /* Toast.makeText(getBaseContext(), 
                        "Latitude: " + location.getLatitude() + 
                        " Longitude: " + location.getLongitude(), 
                        Toast.LENGTH_SHORT).show();*/

//                mapController.animateTo(point);
//                mapController.setZoom(16);

                // add marker
//                MapOverlay mapOverlay = new MapOverlay();
//              mapOverlay.setPointToDraw(point);
//              List<Overlay> listOfOverlays = mapView.getOverlays();
//              listOfOverlays.clear();
//              listOfOverlays.add(mapOverlay);
                String address = ConvertPointToLocation(point);
                Toast.makeText(getBaseContext(), address, Toast.LENGTH_SHORT).show();
                tv.setText(address);
//                mapView.invalidate();
            }
        }

        public String ConvertPointToLocation(GeoPoint point) {   
            String address = "";
            Geocoder geoCoder = new Geocoder(
                    getBaseContext(), Locale.getDefault());
            try {
                List<Address> addresses = geoCoder.getFromLocation(
                    point.getLatitudeE6()  / 1E6, 
                    point.getLongitudeE6() / 1E6, 1);

                if (addresses.size() > 0) {
                    for (int index = 0; index < addresses.get(0).getMaxAddressLineIndex(); index++)
                        address += addresses.get(0).getAddressLine(index) + " ";
                }
            }
            catch (IOException e) {                
                e.printStackTrace();
            }   

            return address;
        } 

        @Override
        public void onProviderDisabled(String provider) {
        }

        @Override
        public void onProviderEnabled(String provider) {
        }

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

I am getting following error

01-23 13:20:26.103: W/dalvikvm(231): Unable to resolve superclass of Ldemo/gps/locname/GPSLocationActivity; (15)
01-23 13:20:26.142: W/dalvikvm(231): Link of class 'Ldemo/gps/locname/GPSLocationActivity;' failed
01-23 13:20:26.142: D/AndroidRuntime(231): Shutting down VM
01-23 13:20:26.142: W/dalvikvm(231): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
01-23 13:20:26.142: E/AndroidRuntime(231): Uncaught handler: thread main exiting due to uncaught exception
01-23 13:20:26.173: E/AndroidRuntime(231): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{demo.gps.locname/demo.gps.locname.GPSLocationActivity}: java.lang.ClassNotFoundException: demo.gps.locname.GPSLocationActivity in loader dalvik.system.PathClassLoader@4376ac28
01-23 13:20:26.173: E/AndroidRuntime(231):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2324)
01-23 13:20:26.173: E/AndroidRuntime(231):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
01-23 13:20:26.173: E/AndroidRuntime(231):  at android.app.ActivityThread.access$2100(ActivityThread.java:116)
01-23 13:20:26.173: E/AndroidRuntime(231):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
01-23 13:20:26.173: E/AndroidRuntime(231):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 13:20:26.173: E/AndroidRuntime(231):  at android.os.Looper.loop(Looper.java:123)
01-23 13:20:26.173: E/AndroidRuntime(231):  at android.app.ActivityThread.main(ActivityThread.java:4203)
01-23 13:20:26.173: E/AndroidRuntime(231):  at java.lang.reflect.Method.invokeNative(Native Method)
01-23 13:20:26.173: E/AndroidRuntime(231):  at java.lang.reflect.Method.invoke(Method.java:521)
    01-23 13:20:26.173: E/AndroidRuntime(231):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
    01-23 13:20:26.173: E/AndroidRuntime(231):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
    01-23 13:20:26.173: E/AndroidRuntime(231):  at dalvik.system.NativeStart.main(Native Method)
    01-23 13:20:26.173: E/AndroidRuntime(231): Caused by: java.lang.ClassNotFoundException: demo.gps.locname.GPSLocationActivity in loader dalvik.system.PathClassLoader@4376ac28
    01-23 13:20:26.173: E/AndroidRuntime(231):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
    01-23 13:20:26.173: E/AndroidRuntime(231):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
    01-23 13:20:26.173: E/AndroidRuntime(231):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
    01-23 13:20:26.173: E/AndroidRuntime(231):  at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
    01-23 13:20:26.173: E/AndroidRuntime(231):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
    01-23 13:20:26.173: E/AndroidRuntime(231):  ... 11 more
    01-23 13:20:26.203: I/dalvikvm(231): threadid=7: reacting to signal 3
    01-23 13:20:26.203: E/dalvikvm(231): Unable to open stack trace file '/data/anr/traces.txt': Permission denied

Manifest.xml

<uses-sdk android:minSdkVersion="4" />

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".GPSLocationActivity"
            android:label="@string/app_name" >
            <uses-library android:name="com.google.android.maps" />

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
  • 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-28T13:41:40+00:00Added an answer on May 28, 2026 at 1:41 pm

    The

    <uses-library android:name="com.google.android.maps" />

    should be contained in the <application> node and not the <activity> node. That should fix the problem because as of now, you are not requesting for the maps permission.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a following code to get just the file name without extension
I have written the following IronPython code: import clr clr.AddReference(System.Drawing) from System import *
I have written the following code for inserting video bytes into the database DBAdapter.java
I have written the following code: //get the user from the DB var tmpuser
I have written the following code, but continually get a 'non-static method getText() can
I have written the following C code to get in a list of strings
I have written following code to get JSON result from webservice. function SaveUploadedDataInDB(fileName) {
I have written the following code choice /m Do you want to add another
I have written the following code. But it is removing only &nbsp; not <br>
i have written the following code: As you can see there is a for

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.