0

さて、私のアプリには 3 つのタブを持つタブビューがあります。2 つのタブには問題はありません。1 つ目は webview を開くだけで動作し、3 つ目は一連の画像ボタンを表示し、オプションのあるページを順番に開きますが、正常に動作します。

私の2番目の問題です。4 つの親と、親ごとにさまざまな数の子を持つ展開可能なリスト ビューがあります。展開可能なリスト ビューが機能しており、各子が Web ビューで異なるページを開きます。この部分は問題なく動作しています。ページを開くと問題が発生し、[戻る] ボタンをクリックすると、必要な 2 番目のタブに戻ります。別のリンクを選択すると、問題なく動作し、[戻る] ボタンで元に戻ります。しかし、3 分の 1 を開くと、戻るボタンを押すとクラッシュします。

case 1:
                        setContentView(R.layout.viewer);
                        content = new String(
                                "insert web page here");
                        showContent = new Intent(getApplicationContext(),
                                Viewer.class);
                        showContent.setData(Uri.parse(content));
                        replaceContentView("Called", showContent);
                        break;

それがページの1つです。replaceContentView メソッドは次のとおりです。

public void replaceContentView(String id, Intent newIntent) {
    // Obtain the view of 'Called' activity using its Intent 'newIntent'
    View view = getLocalActivityManager().startActivity(id,
            newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
            .getDecorView();
    // set the above view to the content of 'Calling' activity.
    this.setContentView(view);
}

Viewer クラスは次のとおりです。

public class Viewer extends ActivityGroup {
WebView viewer;
final Context myApp = this;

public void onBackPressed() {

    if (viewer.isFocused() && viewer.canGoBack()) {
        viewer.goBack();
    } else {
        Intent back = new Intent(this, Resources1.class);
        replaceContentView("Called", back);
    }
}

public void replaceContentView(String id, Intent newIntent) {
    // Obtain the view of 'Called' activity using its Intent 'newIntent'
    View view = getLocalActivityManager().startActivity(id,
            newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
            .getDecorView();

    // set the above view to the content of 'Calling' activity.
    this.setContentView(view);
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.viewer);
    Intent launchingIntent = getIntent();
    String content = launchingIntent.getData().toString();
    viewer = (WebView) findViewById(R.id.webView);
    viewer.setWebViewClient(new myWebClient());
    viewer.getSettings().setJavaScriptEnabled(true);
    viewer.getSettings().setSupportMultipleWindows(true);
    viewer.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
    viewer.getSettings().setSupportZoom(true);
    //viewer.setWebChromeClient(new MyWebChromeClient());
    viewer.loadUrl(content);
    viewer.requestFocus();
}

public class myWebClient extends WebViewClient {
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {

        super.onPageStarted(view, url, favicon);
    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {

        view.loadUrl(url);
        return true;
    }
}

もっと質問が必要な場合は、適切なコードだと思うものを投稿しました。私はこれに数日間取り組んでいますが、理解できません。

ログキャットの追加:

05-10 08:41:06.560: I/dalvikvm(13342): threadid=1: stack overflow on call to Landroid/text/Layout;.draw:VLLLI
05-10 08:41:06.560: I/dalvikvm(13342):   method requires 276+20+52=348 bytes, fp is 0x4003a400 (256 left)
05-10 08:41:06.560: I/dalvikvm(13342):   expanding stack end (0x4003a300 to 0x4003a000)
05-10 08:41:06.560: I/dalvikvm(13342): Shrank stack (to 0x4003a300, curFrame is 0x4003dc10)
05-10 08:41:06.560: D/AndroidRuntime(13342): Shutting down VM
05-10 08:41:06.560: W/dalvikvm(13342): threadid=1: thread exiting with uncaught exception (group=0x40a421f8)

05-10 08:41:06.560: W/dalvikvm(7024): threadid=1: thread exiting with uncaught     exception (group=0x40a421f8)
05-10 08:41:06.580: E/AndroidRuntime(7024): FATAL EXCEPTION: main
05-10 08:41:06.580: E/AndroidRuntime(7024): java.lang.StackOverflowError
05-10 08:41:06.580: E/AndroidRuntime(7024):     at   android.text.BoringLayout.draw(BoringLayout.java:400)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.widget.TextView.onDraw(TextView.java:5088)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.View.draw(View.java:10983)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.widget.ListView.drawChild(ListView.java:3223)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.widget.AbsListView.dispatchDraw(AbsListView.java:2092)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.widget.ListView.dispatchDraw(ListView.java:3218)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.widget.ExpandableListView.dispatchDraw(ExpandableListView.java:230)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.View.draw(View.java:11088)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.widget.AbsListView.draw(AbsListView.java:3398)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.View.draw(View.java:10986)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-10 08:41:06.580: E/AndroidRuntime(7024):     at android.view.ViewGroup.dispatchDraw(ViewGrou
05-10 08:41:08.310: I/Process(7024): Sending signal. PID: 7024 SIG: 9
4

0 に答える 0