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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:52:01+00:00 2026-06-01T00:52:01+00:00

I have a web app I’m making to run off a CMS that is

  • 0

I have a web app I’m making to run off a CMS that is using jQuery Mobile to make mobile compatible page versions. The base log in page is stored locally on the phone.

public class WebAppActivity extends Activity {
WebView webView;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    // Point to the content view defined in XML

    setContentView(R.layout.main);

    // Configure the webview setup in the xml layout

    WebView webView = (WebView) findViewById(R.id.webView1);

    WebSettings webSettings = webView.getSettings();

    // Yes, we want javascript, pls.

    webSettings.setJavaScriptEnabled(true);


    webView.loadUrl("file:///android_asset/www/webapp.html");



webView.setWebViewClient(new WebViewClient() { 
    @Override
     public boolean shouldOverrideUrlLoading(WebView view, String url){
         view.loadUrl(url);
         return true;
     }
 });


}



@Override
 public void onBackPressed()
{
    if(webView.canGoBack())
    {
        webView.goBack();
    }else{
        super.onBackPressed();
    }
}

}

and the the Logcat says :

03-29 15:31:47.354: E/AndroidRuntime(430): FATAL EXCEPTION: main
03-29 15:31:47.354: E/AndroidRuntime(430): java.lang.NullPointerException
03-29 15:31:47.354: E/AndroidRuntime(430):  at com.package.mobile.android.webapp.onBackPressed(WebApp.java:223)
03-29 15:31:47.354: E/AndroidRuntime(430):  at android.app.Activity.onKeyUp(Activity.java:1898)
03-29 15:31:47.354: E/AndroidRuntime(430):  at android.view.KeyEvent.dispatch(KeyEvent.java:1280)
03-29 15:31:47.354: E/AndroidRuntime(430):  at android.app.Activity.dispatchKeyEvent(Activity.java:2078)
03-29 15:31:47.354: E/AndroidRuntime(430):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1663)
03-29 15:31:47.354: E/AndroidRuntime(430):  at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2560)
03-29 15:31:47.354: E/AndroidRuntime(430):  at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2535)
03-29 15:31:47.354: E/AndroidRuntime(430):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1867)
03-29 15:31:47.354: E/AndroidRuntime(430):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-29 15:31:47.354: E/AndroidRuntime(430):  at android.os.Looper.loop(Looper.java:123)
03-29 15:31:47.354: E/AndroidRuntime(430):  at android.app.ActivityThread.main(ActivityThread.java:3683)
03-29 15:31:47.354: E/AndroidRuntime(430):  at java.lang.reflect.Method.invokeNative(Native Method)
03-29 15:31:47.354: E/AndroidRuntime(430):  at java.lang.reflect.Method.invoke(Method.java:507)
03-29 15:31:47.354: E/AndroidRuntime(430):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-29 15:31:47.354: E/AndroidRuntime(430):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-29 15:31:47.354: E/AndroidRuntime(430):  at dalvik.system.NativeStart.main(Native Method)

I’ve been trying to get around this for the past week or so, it seems as if the webview isn’t building a history to go back through.

  • 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-01T00:52:03+00:00Added an answer on June 1, 2026 at 12:52 am

    The NullPointerException is because your webView is a local variable in onCreate, and the webView class member variable is left unassigned.

    Off-topic: I won’t go into a long tirade about purely WebView-based apps, but let’s just say you shouldn’t do it. And if you absolutely have to for some reason or another, then you should make sure to handle orientation changes.

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

Sidebar

Related Questions

I have a web app (JSPs and Servlets along with jQuery) that I am
I have a web app that lets users create groups. On the front page
I have a web app that displays a web page in a web view.
I have a web app that is being hit by facebook. The login page
I have a web app(ASP.NET 2.0 using C#) that I am working on. In
I have a web app, that consumes a web service. The main page runs
I have a web app which connects to a server using a TCP connection
I have a web app for commercial property management that needs spreadsheet-like functionality for
I have a web app that is heavily loaded in javascript and css. First
I have a web app that only registered users can use, therefore I should

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.