在ActivityThread Android应用程序的RuntimeException未能找到一些源? [英] Android application RuntimeException in ActivityThread failed to find some source?

查看:103
本文介绍了在ActivityThread Android应用程序的RuntimeException未能找到一些源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要解决母语Android应用程序上升的RuntimeException问题的帮助。
我不能确定是什么原因导致这种异常。这里是堆栈跟踪和code。什么似乎这里是一个问题?

I need assistance with resolving RuntimeException problem risen by native Android application. I can not define what causes this exception. Here is stack trace and code. What seems to be an issue here?

Thread [<1> main] (Suspended (exception RuntimeException))  
    ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1879    
    ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1980 
    ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 122    
    ActivityThread$H.handleMessage(Message) line: 1146  
    ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
    Looper.loop() line: 137 
    ActivityThread.main(String[]) line: 4340    
    Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
    Method.invoke(Object, Object...) line: 511  
    ZygoteInit$MethodAndArgsCaller.run() line: 784  
    ZygoteInit.main(String[]) line: 551 
    NativeStart.main(String[]) line: not available [native method]  

code

package com.example;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import com.example.hellogooglemaps.R;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

import com.google.android.maps.MapView.LayoutParams;  
import android.view.View;
import android.widget.LinearLayout;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapController;

import java.util.List;

import com.google.android.maps.Overlay;
import com.google.android.maps.MapView.LayoutParams;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import android.widget.Toast;

public class HellogooglemapsActivity extends MapActivity {
    MapView mapView; 
    MapController mc;
    GeoPoint p,p2;
    /** Called when the activity is first created. */
    @Override

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

       mapView = (MapView) findViewById(R.id.mapview);
       LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);  
       View zoomView = mapView.getZoomControls(); 

       zoomLayout.addView(zoomView, 
           new LinearLayout.LayoutParams(
               LayoutParams.WRAP_CONTENT, 
               LayoutParams.WRAP_CONTENT)); 
       mapView.displayZoomControls(true);

       mc = mapView.getController();
       String coordinates[] = {"59.3948", "24.662"};
       double lat = Double.parseDouble(coordinates[0]);
       double lng = Double.parseDouble(coordinates[1]);

       p = new GeoPoint(
           (int) (lat * 1E6), 
           (int) (lng * 1E6));

       MapOverlay mapOverlay = new MapOverlay();
       List<Overlay> listOfOverlays = mapView.getOverlays();
       listOfOverlays.clear();
       listOfOverlays.add(mapOverlay); 

       mc.animateTo(p);
       mc.setZoom(14); 
       mapView.invalidate();

   }
    class MapOverlay extends com.google.android.maps.Overlay {
        @Override
        public boolean draw(Canvas canvas, MapView mapView, 
        boolean shadow, long when) 
        {
            super.draw(canvas, mapView, shadow);                   

            //---translate the GeoPoint created in onCreate to screen pixels---
            Point screenPts = new Point();
            mapView.getProjection().toPixels(p, screenPts);

            //---add the marker---
            Bitmap bmp = BitmapFactory.decodeResource(
                getResources(), R.drawable.map_marker);            
            canvas.drawBitmap(bmp, screenPts.x-15, screenPts.y-32, null);      

            // add a new marker to coords given below
            String coordinates[] = {"59.40", "24.80"};
            double lat = Double.parseDouble(coordinates[0]);
            double lng = Double.parseDouble(coordinates[1]);
            p2 = new GeoPoint( (int) (lat * 1E6), (int) (lng * 1E6));
            Point screenPts2 = new Point();
            mapView.getProjection().toPixels(p2, screenPts2);               
            canvas.drawBitmap(bmp, screenPts2.x-15, screenPts2.y-32, null); 

            Toast.makeText(getBaseContext(), 
                    p2.getLatitudeE6() / 1E6 + "," + 
                    p2.getLongitudeE6() /1E6 , 
                    Toast.LENGTH_SHORT).show();

            return true;
        }
} 
    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
}

AVD:谷歌API 14

AVD : Google API 14

推荐答案

的异常堆栈跟踪信息+正常打印多一点逐字到logcat中。堆栈跟踪的第一行表示当系统调用Instrumentation.newActivity(类加载器,字符串,意图)活动对象不能被实例化。在logcat中,你应该能找到类似无法实例化活性LT;成分&gt ;:&LT;&消息GT;,其中,&lt;&消息GT;是你是pretty感兴趣的内容。

The exception stack trace + message is normally printed a bit more verbatim to logcat. The first line of the stack trace indicates that the activity object cannot be instantiated when the system calls Instrumentation.newActivity(ClassLoader, String, Intent). In logcat, you should be able to find something like "Unable to instantiate activity <component>: <message>", where <message> is something you're pretty interested in.

这篇关于在ActivityThread Android应用程序的RuntimeException未能找到一些源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆