Java 如何在Eclipse中读取调试日志

Java 如何在Eclipse中读取调试日志,java,android,Java,Android,我正在运行以下代码 package com.dc; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.webkit.WebSettings; import android.webkit.WebView; public class DC exten

我正在运行以下代码

package com.dc;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class DC extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        try
        {
            // this is the code that I am surrounding in the try/catch block
            super.onCreate(savedInstanceState);

            //init webview
            WebView DCWebView = (WebView) findViewById(R.id.webview);

            //when a link is clicked, use the WebView instead of opening a new browser
            DCWebView.setWebViewClient(new MyWebViewClient() {
                public void launchExternalBrowser(String url) {
                    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                    startActivity(intent); 
                }
            });

            //enable javascript
            WebSettings webViewSettings = DCWebView.getSettings();
            webViewSettings.setJavaScriptEnabled(true);
        }
        catch (Exception e)
        {
            // this is the line of code that sends a real error message to the log
            Log.e("ERROR", "ERROR IN CODE: " + e.toString());

            // this is the line that prints out the location in
            // the code where the error occurred.
            e.printStackTrace();
        }
    }
}
这个堆栈跟踪没有难以置信的帮助。我正在学习java/android(我有PHP的背景)


文件DealClippings第24行中有一个NullPointerException

java.lang.NullPointerException at   
   com.dealclippings.DealClippings.onCreate(DealClippings.java:24)

NullPointerException表示您试图使用设置为null的值。例如,如果DCWebView为null,并且您尝试调用
DCWebView.setWebViewClient
,您将得到一个NullPointerException。堆栈跟踪只是告诉您在何处查找此问题。DealClippings.java的第24行似乎是问题所在。请避免以大写字母开头的非静态最终变量名;按照惯例,它们将以小写字母开头。
java.lang.NullPointerException at   
   com.dealclippings.DealClippings.onCreate(DealClippings.java:24)