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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:02:43+00:00 2026-06-15T22:02:43+00:00

I’m Trying to make Google Map search by address here is my code for

  • 0

I’m Trying to make Google Map search by address

here is my code for cari.java

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

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


import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class cari extends com.google.android.maps.MapActivity {

       TextView error,pt;
       EditText cm;
       String i,returnStringLancar,stat;
       Geocoder geoCoder;
       GeoPoint p;
       MapController controller;
       MapView map;
        /** Called when the activity is first created. */

       @Override


        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.search);

            pt=(TextView)findViewById(R.id.peta);
            cm=(EditText)findViewById(R.id.cariMap);




       }

       public void clickHandler(View view){
           Intent a = null;
            switch (view.getId()){
            case R.id.show:
                geoCoder = new Geocoder(getApplicationContext(),
                        Locale.getDefault());
                List<Address> addresses;
                try {
                    addresses = geoCoder.getFromLocationName(cm.getText().toString(),5);
                if(addresses.size() > 0)
                {
                     p = new GeoPoint( (int) (addresses.get(0).getLatitude() * 1E6), 
                                      (int) (addresses.get(0).getLongitude() * 1E6));

                       controller.animateTo(p);
                       controller.setZoom(12);

                       MapOverlay mapOverlay = new MapOverlay();
                     List<Overlay> listOfOverlays = map.getOverlays();
                     listOfOverlays.clear();
                     listOfOverlays.add(mapOverlay);

                       map.invalidate();
                       cm.setText("");
                }
                else
                {
                        AlertDialog.Builder adb = new AlertDialog.Builder(cari.this);
                        adb.setTitle("Google Map");
                        adb.setMessage("Please Provide the Proper Place");
                        adb.setPositiveButton("Close",null);
                        adb.show();
                }
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
                break;
       }
       }

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

and this is my MapOverlay.java

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import android.os.Bundle;

class MapOverlay extends com.google.android.maps.Overlay
{
    Context context;
    GeoPoint p;
    public boolean draw(Canvas canvas, MapView mapView, 
    boolean shadow, long when) 
    {
        super.draw(canvas, mapView, shadow);                   

        //---translate the GeoPoint to screen pixels---
        Point screenPts = new Point();
        mapView.getProjection().toPixels(p, screenPts);

        //---add the marker---
        Bitmap bmp = BitmapFactory.decodeResource(
            context.getResources(), R.drawable.icon);            
        canvas.drawBitmap(bmp, screenPts.x, screenPts.y-32, null);         
        return true;
    }
} 

This is my layout xml:

search.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android.autoText="true"
    />

<EditText 
android:text="Enter your address" 
android:id="@+id/address" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content">
</EditText>
<Button 
android:text="Search" 
android:id="@+id/launchmap" 
android:layout_width="150px" 
android:layout_height="wrap_content">
</Button>

</LinearLayout>

What I want is when I write name of one street in editText (example : 1152 1st Avenue) and press the search button, it will show the location (1152 1st Avenue) on a Google-map.

when i run this program,,,it says

” java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{udin.googlemap2/udin.googlemap2.GoogleMap2}:”

and this

“java.lang.ClassNotFoundException: udin.googlemap2.GoogleMap2 in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/udin.googlemap2-2.apk]”

can you help me?any help will i appreciate….Thanks anyway

  • 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-15T22:02:44+00:00Added an answer on June 15, 2026 at 10:02 pm

    Check whether<uses-library android:name="com.google.android.maps" /> is given in manifest..

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
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 am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms

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.