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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:49:36+00:00 2026-05-23T09:49:36+00:00

There are 3 buttons on the screen! Start, View Map, Stop When I click

  • 0

There are 3 buttons on the screen! Start, View Map, Stop

When I click View Map, it should go to a new screen that shows the map! But something goes wrong and the app is getting force closed! I keep getting Could not find class A referenced from method B error. Please please please someone correct it. I’ve been struck with this for 3 days!!! :'(

Main.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:gravity="center"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<TextView 
    android:text="GPS App"
    android:id="@+id/textView1"
    android:textSize="40sp"   
    android:padding="10dp"
    android:gravity="center"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"   
    />

<Button 
    android:text="Start" 
    android:id="@+id/buttonStart"
    android:textSize="30sp" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent"  
    />

<Button 
    android:text="View Map" 
    android:id="@+id/buttonMap" 
    android:textSize="30sp" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    />

<Button 
    android:text="Stop" 
    android:id="@+id/buttonStop" 
    android:textSize="30sp" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    />

</LinearLayout>

map.xml

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mymap"
    android:clickable="true"
    android:enabled="true"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:apiKey="xxxxxxxxxxxxx" 
    />

<LinearLayout
    android:id="@+id/myzoom"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    />

</RelativeLayout>

manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Firstdroid.Gps"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MainActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:permission="android.permission.INTERNET" 
android:name=".IntentService" android:enabled="true" />
<activity android:name=".MapViewer" android:label="@string/app_name" >
<uses-library android:name="com.google.android.maps" />
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
</manifest>

MainActivity.java

package Firstdroid.Gps;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity 
{
    /** Called when the activity is first created. */
   @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        /* START BUTTON */

        Button startButton = (Button) findViewById(R.id.buttonStart);
        startButton.setOnClickListener(new OnClickListener() 
        {
                @Override
                public void onClick(View arg0) 
                {
                Log.d("Firstdroid.Gps", "Starting Exploration..");
                // Start Exploration
                startService(new Intent(MainActivity.this, GPSexp.class));
                }
        });

        /* MAP BUTTON */

        Button mapButton = (Button) findViewById(R.id.buttonMap);
        mapButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v){
                    Log.d("Firstdroid.Gps", "Loading Map..");
                    // Loading Google Map View
                    startService(new Intent(MainActivity.this, MapViewer.class));
                }       
        });

        /* STOP BUTTON */

        Button stopButton = (Button) findViewById(R.id.buttonStop);
        stopButton.setOnClickListener(new OnClickListener() 
        {
                @Override
                public void onClick(View v) 
                {
                Log.d("Firstdroid.Gps", "Stopping Exploration..");
                // Stop Exploration
                stopService(new Intent(MainActivity.this, GPSexp.class));
        }
        });
    }
}/* End of MainActivity */

The start and stop buttons refer to GPSexp.class defined in GPSexp.java which works correctly. Problem is with MapViewer.java

MapViewer.java

package Firstdroid.Gps;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
public class MapViewer extends MapActivity {

    MapView myMap;
    MyLocationOverlay myLocOverlay;

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

        initMap();
        initMyLocation();
    }

    private void initMap() {
        myMap = (MapView) findViewById(R.id.mymap);

        View zoomView = myMap.getZoomControls();
        LinearLayout myzoom = (LinearLayout) findViewById(R.id.myzoom);
        myzoom.addView(zoomView);
        myMap.displayZoomControls(true);

    }

    /**
     * Initialises the MyLocationOverlay and adds it to the overlays of the map
     */
    private void initMyLocation() {
        myLocOverlay = new MyLocationOverlay(this, myMap);
        myLocOverlay.enableMyLocation();
        myMap.getOverlays().add(myLocOverlay);

    }

    @Override
    protected boolean isRouteDisplayed() {
        return false;
    }
}

Logcat

06-30 04:25:07.519: WARN/dalvikvm(357): Unable to resolve superclass of LFirstdroid/Gps/MapViewer; (37)
06-30 04:25:07.519: WARN/dalvikvm(357): Link of class 'LFirstdroid/Gps/MapViewer;' failed
06-30 04:25:07.547: ERROR/dalvikvm(357): Could not find class 'Firstdroid.Gps.MapViewer', referenced from method Firstdroid.Gps.MainActivity$2.onClick
06-30 04:25:07.547: WARN/dalvikvm(357): VFY: unable to resolve const-class 8 (LFirstdroid/Gps/MapViewer;) in LFirstdroid/Gps/MainActivity$2;
06-30 04:25:07.559: DEBUG/dalvikvm(357): VFY: replacing opcode 0x1c at 0x000d
06-30 04:25:07.573: DEBUG/dalvikvm(357): VFY: dead code 0x000f-0015 in LFirstdroid/Gps/MainActivity$2;.onClick (Landroid/view/View;)V
06-30 04:25:07.909: INFO/ActivityManager(58): Displayed activity Firstdroid.Gps/.MainActivity: 1828 ms (total 1828 ms)
06-30 04:25:13.180: DEBUG/dalvikvm(129): GC_EXPLICIT freed 670 objects / 38560 bytes in 169ms
06-30 04:25:13.840: DEBUG/Firstdroid.Gps(357): Loading Map..
06-30 04:25:13.850: DEBUG/AndroidRuntime(357): Shutting down VM
06-30 04:25:13.850: WARN/dalvikvm(357): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
06-30 04:25:13.880: ERROR/AndroidRuntime(357): FATAL EXCEPTION: main
06-30 04:25:13.880: ERROR/AndroidRuntime(357): java.lang.NoClassDefFoundError: Firstdroid.Gps.MapViewer
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at Firstdroid.Gps.MainActivity$2.onClick(MainActivity.java:40)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at android.view.View.performClick(View.java:2408)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at android.view.View$PerformClick.run(View.java:8816)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at android.os.Handler.handleCallback(Handler.java:587)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at android.os.Handler.dispatchMessage(Handler.java:92)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at android.os.Looper.loop(Looper.java:123)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at android.app.ActivityThread.main(ActivityThread.java:4627)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at java.lang.reflect.Method.invokeNative(Native Method)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at java.lang.reflect.Method.invoke(Method.java:521)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-30 04:25:13.880: ERROR/AndroidRuntime(357):     at dalvik.system.NativeStart.main(Native Method)
06-30 04:25:13.900: WARN/ActivityManager(58):   Force finishing activity Firstdroid.Gps/.MainActivity
06-30 04:25:14.450: WARN/ActivityManager(58): Activity pause timeout for HistoryRecord{44fe90c0 Firstdroid.Gps/.MainActivity}
06-30 04:25:15.750: INFO/Process(357): Sending signal. PID: 357 SIG: 9
06-30 04:25:15.841: INFO/ActivityManager(58): Process Firstdroid.Gps (pid 357) has died.
06-30 04:25:15.880: INFO/WindowManager(58): WIN DEATH: Window{4500c988 Firstdroid.Gps/Firstdroid.Gps.MainActivity paused=false}
  • 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-23T09:49:37+00:00Added an answer on May 23, 2026 at 9:49 am

    You’re using startService to start your MapViewer activity. Hope that helps

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

Sidebar

Related Questions

There are 3 buttons on the screen! Start, View Map, Stop When I click
In my application I have some link buttons there but when I right click
I'm working on a Wicket-based web application. In the application there are buttons that
there are some buttons on the top of the winform, and when I click
In my app there is requirement that..I have 6 buttons in a nib, when
my app has three buttons that each create a new intent like this: Button
hey in my screen there is a an edit field and 2 custom button
In my application - there are four buttons named as follows: Top - left
I have a webpage where there are two buttons and a textbox. When the
Is there a way to hide radio buttons inside a RadioButtonList control programmatically?

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.