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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:34:19+00:00 2026-06-09T17:34:19+00:00

I have a code for finding user current location.When i was running my code

  • 0

I have a code for finding user current location.When i was running my code in android 1.6 i got output.But i was running in android 2.3 i got error only.what is the problem for my code.

Logcat:

08-15 23:03:39.612: E/AndroidRuntime(403): FATAL EXCEPTION: main
08-15 23:03:39.612: E/AndroidRuntime(403): java.lang.NullPointerException
08-15 23:03:39.612: E/AndroidRuntime(403):  at com.android.locationspeecher.MyPositionOverlay.draw(MyPositionOverlay.java:25)
08-15 23:03:39.612: E/AndroidRuntime(403):  at com.google.android.maps.Overlay.draw(Overlay.java:179)
08-15 23:03:39.612: E/AndroidRuntime(403):  at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:45)
08-15 23:03:39.612: E/AndroidRuntime(403):  at com.google.android.maps.MapView.onDraw(MapView.java:530)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.View.draw(View.java:6880)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.View.draw(View.java:6883)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.widget.FrameLayout.draw(FrameLayout.java:357)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.View.draw(View.java:6883)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.widget.FrameLayout.draw(FrameLayout.java:357)
08-15 23:03:39.612: E/AndroidRuntime(403):  at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1862)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewRoot.draw(ViewRoot.java:1522)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1258)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.os.Looper.loop(Looper.java:130)
08-15 23:03:39.612: E/AndroidRuntime(403):  at android.app.ActivityThread.main(ActivityThread.java:3683)
08-15 23:03:39.612: E/AndroidRuntime(403):  at java.lang.reflect.Method.invokeNative(Native Method)
08-15 23:03:39.612: E/AndroidRuntime(403):  at java.lang.reflect.Method.invoke(Method.java:507)
08-15 23:03:39.612: E/AndroidRuntime(403):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-15 23:03:39.612: E/AndroidRuntime(403):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-15 23:03:39.612: E/AndroidRuntime(403):  at dalvik.system.NativeStart.main(Native Method)

Here my MyPositionOverlay code:

public class MyPositionOverlay extends Overlay {

    Location location;
    private final int mRadius=5;

    @Override
    public void draw(Canvas canvas,MapView mapView,boolean shadow){

        Projection projection=mapView.getProjection();

        if(shadow==false){
            Double latitude=location.getLatitude()*1E6;
            Double longitude=location.getLongitude()*1E6;

            GeoPoint geoPoint;
             geoPoint=new GeoPoint(latitude.intValue(),longitude.intValue());

             Point point=new Point();
             projection.toPixels(geoPoint, point);

             RectF oval=new RectF(point.x - mRadius,point.y - mRadius,point.x + mRadius,point.y + mRadius);

             Paint paint=new Paint();
             paint.setARGB(250, 255, 255, 255);
             paint.setAntiAlias(true);
             paint.setFakeBoldText(true);

             Paint backPaint=new Paint();
             backPaint.setARGB(175, 50, 50, 50);
             backPaint.setAntiAlias(true);

             RectF backRect=new RectF(point.x + 2 + mRadius, point.y - 3*mRadius,point.x + 65, point.y + mRadius);

             canvas.drawOval(oval, paint);
             canvas.drawRoundRect(backRect, 5, 5, backPaint);
             canvas.drawText("Here I Am", point.x + 2*mRadius, point.y, paint);
        }
        super.draw(canvas, mapView, shadow);


        }

    @Override
    public boolean onTap(GeoPoint point,MapView mapView){
        return false;
    }


public Location getLocation(){

    return location;

}
public void setLocation(Location location){
    this.location=location;
}


}
  • 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-09T17:34:20+00:00Added an answer on June 9, 2026 at 5:34 pm

    You have a null pointer exception. It looks like something you are trying to draw is null. Do you have your drawables in a specific resolution folder? Like drawable-ldpi.

    If that is the case, the 2.3 emulator could have a different resolution profile (probably mdpi) causing that drawable to be null.

    At any rate, you need to go to that line of code and find out what is null, and then find out why.

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

Sidebar

Related Questions

In Android, I have some code to check whether the user has GPS switched
I have been successful in finding code for spawning a vim editor and creating
I have trouble finding way to correctly refactor this code so that there would
I have code that generates a List<string[]> variable but can't quite figure out how
I have code that looks more or less like the code below but it
I have the following jQuery code for finding the sum of all table rows,
This code worked (correctly reflected the user's current timezone) back in the aspx version.
First time user here. I am usually capable of finding answers for questions but
I am finding many solutions to this seemingly common problem, but alas, none seem
I have a need to run different code when a user clicks or double-clicks

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.