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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:50:01+00:00 2026-05-29T22:50:01+00:00

I’m trying to make an App with three options in a menu. One of

  • 0

I’m trying to make an App with three options in a menu.

One of them is a Google maps view.
When I click on the Map option of the menu the app will crash.

import android.app.Activity;
import android.content.Context;
import android.content.Intent; 
import android.content.res.TypedArray;
import android.os.Bundle; 
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import com.google.android.maps.MapActivity;
import android.widget.AdapterView.OnItemClickListener;

public class GalleryView extends Activity {
    Integer[] pics = {
        R.drawable.leiden1,
        R.drawable.leiden2,
        R.drawable.leiden3,
        R.drawable.leiden4,
        R.drawable.leiden5,
        R.drawable.leiden6,
        R.drawable.leiden7,
        R.drawable.leiden8,
        R.drawable.leiden9,
        R.drawable.leiden10,

    };

    ImageView imageView;

    private static final int MENU1 = Menu.FIRST;
    private static final int MENU2 = Menu.FIRST + 1;
    private static final int MENU3 = Menu.FIRST + 2;

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

        Gallery ga = (Gallery)findViewById(R.id.Gallery01);
        ga.setAdapter(new ImageAdapter(this));

        imageView = (ImageView)findViewById(R.id.ImageView01);
        ga.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                                    long arg3) {

                imageView.setImageResource(pics[arg2]);

            }

        });

    }


    public class ImageAdapter extends BaseAdapter {

        private Context ctx;
        int imageBackground;

        public ImageAdapter(Context c) {
            ctx = c;
            TypedArray ta = obtainStyledAttributes(R.styleable.Gallery1);
            imageBackground =  ta.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 1);
            ta.recycle();
        }

        @Override
        public int getCount() {

            return pics.length;
        }

        @Override
        public Object getItem(int arg0) {

            return arg0;
        }

        @Override
        public long getItemId(int arg0) {

            return arg0;
        }

        @Override
        public View getView(int arg0, View arg1, ViewGroup arg2) {
            ImageView iv = new ImageView(ctx);
            iv.setImageResource(pics[arg0]);
            iv.setScaleType(ImageView.ScaleType.FIT_XY);
            iv.setLayoutParams(new Gallery.LayoutParams(150,120));
            iv.setBackgroundResource(imageBackground);
            return iv;
        }

    }

    public boolean onCreateOptionsMenu(Menu menu) {
        menu.add(0, MENU1, 0, "Foto's");
        menu.add(0, MENU2, 0, "Teampagina");
        menu.add(0, MENU3, 0, "Route");
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case MENU1:
                Intent myIntent = new Intent(getBaseContext(), GalleryView.class);
                startActivityForResult(myIntent, 0);
                return true;
            case MENU2:
                Intent myIntent2 = new Intent(getBaseContext(), HelloSpinnerActivity.class);
                startActivityForResult(myIntent2, 0);
                return true;
            case MENU3:
                Intent myIntent3 = new Intent(getBaseContext(),  HelloGoogleMapsActivity.class);
                startActivityForResult(myIntent3, 0);
                return true;
        }
        return false;
    }
}

HelloGoogleMapsActivity.java

package me.hellospinner.app;

import java.util.List;

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;
import com.google.android.maps.MapActivity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class HelloGoogleMapsActivity extends MapActivity {

private static final int MENU1 = Menu.FIRST;
private static final int MENU2 = Menu.FIRST + 1;
private static final int MENU3 = Menu.FIRST + 2;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main3);

    MapView mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    List<Overlay> mapOverlays = mapView.getOverlays();
    Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker);
    HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable, this);
    GeoPoint point = new GeoPoint(52184090, 4481470);
    OverlayItem overlayitem = new OverlayItem(point, "Leidsche En Oegstgeester Hockey Club ","Hofbrouckerlaan 51 2341 LL Oegstgeest");

            itemizedoverlay.addOverlay(overlayitem);


    mapOverlays.add(itemizedoverlay);
    }
@Override
protected boolean isRouteDisplayed() {
    return false;
}
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(0, MENU1, 0, "Foto's");
    menu.add(0, MENU2, 0, "Teampagina");
    menu.add(0, MENU3, 0, "Route");
    return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case MENU1:
        Intent myIntent = new Intent(getBaseContext(), GalleryView.class);
        startActivityForResult(myIntent, 0);
    return true;
    case MENU2:
    Intent myIntent2 = new Intent(getBaseContext(), HelloSpinnerActivity.class);
    startActivityForResult(myIntent2, 0);
    return true;
    case MENU3:
      Intent myIntent3 = new Intent(getBaseContext(), HelloGoogleMapsActivity.class);
     startActivityForResult(myIntent3, 0);



        return true;

}
    return false;
}
}

LogCat

02-14 19:25:20.866: E/AndroidRuntime(234): Uncaught handler: thread main exiting due to uncaught exception
02-14 19:25:20.885: E/AndroidRuntime(234): android.content.ActivityNotFoundException: Unable to find explicit activity class {me.hellospinner.app/me.hellospinner.app.HelloGoogleMapsActivity}; have you declared this activity in your AndroidManifest.xml?
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.app.Activity.startActivityForResult(Activity.java:2749)
02-14 19:25:20.885: E/AndroidRuntime(234):  at me.hellospinner.app.HelloSpinnerActivity.onOptionsItemSelected(HelloSpinnerActivity.java:73)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.app.Activity.onMenuItemSelected(Activity.java:2170)
02-14 19:25:20.885: E/AndroidRuntime(234):  at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730)
02-14 19:25:20.885: E/AndroidRuntime(234):  at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:139)
02-14 19:25:20.885: E/AndroidRuntime(234):  at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
02-14 19:25:20.885: E/AndroidRuntime(234):  at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:525)
02-14 19:25:20.885: E/AndroidRuntime(234):  at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.view.View.onTouchEvent(View.java:4179)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.widget.TextView.onTouchEvent(TextView.java:6540)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.view.View.dispatchTouchEvent(View.java:3709)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-14 19:25:20.885: E/AndroidRuntime(234):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.os.Looper.loop(Looper.java:123)
02-14 19:25:20.885: E/AndroidRuntime(234):  at android.app.ActivityThread.main(ActivityThread.java:4363)
02-14 19:25:20.885: E/AndroidRuntime(234):  at java.lang.reflect.Method.invokeNative(Native Method)
02-14 19:25:20.885: E/AndroidRuntime(234):  at java.lang.reflect.Method.invoke(Method.java:521)
02-14 19:25:20.885: E/AndroidRuntime(234):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
02-14 19:25:20.885: E/AndroidRuntime(234):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
02-14 19:25:20.885: E/AndroidRuntime(234):  at dalvik.system.NativeStart.main(Native Method)
02-14 19:25:20.905: I/dalvikvm(234): threadid=7: reacting to signal 3
02-14 19:25:20.905: E/dalvikvm(234): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
02-14 19:25:22.839: I/Process(234): Sending signal. PID: 234 SIG: 9

I hope someone can help me out

  • 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-29T22:50:02+00:00Added an answer on May 29, 2026 at 10:50 pm

    The answer is in the error log I guess, “have you declared this activity in your AndroidManifest.xml?”

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.