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 4010358
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:59:23+00:00 2026-05-20T08:59:23+00:00

So I’m working on adding some web view stuff and will eventually make this

  • 0

So I’m working on adding some web view stuff and will eventually make this more complicated but for now am just trying to get the basics working. I have my xml built and such and I am inflating it on top of another view. So its in like a dialog box.

web = (WebView)findViewById(R.id.WebView);

name = (TextView) findViewById(R.id.name);
name.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {

        final Dialog dialog = new Dialog(Hydrogen.this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.web);
        dialog.setCancelable(true);

        web.loadUrl("http://en.wikipedia.org/wiki/" + name.getText().toString());

        RelativeLayout btn = (RelativeLayout) dialog.findViewById(R.id.close);
        btn.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                dialog.dismiss();
                        }
            });     
        dialog.show();
}});

Basically thats my code regarding the WebView etc. The problem is on line 145 which is the web.loadUrl line. I’n not sure whats wrong but every time I try to open the Dialog it crashs. Thanks.

02-16 17:16:08.313: ERROR/AndroidRuntime(8122): FATAL EXCEPTION: main
02-16 17:16:08.313: ERROR/AndroidRuntime(8122): java.lang.NullPointerException
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at table.periodic.Hydrogen$1.onClick(Hydrogen.java:145)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at android.view.View.performClick(View.java:2408)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at android.view.View$PerformClick.run(View.java:8816)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at android.os.Handler.handleCallback(Handler.java:587)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at android.os.Handler.dispatchMessage(Handler.java:92)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at android.os.Looper.loop(Looper.java:123)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at java.lang.reflect.Method.invokeNative(Native Method)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at java.lang.reflect.Method.invoke(Method.java:521)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-16 17:16:08.313: ERROR/AndroidRuntime(8122):     at dalvik.system.NativeStart.main(Native Method)

I also just tried making a seperate project in which to load the web page. Just a WebView loading the URL. It partly worked. It worked to the point that it opened the URL but it did it inside the browser instead of inside the webview. Could be because I named the WebView browser but will try more.

  • 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-20T08:59:24+00:00Added an answer on May 20, 2026 at 8:59 am

    So I found it out myself. My dialog code had to looks as follows.

    name = (TextView) findViewById(R.id.name);
        name.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
    
                final Dialog dialog = new Dialog(Hydrogen.this);
                dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                dialog.setContentView(R.layout.web);
                dialog.setCancelable(true);
    
                eleweb = (WebView) dialog.findViewById(R.id.eleweb);
                eleweb.loadUrl("http://en.wikipedia.org/wiki/" + name.getText().toString());
                eleweb.setWebViewClient(new HelloWebViewClient());
    
                RelativeLayout btn = (RelativeLayout) dialog.findViewById(R.id.close);
                btn.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        dialog.dismiss();
                                }
                    });     
                dialog.show();
        }});
    

    the problem what that I wasn’t calling the WebView in a dialog format. Once I got all the WebView information loading inside the Dialog and did

    eleweb = (WebView) dialog.findViewById(R.id.eleweb);
    

    it worked.

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

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I want use html5's new tag to play a wav file (currently only supported
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.