system crash when enable mock location on My Samsung i9000 2.2(ZSJPE)

by Evan » Tue, 09 Nov 2010 02:54:34 GMT


Sponsored Links
 Dear all
I got a crash from logcat when I enable mock location in my program.
when I call enableMockLocation(true) but no update,the system is crash
and reboot.
the same program is working on 2.1(ZSJG4)

Exeception:

11-08 15:57:23.474: ERROR/AndroidRuntime(7336): *** FATAL EXCEPTION IN
SYSTEM PROCESS: GpsLocationProvider
11-08 15:57:23.474: ERROR/AndroidRuntime(7336):
java.lang.NullPointerException
11-08 15:57:23.474: ERROR/AndroidRuntime(7336):     at
com.android.internal.location.GpsLocationProvider$HybridGps.access
$900(GpsLocationProvider.java:1676)
11-08 15:57:23.474: ERROR/AndroidRuntime(7336):     at
com.android.internal.location.GpsLocationProvider.stopNavigating(GpsLocationProvider.java:
1227)
11-08 15:57:23.474: ERROR/AndroidRuntime(7336):     at
com.android.internal.location.GpsLocationProvider.handleEnableLocationTracking(GpsLocationProvider.java:
968)
11-08 15:57:23.474: ERROR/AndroidRuntime(7336):     at
com.android.internal.location.GpsLocationProvider.access
$7600(GpsLocationProvider.java:116)
11-08 15:57:23.474: ERROR/AndroidRuntime(7336):     at
com.android.internal.location.GpsLocationProvider
$ProviderHandler.handleMessage(GpsLocationProvider.java:2224)
11-08 15:57:23.474: ERROR/AndroidRuntime(7336):     at
android.os.Handler.dispatchMessage(Handler.java:99)
11-08 15:57:23.474: ERROR/AndroidRuntime(7336):     at
android.os.Looper.loop(Looper.java:123)
11-08 15:57:23.474: ERROR/AndroidRuntime(7336):     at
com.android.internal.location.GpsLocationProvider
$GpsLocationProviderThread.run(GpsLocationProvider.java:2263)

the partial code is:
    public void enableMockLocation(boolean bEnable) {

        m_bMockLocation = bEnable;
        if(m_bMockLocation)
        {
            Log.e(LOG_TAG, "enableMockLocation 01");
            m_Handler.obtainMessage(MSG_TOAST,"Mock location
enable.").sendToTarget();
            m_LocationManager.addTestProvider(m_szMockProvider,
                    false,    // requiresNetwork
                    true,    // requiresSatellite
                    false,    // requiresCell
                    false,    // hasMonetaryCost
                    false,    // supportsAltitude
                    false,    // supportsSpeed
                    false,    // supportsBearing
                    0,        // powerRequirement
                    5);       // accuracy
            Log.e(LOG_TAG, "enableMockLocation 03" +
m_szMockProvider);
            m_LocationManager.setTestProviderEnabled(m_szMockProvider,
true);
            Log.e(LOG_TAG, "enableMockLocation 04" +
m_szMockProvider);

        }else
        {
            m_Handler.obtainMessage(MSG_TOAST,"Mock location
disable.").sendToTarget();
            m_LocationManager.setTestProviderEnabled(m_szMockProvider,
false);
 
m_LocationManager.clearTestProviderEnabled(m_szMockProvider);
 
m_LocationManager.clearTestProviderLocation(m_szMockProvider);
 
m_LocationManager.clearTestProviderStatus(m_szMockProvider);
            m_LocationManager.removeTestProvider(m_szMockProvider);

        }
    }



any suggestion?
thanks

--



Other Threads

1. How to access an Activites Menu programatically?

I'm writing unit tests in a class derived from
ActivityInstrumentationTestCase2. I know I can access anything defined
in the applications XML using findViewById(), but this application
defines its Menu programmatically. I'm trying to access that menu so I
can fire click() events to it in my tests the same way I'm doing with
Button Views etc.

To illustrate, this works fine and shows I can control/test various
Views:

public void testMyAppEdit() {
        MyAppActivity main = (MyAppActivity) getActivity();

        EditText val1Edit = (EditText) main.findViewById(R.id.EditText1);
        val1Edit.setText("3");

        Button addButton = (Button) main.findViewById(R.id.ButtonAdd);
        addButton.performClick();

        TextView resultText = (TextView) main.findViewById(R.id.Result);

        assertEquals("Result incorrect", resultText.getText(), "3");
}

But I need to do the same to fire Menu events:

public void testMyAppAboutBox() {
        MyAppActivity main = (MyAppActivity) getActivity();

        // Huh? this menu has no id, and no obvious way of accessing it...
        //Menu menu = (Menu) main.findViewById(id);
...
}

Thanks.

--
Android Academy http://www.androidacademy.com
--~--~---------~--~----~------------~-------~--~----~

2. active objects problem

Hi All,

   I'm facing a problem with creating active objects inside open core
node, i've a crash during constructing one and on AddToScheduler()
call inside ThreadLogon(). Here is a code example:

class Cmynode : public OsclTimerObject,
                         public PVMFNodeInterface,
                         public OsclTimerObserver,
                         ........
{
public:
Cmynode( int32 &aPriority )
: OsclTimerObject(aPriority, "MyNode")
{
    int32 err;
    OSCL_TRY(err,
                      m_pMyTimer = OSCL_NEW
( OsclTimer<OsclMemAllocator>,
                      ("MyTimer") );            // crash on
constructing

               // timer initialization
    );
}

~Cmynode() {
    //destructor code
}
        // PVMFNodeInterface implementation
public:
        virtual PVMFStatus ThreadLogon() {

                         if ( !IsAdded() ) {
                AddToScheduler();   // crash in this call
                 }

                     return PVMFSuccess;
                }

        virtual PVMFStatus ThreadLogoff() {

                 if ( IsAdded() ) {

                                Cancel();
                        RemoveFromScheduler();
                 }

                     return PVMFSuccess;
                }

// OsclTimerObject implementation
protected:
    virtual void Run() {
    }

private:
   OsclTimer<OsclMemAllocator> *m_pMyTimer;
};

--
 Best regards.

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. How to handle widget's "Long Click" event on home screen?

4. Can't catch OutOfMemoryException ?

5. seek in 3gp clip

6. How to identify the current InputMethod language?

7. Slow to load remote image