Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6708095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:43:04+00:00 2026-05-26T07:43:04+00:00

I have a program with 4 different tabs. One of these tabs is an

  • 0

I have a program with 4 different tabs.

One of these tabs is an ActivityGroup which has a ListView in it. When I click on one of the list items, it switches to WebActivity:

        lv.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view,
              int position, long id) {
              Intent intent = new Intent(TabActivity2.this, WebActivity.class);
              Bundle b = new Bundle();
              b.putString("URL", URLs[(int)id]);
              b.putString("prevActivity", "TabActivity2");
              intent.putExtras(b);
              replaceContentView("web", intent);
          }
        });
    }

    public void replaceContentView(String id, Intent newIntent) {
        View view = getLocalActivityManager().startActivity(id,newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); this.setContentView(view);
    }

So now we’re in the WebActivity class. Here’s the code:

public class WebActivity extends ActivityGroup {
    WebView mWebView;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.web);

        Bundle b = getIntent().getExtras();
        String URL = b.getString("URL");

        mWebView = (WebView) findViewById(R.id.webview);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setPluginsEnabled(true);
            mWebView.requestFocus();
        mWebView.loadUrl(URL);

        mWebView.setWebViewClient(new FirstTabWebViewClient());        
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
            mWebView.goBack();
            return true;
        }
        Bundle b = getIntent().getExtras();
        String retActivity = b.getString("prevActivity");
        if (retActivity == "TabActivity2") {
            Intent intent = new Intent(WebActivity.this, TabActivity2.class);
            replaceContentView("list_webpages", intent);
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
    public void replaceContentView(String id, Intent newIntent) {
        View view = getLocalActivityManager().startActivity(id,newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); this.setContentView(view);
    }

I had to implement my own onKeyDown because otherwise hitting the Back button resulted in closing the application rather than returning to the ListView.

So the StackOverflowError seems to be a structural problem in my program and I’m not sure how to go about resolving it. Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:43:05+00:00Added an answer on May 26, 2026 at 7:43 am

    I ended up using a FrameLayout in the same activity with both WebView and ListView and used visilibity to switch between them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program with 4 different tabs. One of these tabs is an
I have a program in c which receives messages from different clients and servers.
I have a console program that has different components that run like this: void
I have a program which runs two different operations and i'd like to share
I have a program 'foo' running different threads, fooT1, fooT2, .. fooTn. Now if
I have a program with four different buttons. I want to interchange the position
I've got a table recording views of programs. Each program can have two different
I have three different development machines. Do I need three different iPhone Developer Program
I need to write a program used internally where different users will have different
I have recently been put in charge of debugging two different programs which will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.