English 中文(简体)
甲型六氯环己烷:活动类型
原标题:Android: ActivityThread.performLaunchActivity error

I m用 go光图工作。 当我第一次提出申请时,就会发现错误。 我点击了部队的近距离,再次照亮,第二次照亮。 这是我的标志:

08-17 07:06:35.288: ERROR/vold(26): Error opening switch name path  /sys/class/switch/test  (No such file or directory)
08-17 07:06:35.288: ERROR/vold(26): Error bootstrapping switch  /sys/class/switch/test  (No such file or directory)
08-17 07:06:35.288: ERROR/vold(26): Error opening switch name path  /sys/class/switch/test2  (No such file or directory)
08-17 07:06:35.288: ERROR/vold(26): Error bootstrapping switch  /sys/class/switch/test2  (No such file or directory)
08-17 07:06:43.888: ERROR/BatteryService(51): usbOnlinePath not found
08-17 07:06:43.888: ERROR/BatteryService(51): batteryVoltagePath not found
08-17 07:06:43.888: ERROR/BatteryService(51): batteryTemperaturePath not found
08-17 07:06:43.908: ERROR/SurfaceFlinger(51): Couldn t open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
08-17 07:06:47.309: ERROR/EventHub(51): could not get driver version for /dev/input/mouse0, Not a typewriter
08-17 07:06:47.309: ERROR/EventHub(51): could not get driver version for /dev/input/mice, Not a typewriter
08-17 07:06:47.539: ERROR/System(51): Failure starting core service
08-17 07:06:47.539: ERROR/System(51): java.lang.SecurityException
08-17 07:06:47.539: ERROR/System(51):     at android.os.BinderProxy.transact(Native Method)
08-17 07:06:47.539: ERROR/System(51):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
08-17 07:06:47.539: ERROR/System(51):     at android.os.ServiceManager.addService(ServiceManager.java:72)
08-17 07:06:47.539: ERROR/System(51):     at com.android.server.ServerThread.run(SystemServer.java:176)
08-17 07:06:47.548: ERROR/AndroidRuntime(51): Crash logging skipped, no checkin service
08-17 07:06:52.005: ERROR/ActivityThread(93): Failed to find provider info for android.server.checkin
08-17 07:06:52.905: ERROR/ActivityThread(93): Failed to find provider info for android.server.checkin
08-17 07:06:52.974: ERROR/ActivityThread(93): Failed to find provider info for android.server.checkin
08-17 07:06:54.728: ERROR/vold(26): Cannot start volume  /sdcard  (volume is not bound)
08-17 07:06:54.934: ERROR/MediaPlayerService(30): Couldn t open fd for content://settings/system/notification_sound
08-17 07:06:54.944: ERROR/MediaPlayer(51): Unable to to create media player
08-17 07:06:57.375: ERROR/ActivityThread(51): Failed to find provider info for com.google.settings
08-17 07:06:57.375: ERROR/ActivityThread(51): Failed to find provider info for com.google.settings
08-17 07:07:00.225: ERROR/AndroidRuntime(207): ERROR: thread attach failed
08-17 07:07:01.955: ERROR/AndroidRuntime(220): ERROR: thread attach failed
08-17 07:07:07.805: ERROR/ActivityThread(233): Failed to find provider info for com.google.settings
08-17 07:07:07.805: ERROR/ActivityThread(233): Failed to find provider info for com.google.settings
08-17 07:07:07.885: ERROR/ActivityThread(233): Failed to find provider info for com.google.settings
08-17 07:07:08.265: ERROR/AndroidRuntime(233): Uncaught handler: thread main exiting due to uncaught exception
08-17 07:07:08.275: ERROR/AndroidRuntime(233): java.lang.RuntimeException: Unable to start activity ComponentInfo{test.projekat/test.projekat.TrenutnaLokacija}: java.lang.NullPointerException
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at android.os.Looper.loop(Looper.java:123)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at android.app.ActivityThread.main(ActivityThread.java:4363)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at java.lang.reflect.Method.invokeNative(Native Method)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at java.lang.reflect.Method.invoke(Method.java:521)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at dalvik.system.NativeStart.main(Native Method)
08-17 07:07:08.275: ERROR/AndroidRuntime(233): Caused by: java.lang.NullPointerException
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at test.projekat.TrenutnaLokacija.onCreate(TrenutnaLokacija.java:91)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
08-17 07:07:08.275: ERROR/AndroidRuntime(233):     ... 11 more

我的问题是:

08-17 07:07:08.275: ERROR/AndroidRuntime(233): Caused by: java.lang.NullPointerException
    08-17 07:07:08.275: ERROR/AndroidRuntime(233):     at test.projekat.TrenutnaLokacija.onCreate(TrenutnaLokacija.java:90)

firstDot = new GeoPoint((int) (location.getLatitude()*1E6),(int) (location.getLongitude()*1E6));

我经过编辑的问题......这是我的法典......分配是无效的。 我开始对roid和roid电话进行跟踪。

public void onCreate(Bundle savedInstance){
        super.onCreate(savedInstance);
        setContentView(R.layout.pocetna);

        mapView = (MapView) findViewById(R.id.mapview);     
        textView = (TextView) findViewById(R.id.text1);     
        textView3 = (TextView) findViewById(R.id.textView2);
        mapController = mapView.getController();
        mapController.setZoom(17);      
        mapView.setStreetView(true);
        mapView.setBuiltInZoomControls(true);
        button = (Button) findViewById(R.id.button1);
        //mapView.setSatellite(true);       
        sb = (SeekBar) findViewById(R.id.seekBar1);

        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

        locationListener = new LocationListener() {

            @Override
            public void onStatusChanged(String provider, int status, Bundle extras) {

            }

            @Override
            public void onProviderEnabled(String provider) {                

            }

            @Override
            public void onProviderDisabled(String provider) {
                updateWithNewLocation(null);

            }

            @Override
            public void onLocationChanged(Location location) {              
//              TrenutnaLokacija.this.location =  location;
                updateWithNewLocation(location);    

            }
        };

        Criteria criteria = new Criteria();
        criteria.setPowerRequirement(Criteria.POWER_LOW);
        criteria.setAccuracy(Criteria.ACCURACY_FINE);
        provider = locationManager.getBestProvider(criteria, true);

        locationManager.requestLocationUpdates(provider, 0, 0, locationListener);


        try{
            location = locationManager.getLastKnownLocation(provider);

        }catch (IllegalArgumentException e) {
            Log.d("location", "Greska", e);
        }catch (SecurityException s) {
            Log.d("dsds", "Greska", s);
        }

        AlertDialog ad1 = new AlertDialog.Builder(this).create();
        ad1.setTitle("Greska");
        ad1.setMessage("Trenutno nisu ucitane lokacije");
        ad1.setButton(DialogInterface.BUTTON_POSITIVE, "Dozvoli", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface ad, int which) {

            }
        });

        if(location == null){
            ad1.show();
            Intent i = new Intent(TrenutnaLokacija.this, PronadjiKlopuActivity.class);
            startActivity(i);
        }



        GeoPoint firstDot = new GeoPoint((int) (location.getLatitude()*1E6),(int) (location.getLongitude()*1E6));

        myPosition = new NewItemizedOverlay(getResources().getDrawable(R.drawable.map_pin), firstDot);
        listOfOverlays = mapView.getOverlays();
        listOfOverlays.clear();
        listOfOverlays.add(myPosition);
最佳回答

你在TrenutnaLokacija的班级有1名Null Pointer例外。

通常,如果你指出有点可变,或者你正在从共有的优惠或其他类别呼吁中收回,如果你具体指出有点的话,回报就是无效的。

rel=“nofollow” http://www.javacoffeebreak.com/articles/toptenerors.html 请参看第1号。

EDIT

Because you say it runs fine second time, it sounds like your trying to get a location but it has not loaded yet in your onCreate()

It is possible location is null here:

 location.getLatitude();
问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签