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

  • SEARCH
  • Home
  • 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 8970105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:41:08+00:00 2026-06-15T17:41:08+00:00

I have 2 Buttons which load 2 difefrent html sites respectively. public class Information

  • 0

I have 2 Buttons which load 2 difefrent html sites respectively.

public class Information extends Activity implements OnClickListener {

Button b1, b2 ;
private WebView webview;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.info);


    b1=(Button) findViewById(R.id.b1);
    b2=(Button) findViewById(R.id.b2);


    b1.setOnClickListener(this);
    b2.setOnClickListener(this);


    webview=(WebView) findViewById(R.id.webview);
    webview.setWebViewClient(new WebViewClient(){

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url)
    {
        view.loadUrl(url);
        return true;

    }

    });

}


@Override
public void onClick(View v){


    switch(v.getId()) {

    case R.id.b1:
        showOne();
        break;

    case R.id.b2:
        showTwo();
        break;


    }

}

public void showOne(){
    webview.loadUrl("some url");

    }

public void showTwo() { 
    webview.loadUrl("some url here");
}

}

this results in errors that force the application to end.
When I remove the webview part, the buttons are desplayed, but nothing happens when I click on them.
any ideas?

  • 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-06-15T17:41:09+00:00Added an answer on June 15, 2026 at 5:41 pm

    check that there are a webview named webview in R.layout.info ?

    webview=(WebView) findViewById(R.id.webview); complier couldnt find this webview.

    and try to add , com.yourpackagename.R;

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

Sidebar

Related Questions

I have few buttons of which each button is assigned a class with a
I have a page which has a panel whcih contains various buttons to load
I have home.html which has the following div <div id=feature class=feature> </div> I have
I have 3 radio buttons which hide/show some div's. The radio buttons are getting
In Application i have two buttons in which one button is used as a
I have the following code which creates a simple window with two buttons which
I have a table where last column contains action buttons which opens another section
I have two buttons, which the user can click and will open a FileDiagloag
I have nav buttons on this site: http://www.dermatologypartners.com which have rounded corners, a gradient,
I have multiple buttons that gets created in a table which all look like

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.