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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:54:52+00:00 2026-05-25T23:54:52+00:00

I am struggling with finding the reason why this code locks up. As far

  • 0

I am struggling with finding the reason why this code locks up. As far as I know, I am declaring the correct permissions in my manifest file as shown below. I have tried running it on an actual device(Droid x w./ 2.3.3) and an AVD to no avail. I’ve attached the logcat as well which brought me to the classnotfound exception. I have cleaned the project, and verified that the maps.jar is included in the googleapi’s package, which I’ve also used as the target for the application. (Google API’s 2.3.3). Not sure where to go from here.

Activity Code:

'package com.SmartPark;

import java.util.List;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Handler;
import android.widget.LinearLayout;
//import android.widget.TextView;
import android.widget.Toast;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;



public class SmartParkActivity extends MapActivity {
 //** Called when the activity is first created. */
    LinearLayout linearlayout;
    MapView mapView;
    List<Overlay> mapOverlays;
    Drawable drawable;
    HelloItemizedOverlay itemizedOverlay;
    GeoPoint point = new GeoPoint(42392400,-83134700);
    OverlayItem overlayitem = new OverlayItem(point, "", "");
    private LocationManager lm;
    private LocationListener locationListener;
    public double[] gps=new double[2];
    public boolean setgps;
    final Handler mHandler = new Handler();
    //TextView tvl; //latitude display
   // TextView tvlong;//longitude display
    int lat2;
    int longitude2;
    public float z;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
        mapOverlays = mapView.getOverlays();
        drawable = this.getResources().getDrawable(R.drawable.greendot1);
        itemizedOverlay = new HelloItemizedOverlay(drawable);
        OverlayItem overlayitem = new OverlayItem(point, "", "");
        itemizedOverlay.addOverlay(overlayitem);
       mapOverlays.add(itemizedOverlay);
       // tvl =  (TextView) this.findViewById(R.id.gpslview);
      // tvlong =  (TextView) this.findViewById(R.id.gpslongview);
    }

    @Override
    protected boolean isRouteDisplayed() {

            return false;
    }

     @Override
        protected void onStart() {
            super.onStart();


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

        locationListener = new MyLocationListener();

        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 100, 0,
                locationListener);

        mHandler.postDelayed(mUpdateTimeTask, 500);



    }
    @Override
    protected void onStop() {
        super.onStop();

       lm.removeUpdates(locationListener);
        mHandler.removeCallbacks(mUpdateTimeTask);
        }

    @Override
    protected void onDestroy() {
        super.onDestroy();

       lm.removeUpdates(locationListener);
        mHandler.removeCallbacks(mUpdateTimeTask);
        }






    //}
 // helper method to schedule the postdelayed mhandler at specified interval
    private boolean foo() { 
        setgps=false;


        mHandler.postDelayed(mUpdateTimeTask, 500);

        return true;
    };


    //Method to acquire set gps variable and display it. update overlay if     possible
    private Runnable mUpdateTimeTask = new Runnable() {
           public void run() {  

               mapOverlays.clear();
               GeoPoint point = setgeopoint(gps[0],gps[1]);
               OverlayItem overlayitem = new OverlayItem(point, "", "");
               mapOverlays.add(itemizedOverlay);
               itemizedOverlay.addOverlay(overlayitem);

              // tvl.setText("Latitude:"+gps[0]);
               //  tvlong.setText("Longitude"+gps[1]);
                 // z=(float)android.location.Location.getSpeed();
                 setgps=foo(); //reschedules the task

    }; 
    };

    //math functions

   //convert gps double to an int and set to GeoPoint
    public GeoPoint setgeopoint (double dl, double dlong) {
        int intl = (int) (dl*1000000);
        int intlong = (int) (dlong*1000000);

        GeoPoint point= new GeoPoint ( intl, intlong);
        return point;
    }




    public class MyLocationListener implements LocationListener
    {
        @Override
        public void onLocationChanged(Location loc)
        {
            if (loc != null) {
                Toast.makeText(
                        getBaseContext(),
                        "Location changed : Lat: " + loc.getLatitude()
                                + " Lng: " + loc.getLongitude(),
                        Toast.LENGTH_SHORT).show();
                gps[0]= lat2;
                gps[1]=longitude2;
                gps[0] = loc.getLatitude();
                gps[1] = loc.getLongitude();
                z=loc.getSpeed();

            }
        }
        public void onProviderDisabled(String provider)
        {
            Toast.makeText( getApplicationContext(),"Gps     Disabled",Toast.LENGTH_SHORT ).show();
        }
        public void onProviderEnabled(String provider)
        {
            Toast.makeText( getApplicationContext(),"Gps Enabled",Toast.LENGTH_SHORT).show();
        }
        public void onStatusChanged(String provider, int status, Bundle extras)
        {
            Toast.makeText( getApplicationContext(),"Status changed",Toast.LENGTH_SHORT).show();
        }
    }





}'

Manifest:

<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.SmartPark"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses- permission> 
    <uses-permission android:name="android.permission.ACCESS_LOCATION"></uses-permission> 
<uses-permission android:name="android.permission.ACCESS_GPS"></uses-permission> 
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS"></uses-permission>
<application android:icon="@drawable/icon" android:label="@string/app_name">
        <uses-library android:name="com.google.android.maps" />
    <activity android:name=".MapviewActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

    </activity>
  </application>

 </manifest>

Logcat:

10-06 09:19:07.239: ERROR/AndroidRuntime(13602): java.lang.RuntimeException: Unable to     instantiate activity ComponentInfo{com.SmartPark/com.SmartPark.MapviewActivity}:     java.lang.ClassNotFoundException: com.SmartPark.MapviewActivity in loader     dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.SmartPark-2.apk]
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1618)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at android.app.ActivityThread.access$1500(ActivityThread.java:124)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at     android.app.ActivityThread$H.handleMessage(ActivityThread.java:968)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at android.os.Looper.loop(Looper.java:123)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at android.app.ActivityThread.main(ActivityThread.java:3806)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at java.lang.reflect.Method.invokeNative(Native Method)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at java.lang.reflect.Method.invoke(Method.java:507)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at dalvik.system.NativeStart.main(Native Method)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602): Caused by: java.lang.ClassNotFoundException: com.SmartPark.MapviewActivity in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.SmartPark-2.apk]
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1610)
10-06 09:19:07.239: ERROR/AndroidRuntime(13602):     ... 11 more
  • 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-25T23:54:53+00:00Added an answer on May 25, 2026 at 11:54 pm

    Shouldn’t it be MapViewActivity and not MapviewActivity in your manifest?

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

Sidebar

Related Questions

I'm struggling with finding out if a MKPolygon intersects with a MKCircle. This is
I am struggling finding the best way to understand this: Let's say I am
I am struggling with this piece of code for the last few hours now.
Been struggling with this simple selector problem a couple of hours now and must
im struggling with syntax here: hopefully this question is v simple, im just miising
A coworker has been struggling with this problem. The desired result is an installable
I'm still struggling to Stream a file to the HTTP response in Pylons .
I just started playing with Django today and so far am finding it rather
I'm designing a new system and finding that I am struggling with the structure
So I have been struggling with finding a decent C# library to use with

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.