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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:51:26+00:00 2026-06-12T21:51:26+00:00

I have been learning about google maps api from here and did exactly what

  • 0

I have been learning about google maps api from here and did exactly what was said..
My mainactivity code is as follows:

package com.map.place;

import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.MapActivity;

public class MainActivity extends MapActivity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}

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

The main.xml is as follows:

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="0Ove92B2I7FZi4SR2YX89jA374Wcg6-cJ33VwUg"
/>

lastly the manifest file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.map.place"
  android:versionCode="1"
  android:versionName="1.0">
      <uses-sdk android:minSdkVersion="10" />
<application android:label="@string/app_name" >
    <activity android:name="MainActivity"
              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>
<uses-permission android:name="android.permission.INTERNET" />
</manifest> 

The logcat console was showing as follows:

E/AndroidRuntime(  975): FATAL EXCEPTION: main
E/AndroidRuntime(  975): java.lang.RuntimeException: Unable to instantiate activ
ity ComponentInfo{com.map.place/com.map.place.MainActivity}: java.lang.ClassNotF
oundException: com.map.place.MainActivity in loader dalvik.system.PathClassLoade
r[/data/app/com.map.place-2.apk]

I don’t know what was wrong, but this was displaying Sorry, the app stopped unexpectedly.
I was running it on an avd with 2.3.3 platform and API level 10. Plz correct me…

  • 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-06-12T21:51:27+00:00Added an answer on June 12, 2026 at 9:51 pm

    I use your code and make it runnable, Below is running code. Only change your Map API key : Try it…and use emulator and android version with google API like android 2.2 google API
    It also include zooming controls:
    main.xml :

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#008000"
    android:orientation="vertical" >
    
        <com.google.android.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:enabled="true"
        android:clickable="true"
        android:apiKey="0twJXMQDHBfxjMnb77nwRzKs29kGZdRkcG3_Z8Q" />
    
        <LinearLayout android:id="@+id/zoom" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_alignParentBottom="true" 
            android:layout_centerHorizontal="true" 
           /> 
    
    
    </RelativeLayout>
    

    your manifest.xml file :

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.map.place"
        android:versionCode="1"
        android:versionName="1.0" >
    
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />
     <uses-permission android:name="android.permission.INTERNET" />
    
     <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <uses-library
            android:name="com.google.android.maps"
            android:required="true" />
     </application>
     </manifest>
    

    MainActivity.java :

    package com.map.place;
    import android.os.Bundle;
    import android.support.v4.view.ViewPager.LayoutParams;
    import android.view.KeyEvent;
    import android.view.View;
    import android.widget.LinearLayout;
    import com.google.android.maps.GeoPoint;
    import com.google.android.maps.MapActivity;
    import com.google.android.maps.MapController;
    import com.google.android.maps.MapView;
    
    public class MainActivity extends MapActivity{
    
    //===========
    MapView mapView;
    public static String latitude,longitude;
    
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    
    mapView = (MapView) findViewById(R.id.mapView);
    mapView.setSatellite(false);
    LinearLayout zoomLayout = (LinearLayout) findViewById(R.id.zoom);
    View zoomView = mapView.getZoomControls();
    
    zoomLayout.addView(zoomView, new     
    LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    mapView.displayZoomControls(true);
    mapView.invalidate();
    
    }
    
    // Below is the code when the user presses the number 3 on the keyboard the
    // map  will zoom in into the next level. Pressing number 1 will zoom out one
    // level.
    
    public boolean onKeyDown(int keyCode, KeyEvent event) {
    MapController mc = mapView.getController();
    switch (keyCode) {
    case KeyEvent.KEYCODE_3:
        mc.zoomIn();
        break;
    case KeyEvent.KEYCODE_1:
        mc.zoomOut();
        break;
    }
    return super.onKeyDown(keyCode, event);
    }
    
    
    @Override
    protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
    }
    
    }
    //By Umesh Suryawanshi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been learning about Delegation and Data Sources for iOS programming and need
Recently I have been learning about WMI and WQL. I found out the list
I have been learning the Definitive Guide of JavaScript.i got a question about the
I am currently learning about basic networking in java. I have been playing around
I've been learning wpf for about a week now.. and i have a basic
I have been learning about various functional languages for some time now including Haskell,
I have been learning about TDD (using JUnit) and I have a doubt about
I have recently been learning more about design patterns and thought I'd take a
As of last night, I decided to start learning about WPF and have been
I've been learning about DRY code and my code isn't DRY... For example, 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.