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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:19:59+00:00 2026-06-01T15:19:59+00:00

This should really be easy for an experienced android programmer. Unfortunately I don’t know

  • 0

This should really be easy for an experienced android programmer. Unfortunately I don’t know anything about the android sdk. I am using PhoneGap to package a web app and I need to override the WebSettings in the cordovaExample.java (right now I am using the cordovaExample as a template for my app). My code looks like this:

package org.apache.cordova.example;

import android.app.Activity;
import android.os.Bundle;
import org.apache.cordova.*;

public class cordovaExample extends DroidGap
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        this.appView.getSettings().setUseWideViewPort(true);
        this.appView.getSettings().setLoadWithOverviewMode(true);
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
    }
}

I can run ant debug install without a problem but when I start the app in the emulator, the following errors occur:

E/AndroidRuntime(  549): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.apache.cordova.example/org.apache.cordova.example.cordovaExample}: java.lang.NullPointerException
E/AndroidRuntime(  549):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
E/AndroidRuntime(  549):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
E/AndroidRuntime(  549):    at android.app.ActivityThread.access$600(ActivityThread.java:123)
E/AndroidRuntime(  549):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
E/AndroidRuntime(  549):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  549):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(  549):    at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime(  549):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  549):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(  549):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(  549):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(  549):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(  549): Caused by: java.lang.NullPointerException
E/AndroidRuntime(  549):    at org.apache.cordova.example.cordovaExample.onCreate(cordovaExample.java:12)
E/AndroidRuntime(  549):    at android.app.Activity.performCreate(Activity.java:4465)
E/AndroidRuntime(  549):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
E/AndroidRuntime(  549):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
E/AndroidRuntime(  549):    ... 11 more
W/ActivityManager(   78):   Force finishing activity org.apache.cordova.example/.cordovaExample

The errors occur no matter if I package for android sdk 2.1 or 4.3 (on Mac OS X Lion).

Any help will be very much 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-06-01T15:20:00+00:00Added an answer on June 1, 2026 at 3:20 pm

    The error says that there is a NullPointerException at line 12:

    this.appView.getSettings().setUseWideViewPort(true);
    

    Either this.appView is null of appView.getSettings() is returning null. Add null value checks and see which one it is. It will be easier to find out why there is a null value there once you know which one it is.

    Also, nothing to do with the problem and not sure if it is a typo but your class name is camel cased. It is against best practice to do that. It will confuse you in the future to do that since camel case nomenclature is used with instance variables, members, and methods only. Class names are always Initial letter uppercased and package names are always lowercase.
    So it should be

    CordovaExample
    

    and not

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

Sidebar

Related Questions

Ok, this should be really easy, but I just don't have enough experience. I
This seems like it should be really easy but I couln't find an answer
Overview I am using CompositeWPF to create an app using C#. This really should
This should be really easy but I am struggling. Here is my current code
This should be really easy but for some reason it doesn't seem to be.
This should be really easy, but I'm just not seeing how to do it.
This should be really easy. Believe me, I've been researching this for hours. My
This should be really easy but I can't figure out how to make it
This should be really easy, I just want to update the listview when the
This feels like it should be really easy, but I just can't get it

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.