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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:11:11+00:00 2026-05-31T02:11:11+00:00

i tried every code and every question here to find error every time i

  • 0

i tried every code and every question here to find error every time i fix something-something else break down and square boxes of grid cover all the map if i click on it all i need is while clicking on map draw mark and get address in textview using GPS and this output looks like this and i tested my internet connection to emulator and it works

here is logcat errors:

   01-23 03:37:52.868: E/MapActivity(309): Couldn't get connection factory client
   01-23 03:37:53.979: E/QemuSensors(309): data__poll: len=-1, errno=9: Bad file number
   01-23 03:37:53.979: E/QemuSensors(309): data__poll: len=-1, errno=9: Bad file number
   01-23 03:37:53.989: E/QemuSensors(309): data__poll: len=-1, errno=9: Bad file number
   01-23 03:37:53.989: E/QemuSensors(309): data__poll: len=-1, errno=9: Bad file number

here is code:

public class Map extends MapActivity implements LocationListener {

MapView map = null;
long start;
long end;
MyLocationOverlay compass = null;
MapController c;
int x, y;
GeoPoint g;
Drawable d;
LocationManager n;
int lati = 0;
int longi = 0;
Customize cus;
Drawable drawable;
OverlayItem f;
Location location;
String add = "";
Criteria m;

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.map);
    map = (MapView) findViewById(R.id.mapid);
    map.getController();
    map.setBuiltInZoomControls(true);
    map.setStreetView(true);
    map.getController().setZoom(19);
    // map.setTraffic(true);

    d = getResources().getDrawable(R.drawable.blue);
    d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
    drawable = this.getResources().getDrawable(R.drawable.red);
    drawable.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());

    map.getOverlays().add(new Customize(d));
    compass = new MyLocationOverlay(Map.this, map);
    map.getOverlays().add(compass);

    getLastLocation();

}

public void getLastLocation() {
    String provider = getBestProvider();
    location = n.getLastKnownLocation(provider);

    if (location != null) {
        setCurrentLocation(location);
    } else {
        Toast.makeText(this, "Location not yet acquired", Toast.LENGTH_LONG)
                .show();
    }
    ((TextView) findViewById(R.id.providerid)).setText("Provider :"
            + getBestProvider());

}

public String getBestProvider() {

    n = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    m = new Criteria();
    m.setPowerRequirement(Criteria.NO_REQUIREMENT);
    m.setAccuracy(Criteria.NO_REQUIREMENT);
    String bestProvider = n.getBestProvider(m, false);
    return bestProvider;
}

@Override
protected void onPause() {
    compass.disableCompass();
    super.onPause();
    n.removeUpdates(this);

}

@Override
protected void onResume() {
    compass.enableCompass();
    super.onResume();
    n.requestLocationUpdates(getBestProvider(), 500, 1, this);
}

class maps extends Overlay {
    @Override
    public boolean onTouchEvent(MotionEvent event, MapView mapView) {
        // ---when user lifts his finger---

        if (event.getAction() == 1) {
            g = mapView.getProjection().fromPixels((int) event.getX(),
                    (int) event.getY());
            Geocoder geoCoder = new Geocoder(getBaseContext(),
                    Locale.getDefault());
            try {
                List<Address> addresses = geoCoder.getFromLocation(
                        g.getLatitudeE6() / 1E6, g.getLongitudeE6() / 1E6,
                        1);

                if (addresses.size() > 0) {
                    for (int i = 0; i < addresses.get(0)
                            .getMaxAddressLineIndex(); i++)
                        add += addresses.get(0).getAddressLine(i) + "\n";
                    ((TextView) findViewById(R.id.address)).setText(add);

                }

            } catch (IOException e) {
                e.printStackTrace();
            }
            return true;
        }
        return false;

    }

    /*
     * public boolean draw(Canvas canvas, MapView mapView, boolean shadow,
     * long when) {
     * 
     * try{ super.draw(canvas, mapView, shadow); //---translate the GeoPoint
     * to screen pixels--- g= new GeoPoint( (int) (lati * 1E6), (int) (longi
     * * 1E6)); Point screenPts = new Point();
     * mapView.getProjection().toPixels(g, screenPts); //---add the
     * marker--- Bitmap bmp = BitmapFactory.decodeResource( getResources(),
     * R.drawable.blue); canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50,
     * null); } catch(Exception h){
     * 
     * h.printStackTrace(); } finally{
     * 
     * map.setSatellite(!map.isSatellite());
     * 
     * }
     * 
     * 
     * return true; }
     */

}

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

public void setCurrentLocation(Location location) {
    lati = (int) (location.getLatitude() * 1E6);
    longi = (int) (location.getLongitude() * 1E6);
    g = new GeoPoint(lati, longi);

    map.getOverlays().add(new Customize(drawable));

}

@Override
public void onLocationChanged(Location arg0) {

    setCurrentLocation(arg0);

}

@Override
public void onProviderDisabled(String provider) {
    // TODO Auto-generated method stub
    Toast.makeText(this, "Provider Disabled", Toast.LENGTH_SHORT).show();

}

@Override
public void onProviderEnabled(String provider) {
    // TODO Auto-generated method stub
    Toast.makeText(this, "Provider Enabled", Toast.LENGTH_SHORT).show();

}

@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    // TODO Auto-generated method stub
    Toast.makeText(this, "Staus Changed", Toast.LENGTH_SHORT).show();

}

private GeoPoint getPoint(double lat, double lon) {
    return (new GeoPoint((int) (lat * 1000000.0), (int) (lon * 1000000.0)));
}

public class Customize extends ItemizedOverlay<OverlayItem> {

    ArrayList<OverlayItem> ar = new ArrayList<OverlayItem>();

    private Drawable defaultMarker = null;

    public Customize(Drawable defaultMarker) {
        super(defaultMarker);
        this.defaultMarker = defaultMarker;

        boundCenterBottom(defaultMarker);

        ar.add(new OverlayItem(getPoint(40.748963847316034,
                -73.96807193756104), "UN", "United Nations"));
        ar.add(new OverlayItem(getPoint(40.76866299974387,
                -73.98268461227417), "Lincoln Center",
                "Home of Jazz at Lincoln Center"));
        ar.add(new OverlayItem(getPoint(40.765136435316755,
                -73.97989511489868), "Carnegie Hall",
                "Where you go with practice, practice, practice"));
        ar.add(new OverlayItem(getPoint(40.70686417491799,
                -74.01572942733765), "The Downtown Club",
                "Original home of the Heisman Trophy"));
        ar.add(new OverlayItem(getPoint(lati, longi), " ", " "));

        populate();
    }

    @Override
    protected OverlayItem createItem(int i) {
        // TODO Auto-generated method stub
        return ar.get(i);
    }

    @Override
    public int size() {
        // TODO Auto-generated method stub
        return ar.size();
    }

    protected boolean onTap(int i) {

        Toast.makeText(Map.this, ar.get(i).getSnippet(), Toast.LENGTH_SHORT)
                .show();
        return (true);
    }

}
}

manifest:

<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<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:label="@string/app_name"
        android:name=".ShareActivity" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:label="@string/app_name"
        android:name=".Map" >
        <intent-filter >
            <action android:name="com.share.MAP" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>     
  • 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-31T02:11:12+00:00Added an answer on May 31, 2026 at 2:11 am

    I figured out that my map key was wrong and this was causing map not appearing with white grid

    i needed to add path of keytool in C drive to my path that’s

    Control Panel\All Control Panel 
    Items\System\Environment Variables
    

    and use this command in cmd to get key

    keytool -list -alias androiddebugkey -keystore "Path to your debug.keystore" -storepass android -keypass android 
    

    and finally i got the correct key 🙂

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

Sidebar

Related Questions

I tried decoding this base64 string so many times but every time i get
Novice question here. I'm working on finding every single combination of various string elements,
This question has been asked many times, but I tried every solution and none
Swiftly following on from my last TripleDES-related question , here's my TripleDES wrapper code,
I've seen almost every question about similar issues, and tried the given answers, but
Over the years, I think I have seen and tried every conceivable way of
In every MVC framework I've tried (Rails, Merb, Waves, Spring, and Struts), the idea
I tried setting the defaultvalue property of the field to Guid.NewGuid() but every item
Such a junit : @Test public void testA { //some code here... } @Test
The following code is pretty self-explanatory and my question is very simple : Why

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.