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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:17:45+00:00 2026-05-30T16:17:45+00:00

I am trying to animate in the MapView to a location by using Location

  • 0

I am trying to animate in the MapView to a location by using “Location Name” which is a “Country Name”. I am getting the exception:
IOException: Service not Available, Couldn't get connection factory client.

If you can’t see the pic then the exception is:: IOException: Service not Available with error Couldn’t get connection factory client.

the code I am using is as below:

public class ShowMapView extends MapActivity
{
    MapView mapView;
    MapController mapController;

String Country;

@Override
public void onCreate(Bundle bundleMap)
{
    super.onCreate(bundleMap);
    setContentView(R.layout.show_map);

    mapView = (MapView)findViewById(R.id.MapView);

    LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
    View zoomView = mapView.getZoomControls();

    zoomLayout.addView(zoomView,
            new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, 
            LayoutParams.WRAP_CONTENT));
    mapView.setBuiltInZoomControls(true);


    Intent intent = this.getIntent();
    Country = intent.getStringExtra("Country");

    Geocoder geocoder = new Geocoder(this, Locale.getDefault());
    Log.v("GEOCODER", geocoder.toString());

    try
    {
        Log.v("MAP", "TRY BLOCK");
        List<Address> address = geocoder.getFromLocationName(Country, 2);
        Log.v("MAP", "Country: "  + Country);
        if(address.size() > 0)
        {
            Log.v("MAP", "GeoPoint p");
            GeoPoint p = new GeoPoint((int)(address.get(0).getLatitude() * 1E6),
                                      (int)(address.get(0).getLongitude() * 1E6));
            Log.v("MAP", "L&L done");
            mapController.animateTo(p);         Log.v("MAP", "Animate to P");
            mapView.invalidate();               Log.v("MAP", "Invalidate()");
        }
    }
    catch(IOException e)
    {
        Log.v("MAP", "CATCH BLOCK");
        e.printStackTrace();
    }
}
@Override
protected boolean isRouteDisplayed()
{
    Log.v("MAP", "ROUTE: false");
    return false;
    }
}

The manifest file is as below::

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.project.LawSource"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>


    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >

        <uses-library android:name="com.google.android.maps"/>

        <activity
            android:name=".GetCountry"
            android:label="@string/app_label" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity 
            android:name="ShowMapView" 
            android:label="@string/app_name">

        </activity>
    </application>

</manifest>

I have worked according this tutorial, but it doesn’t work properly.

Let me know if I am missing something.

I am getting the problem as same as in this blog

Hoping for a solution.

Thanks in advance,

Haps.

  • 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-30T16:17:46+00:00Added an answer on May 30, 2026 at 4:17 pm

    Many posts on StackOverflow about that exception, such as: Service not Available – Geocoder Android . It may not be a problem with your code at all, the Geocoder will throw this exception from time to time based on server availability. You will need to handle that exception, possibly by falling back to using the Google Places API, as illustrated in this comment: https://stackoverflow.com/a/9173488/429047

    Once you have your GeoPoint, you can use MapController.animateTo(Geopoint) – http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MapController.html

    A simple example:

    Manifest:

    <uses-sdk android:minSdkVersion="10" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    
    
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
    
        <uses-library android:name="com.google.android.maps"/>
    
        <activity
            android:name=".TestGeocoderActivity"
            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>
    

    main.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
    
        <com.google.android.maps.MapView
            android:id="@+id/mapview"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:apiKey="<YOUR API KEY HERE>"
            android:clickable="true"
            android:drawingCacheQuality="auto"
            android:enabled="true" >
        </com.google.android.maps.MapView>
    
    </LinearLayout>
    

    TestGeocoderActivity.java

    package com.rd.TestGeocoder;
    
    import java.io.IOException;
    import java.util.List;
    import java.util.Locale;
    
    import android.content.Intent;
    import android.location.Address;
    import android.location.Geocoder;
    import android.os.Bundle;
    import android.util.Log;
    
    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 TestGeocoderActivity extends MapActivity {
        /** Called when the activity is first created. */
        MapView mapView;
        MapController mapController;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            String country = "Australia";
    
            mapView = (MapView) findViewById(R.id.mapview);
            mapView.setBuiltInZoomControls(true);
            mapController = mapView.getController();
    
            Intent intent = this.getIntent();
            if (intent.getStringExtra("country") != null) {
                country = intent.getStringExtra("country");
            }
    
            Geocoder geocoder = new Geocoder(this, Locale.getDefault());
            Log.v("GEOCODER", geocoder.toString());
    
            try {
                Log.v("MAP", "TRY BLOCK");
                List<Address> address = geocoder.getFromLocationName(country, 2);
                Log.v("MAP", "Country: " + country);
                if (address.size() > 0) {
                    Log.v("MAP", "GeoPoint p");
                    GeoPoint p = new GeoPoint(
                            (int) (address.get(0).getLatitude() * 1E6),
                            (int) (address.get(0).getLongitude() * 1E6));
                    Log.v("MAP", "L&L done:"+p.toString());
                    mapController.animateTo(p);
                    Log.v("MAP", "Animate to P");
                    mapView.invalidate();
                    Log.v("MAP", "Invalidate()");
                }
            } catch (IOException e) {
                Log.v("MAP", "CATCH BLOCK");
                e.printStackTrace();
            }
        }
    
        @Override
        protected boolean isRouteDisplayed() {
            Log.v("MAP", "ROUTE: false");
            return false;
        }
    
    }
    

    Obviously you would need to change the package name and fill in your api key

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

Sidebar

Related Questions

I'm trying to animate a block level element using jQuery. The page loads with
I'm trying to animate an image which is partly hidden (via overflow: hidden) inside
I'm trying to animate a private variable named radius, which works. However while its
I am trying to animate a table row sliding up, then adding a new
I am trying to animate an image using following code: [UIView beginAnimations:nil context:NULL]; [UIView
I am using a custom overlay on my MapView and I'm trying to imitate
I'm trying to animate drop up using negative top, the animation went okay, but
I'm trying to animate a UIWebview being removed from the screen. I'm using an
Background: I am trying to animate a rotating 3D scatter plot using R's lattice::cloud()
I am trying to animate a change in backgroundColor using jQuery on mouseover. 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.