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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:00:48+00:00 2026-06-15T19:00:48+00:00

help help..huu Im having a problem here..seems there was no error in codes..but when

  • 0

help help..huu

Im having a problem here..seems there was no error in codes..but when I run it…and click button to view map consist routing the map..It appers to be close all of sudden..why is that? Please help me friends..

Im developing an app to read my current location and creating route to A position..

here are the codes:

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

    onNewIntent(getIntent());

    Drawable marker = getResources().getDrawable(R.drawable.marker);
    Drawable marked_places = getResources().getDrawable(R.drawable.feringgi_map);

    mymap = (MapView)findViewById(R.id.mymap);
    controller = mymap.getController();
    // extract MapView from layout
    mymap.getController().setZoom(15);
    mymap.setBuiltInZoomControls(true);
    mymap.setSatellite(false);

    // create an overlay that shows our current location
    myLocationOverlay = new MyLocationOverlay(this, mymap);

    // add this overlay to the MapView and refresh it
    mymap.getOverlays().add(myLocationOverlay); 
    mymap.postInvalidate();

    myLocationOverlay.runOnFirstFix(new Runnable() {

        @Override
        public void run() {
            controller.setZoom(10);
            controller.animateTo(myLocationOverlay.getMyLocation());                
        }
    });

    zoomToMyLocation();

   switch(selecteditem)
   {
   case 0:        switch(selectedsubitem){
            case 0://Place A       
                    locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
                  locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
                  Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
                      if (location !=null) {
                      loc=location;
                  }
                  GeoPoint destination = getPoint(3.144341, 101.69541800000002);
                  new BackgroundTask(this, loc, destination).execute();
                break;              
}
}

 class BackgroundTask extends AsyncTask<Void, Void, Void> {

        private Location location;
        private GeoPoint dest;
        private Route route;
        private Activity activity;
        private ProgressDialog dialog;
        private RouteOverlay routeOverlay;

        public BackgroundTask(Activity activity, Location loc, GeoPoint dest) {
            location=loc; 
            this.dest=dest;
            this.activity=activity;
            dialog = new ProgressDialog(activity);
        }

        @Override
        protected void onPreExecute() {
            dialog.setCancelable(false);
            dialog.setTitle("Loading...");
            dialog.setMessage("Calculating Route...");
            dialog.setButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(final DialogInterface dialog, final int id) {
                  cancel(true);
                  MyMap.this.finish();
                }});
            dialog.show();
        }

protected Void doInBackground(Void... params) {
                if(isNetworkAvailable())
                {
                    if(haveInternet())
                    {   try{
                            route = directions(new GeoPoint((int)(location.getLatitude()*1.0E6),(int)(location.getLongitude()*1.0E6)), dest); 
                        }
                        catch (NullPointerException e){ }
                    }
                    else
                    {   return null;
                    }
                }
                else
                {   return null; }

                return null;
                }

And this is the log cat (updated).. :

    12-10 13:30:36.677: E/AndroidRuntime(13405): FATAL EXCEPTION: AsyncTask #1
12-10 13:30:36.677: E/AndroidRuntime(13405): java.lang.RuntimeException: An error occured while executing doInBackground()
12-10 13:30:36.677: E/AndroidRuntime(13405):    at android.os.AsyncTask$3.done(AsyncTask.java:278)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at java.lang.Thread.run(Thread.java:856)
12-10 13:30:36.677: E/AndroidRuntime(13405): Caused by: java.lang.SecurityException: ConnectivityService: Neither user 10228 nor current process has android.permission.ACCESS_NETWORK_STATE.
12-10 13:30:36.677: E/AndroidRuntime(13405):    at android.os.Parcel.readException(Parcel.java:1327)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at android.os.Parcel.readException(Parcel.java:1281)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:728)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:378)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at com.madcatworld.testtesttest.MyMap$BackgroundTask.isNetworkAvailable(MyMap.java:488)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at com.madcatworld.testtesttest.MyMap$BackgroundTask.doInBackground(MyMap.java:411)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at com.madcatworld.testtesttest.MyMap$BackgroundTask.doInBackground(MyMap.java:1)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at android.os.AsyncTask$2.call(AsyncTask.java:264)
12-10 13:30:36.677: E/AndroidRuntime(13405):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
12-10 13:30:36.677: E/AndroidRuntime(13405):    ... 5 more

this is the other half I havent post them here previously:

12-10 13:30:37.308: E/WindowManager(13405): Activity com.madcatworld.testtesttest.MyMap has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4254bb28 that was originally added here
12-10 13:30:37.308: E/WindowManager(13405): android.view.WindowLeaked: Activity com.madcatworld.testtesttest.MyMap has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4254bb28 that was originally added here
12-10 13:30:37.308: E/WindowManager(13405):     at android.view.ViewRootImpl.<init>(ViewRootImpl.java:344)
12-10 13:30:37.308: E/WindowManager(13405):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:267)
12-10 13:30:37.308: E/WindowManager(13405):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
12-10 13:30:37.308: E/WindowManager(13405):     at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
12-10 13:30:37.308: E/WindowManager(13405):     at android.view.Window$LocalWindowManager.addView(Window.java:537)
12-10 13:30:37.308: E/WindowManager(13405):     at android.app.Dialog.show(Dialog.java:278)
12-10 13:30:37.308: E/WindowManager(13405):     at com.madcatworld.testtesttest.MyMap$BackgroundTask.onPreExecute(MyMap.java:406)
12-10 13:30:37.308: E/WindowManager(13405):     at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:561)
12-10 13:30:37.308: E/WindowManager(13405):     at android.os.AsyncTask.execute(AsyncTask.java:511)
12-10 13:30:37.308: E/WindowManager(13405):     at com.madcatworld.testtesttest.MyMap.onCreate(MyMap.java:108)
12-10 13:30:37.308: E/WindowManager(13405):     at android.app.Activity.performCreate(Activity.java:4465)
12-10 13:30:37.308: E/WindowManager(13405):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
12-10 13:30:37.308: E/WindowManager(13405):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
12-10 13:30:37.308: E/WindowManager(13405):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
12-10 13:30:37.308: E/WindowManager(13405):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
12-10 13:30:37.308: E/WindowManager(13405):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
12-10 13:30:37.308: E/WindowManager(13405):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-10 13:30:37.308: E/WindowManager(13405):     at android.os.Looper.loop(Looper.java:137)
12-10 13:30:37.308: E/WindowManager(13405):     at android.app.ActivityThread.main(ActivityThread.java:4424)
12-10 13:30:37.308: E/WindowManager(13405):     at java.lang.reflect.Method.invokeNative(Native Method)
12-10 13:30:37.308: E/WindowManager(13405):     at java.lang.reflect.Method.invoke(Method.java:511)
12-10 13:30:37.308: E/WindowManager(13405):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
12-10 13:30:37.308: E/WindowManager(13405):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
12-10 13:30:37.308: E/WindowManager(13405):     at dalvik.system.NativeStart.main(Native Method)

This is my manifest file:

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.madcatworld.testtesttest"
        android:versionCode="1"
        android:versionName="1.0" >

        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="15" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.CALL_PHONE"/>
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

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

            <com.google.android.maps.MapView
            android:id="@+id/mymap"
            android:clickable="true"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:apiKey="XXXX"
            />       

            <activity
                android:theme="@style/StyledIndicators"
                android:name=".MainTest"
                android:label="@string/title_activity_main" 
                android:screenOrientation="portrait">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <uses-library android:name="com.google.android.maps"/>
            <activity android:name="A"
                android:screenOrientation="portrait"></activity>
            <activity android:name="B"
                android:screenOrientation="portrait"></activity>
            <activity android:name="C"
                android:screenOrientation="portrait"></activity>
        </application>

    </manifest>

For your information, I already put ACCESS_NETWORK_STATE in my manifest..

Can u discover what cause the error? No error in code..but it failed to review my route map..:( Thanks Friends

  • 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-15T19:00:49+00:00Added an answer on June 15, 2026 at 7:00 pm

    E/AndroidRuntime(5368): Caused by: java.lang.SecurityException:
    ConnectivityService: Neither user 10228 nor current process has
    android.permission.ACCESS_NETWORK_STATE.

    make sure you have added android.permission.ACCESS_NETWORK_STATE permission in AndroidManifest.xml file as

    <manifest xlmns:android...>
     ...
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    </manifest>
    

    EDIT :

    remove

    <com.google.android.maps.MapView
    android:id="@+id/mymap"
    android:clickable="true"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:apiKey="XXXX"
    />  
    

    this code from AndroidManifest.xml and put it inside any xml layout within res/layout folder in your project

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

Sidebar

Related Questions

Help me translate following block of the Haskell code. The run function produces text
Help! I'm using the ASP.Net Login control on a Login page, but the Login
Help me settle an argument here. Is this: SqlCommand cmd = new SqlCommand( sql
Help me please. I have problem with encoding response string after GET request: var
help me please i'm having the following issue: I'm trying to read a XML
Help! I'm porting a large ruby app to Grails - but the Grails startup
Help- Any idea what would cause sharepoint's doc library's tree view navigation to break?
Help me with my problem,please! I used CouchDB, and i used jquery.couch.js to communicate
Help will be most appreciated. This is the code from the Jquery website <button
HELP! I need help setting up tipsy I had it working earlier but now

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.