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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:32:26+00:00 2026-05-28T14:32:26+00:00

i’m trying to code an app that displays the current device position on a

  • 0

i’m trying to code an app that displays the current device position on a map. When i try to install it onto the device it says it cant find the class that is my main activity. it also says that dalvikvm can’t resolve it the class’ superclass, which is clearly MapActivity. Any ideas? thanks.

import java.util.List;

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

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ZoomControls;

public class WcFinderActivity extends MapActivity implements LocationListener {
    /** Called when the activity is first created. */

    EditText        txted           = null;

    Button          btnSimple       = null;

    MapView         gMapView        = null;

    MapController   mc              = null;

    Drawable        defaultMarker   = null;

    GeoPoint        p               = null;

    double          latitude        = 18.9599990845, longitude = 72.819999694;

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

        // Creating TextBox displying Lat, Long
        txted = (EditText) findViewById(R.id.id1);
        String currentLocation = "Lat: " + latitude + " Lng: " + longitude;
        txted.setText(currentLocation);

        // Creating and initializing Map
        gMapView = (MapView) findViewById(R.id.myGMap);
        p = new GeoPoint((int) (latitude * 1000000), (int) (longitude * 1000000));
        gMapView.setSatellite(true);
        mc = gMapView.getController();
        mc.setCenter(p);
        mc.setZoom(14);

        // Add a location mark
        MyLocationOverlay myLocationOverlay = new MyLocationOverlay();
        List<Overlay> list = gMapView.getOverlays();
        list.add(myLocationOverlay);

        // Adding zoom controls to Map
        ZoomControls zoomControls = (ZoomControls) gMapView.getZoomControls();
        zoomControls.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));

        gMapView.addView(zoomControls);
        gMapView.displayZoomControls(true);

        // Getting locationManager and reflecting changes over map if distance travel by
        // user is greater than 500m from current location.
        LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f, this);
    }

    /* This method is called when use position will get changed */
    public void onLocationChanged(Location location) {
        if (location != null) {
            double lat = location.getLatitude();
            double lng = location.getLongitude();
            String currentLocation = "Lat: " + lat + " Lng: " + lng;
            txted.setText(currentLocation);
            p = new GeoPoint((int) lat * 1000000, (int) lng * 1000000);
            mc.animateTo(p);
        }
    }

    public void onProviderDisabled(String provider) {
        // required for interface, not used
    }

    public void onProviderEnabled(String provider) {
        // required for interface, not used
    }

    public void onStatusChanged(String provider, int status, Bundle extras) {
        // required for interface, not used
    }

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

    /* User can zoom in/out using keys provided on keypad */
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_I) {
            gMapView.getController().setZoom(gMapView.getZoomLevel() + 1);
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_O) {
            gMapView.getController().setZoom(gMapView.getZoomLevel() - 1);
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_S) {
            gMapView.setSatellite(true);
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_T) {
            gMapView.setTraffic(true);
            return true;
        }
        return false;
    }

    /* Class overload draw method which actually plot a marker,text etc. on Map */
    protected class MyLocationOverlay extends com.google.android.maps.Overlay {

        @Override
        public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
            Paint paint = new Paint();

            super.draw(canvas, mapView, shadow);
            // Converts lat/lng-Point to OUR coordinates on the screen.
            Point myScreenCoords = new Point();
            mapView.getProjection().toPixels(p, myScreenCoords);

            paint.setStrokeWidth(1);
            paint.setARGB(255, 255, 255, 255);
            paint.setStyle(Paint.Style.STROKE);

            Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);

            canvas.drawBitmap(bmp, myScreenCoords.x, myScreenCoords.y, paint);
            canvas.drawText("I am here...", myScreenCoords.x, myScreenCoords.y, paint);
            return true;
        }
    }
}

01-18 15:04:07.223: W/dalvikvm(3554): Unable to resolve superclass of Lcom/tecmark/WcFinderActivity; (23)
01-18 15:04:07.238: W/dalvikvm(3554): Link of class ‘Lcom/tecmark/WcFinderActivity;’ failed
01-18 15:04:07.238: D/AndroidRuntime(3554): Shutting down VM
01-18 15:04:07.238: W/dalvikvm(3554): threadid=3: thread exiting with uncaught exception (group=0x4001b180)
01-18 15:04:07.238: E/AndroidRuntime(3554): Uncaught handler: thread main exiting due to uncaught exception
01-18 15:04:07.278: E/AndroidRuntime(3554): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.tecmark/com.tecmark.WcFinderActivity}: java.lang.ClassNotFoundException: com.tecmark.WcFinderActivity in loader dalvik.system.PathClassLoader@43e57a18
01-18 15:04:07.278: E/AndroidRuntime(3554): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
01-18 15:04:07.278: E/AndroidRuntime(3554): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
01-18 15:04:07.278: E/AndroidRuntime(3554): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
01-18 15:04:07.278: E/AndroidRuntime(3554): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
01-18 15:04:07.278: E/AndroidRuntime(3554): at android.os.Handler.dispatchMessage(Handler.java:99)
01-18 15:04:07.278: E/AndroidRuntime(3554): at android.os.Looper.loop(Looper.java:123)
01-18 15:04:07.278: E/AndroidRuntime(3554): at android.app.ActivityThread.main(ActivityThread.java:4363)
01-18 15:04:07.278: E/AndroidRuntime(3554): at java.lang.reflect.Method.invokeNative(Native Method)
01-18 15:04:07.278: E/AndroidRuntime(3554): at java.lang.reflect.Method.invoke(Method.java:521)
01-18 15:04:07.278: E/AndroidRuntime(3554): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-18 15:04:07.278: E/AndroidRuntime(3554): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-18 15:04:07.278: E/AndroidRuntime(3554): at dalvik.system.NativeStart.main(Native Method)
01-18 15:04:07.278: E/AndroidRuntime(3554): Caused by: java.lang.ClassNotFoundException: com.tecmark.WcFinderActivity in loader dalvik.system.PathClassLoader@43e57a18
01-18 15:04:07.278: E/AndroidRuntime(3554): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-18 15:04:07.278: E/AndroidRuntime(3554): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-18 15:04:07.278: E/AndroidRuntime(3554): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-18 15:04:07.278: E/AndroidRuntime(3554): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-18 15:04:07.278: E/AndroidRuntime(3554): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
01-18 15:04:07.278: E/AndroidRuntime(3554): … 11 more

.

<?xml version="1.0" ?>
        <manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="com.tecmark"
            android:versionCode="1"
            android:versionName="1.0" >

            <uses-sdk android:minSdkVersion="7" />
             <uses-permission android:name="android.permission.INTERNET"></uses-permission>
            <uses-library android:name="com.google.android.maps" />
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

            <application
                android:icon="@drawable/ic_launcher"
                android:label="@string/app_name" >
                <activity
                    android:name=".WcFinderActivity"
                    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>
  • 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-28T14:32:27+00:00Added an answer on May 28, 2026 at 2:32 pm

    Sorry i made a silly mistake. i moved the uses-library tag inside the application tag and it compiles and installs on phone now. i think that explains the superclass can not be resloved error as well. my activity extends MapActivity, this is probably defined in the google api library that was not declared between the application tags.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.