0

所以这是我的代码的基本运行

继承人MainActivity.java:

package com.ngn;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

private Button button;

public void onCreate(Bundle savedInstanceState) {
    final Context context = this;

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    button = (Button) findViewById(R.id.helpbutton);

    button.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                Intent intent = new Intent ("com.ngn.HELP"); MainActivity.this.startActivity(intent);
            }

        });

}

}

这是我的 help.java

package com.ngn;

import android.os.Bundle;
import android.app.Activity;
import android.webkit.WebView;
import android.webkit.*;


public class Help extends Activity
{

private WebView webView;
@Override 
public void onCreate (Bundle savedInstanceState){
// superoncreate now
super.onCreate(savedInstanceState);

webView = (WebView) findViewById(R.id.helpmenu);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("file:///android_asset/main.html");
webView.setWebViewClient(new WebViewClient()
    {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
            }

});;}} 

每次我在编译时单击帮助按钮时都会冻结,我使用 AIDE With Premium for android

4

1 回答 1

4

在您尝试检索之前Help必须先打电话setContentViewR.id.helpmenu

于 2013-06-24T14:40:55.547 回答