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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:32:22+00:00 2026-06-15T16:32:22+00:00

I am trying to create a simple Android app that will have the possibility

  • 0

I am trying to create a simple Android app that will have the possibility to fetch the source code of a website.
Anyways, I have written the following:

WebView webView = (WebView) findViewById(R.id.webView);
try {
    webView.setWebViewClient(new WebViewClient());          
    InputStream input = (InputStream) new URL(url.toString()).getContent();
    webView.loadDataWithBaseURL("", "<html><body><p>"+input.toString()+"</p></body></html>", "text/html", Encoding.UTF_8.toString(),""); 
    //setContentView(webView);
} catch (Exception e) {
    Alert alert = new Alert(getApplicationContext(),
                            "Error fetching data", e.getMessage());
}

Here are the errors:

12-11 01:37:59.234: E/AndroidRuntime(28992): FATAL EXCEPTION: main
12-11 01:37:59.234: E/AndroidRuntime(28992): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
12-11 01:37:59.234: E/AndroidRuntime(28992):    at android.view.ViewRootImpl.setView(ViewRootImpl.java:701)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:345)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at android.app.Dialog.show(Dialog.java:277)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at com.myprogram.myprogram.Alert.<init>(Alert.java:11)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at com.myprogram.myprogram.MainActivity$1.onClick(MainActivity.java:84)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at android.os.Handler.dispatchMessage(Handler.java:99)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at android.os.Looper.loop(Looper.java:137)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at android.app.ActivityThread.main(ActivityThread.java:4898)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at java.lang.reflect.Method.invokeNative(Native Method)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at java.lang.reflect.Method.invoke(Method.java:511)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
12-11 01:37:59.234: E/AndroidRuntime(28992):    at dalvik.system.NativeStart.main(Native Method)
12-11 01:38:21.484: I/Process(28992): Sending signal. PID: 28992 SIG: 9
12-11 01:38:32.739: E/Trace(29922): error opening trace file: No such file or directory (2)
12-11 01:38:32.939: I/webclipboard(29922): clipservice: android.sec.clipboard.ClipboardExManager@42209de8
12-11 01:38:32.964: V/webkit(29922): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {42204f18}

I can’t seem to find a solution; what is my problem?

  • 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-15T16:32:23+00:00Added an answer on June 15, 2026 at 4:32 pm

    Try it: Instead of getApplicationContext() use this

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

Sidebar

Related Questions

I am trying to create a simple 3-D app for android that will have
I am trying to create a simple android app that will communicate with website.
So I was trying to follow http://developer.android.com/guide/topics/media/camera.html to create a simple app that captures
I am trying to create an android app that will connect to various web
I am trying to create a simple android app in Java but I have
I have been trying to create a simple application that will let the user
Okay, I'm trying to create a simple app that will draw a shape (I'm
I am trying to create an android app that will change the font at
I'm trying to create an app for Android that simply sends a command to
I'm trying to create a simple app for android with progress bar . Everything

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.