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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:11:51+00:00 2026-06-14T08:11:51+00:00

I want to implement javascript in my android application. I was successful in implementing

  • 0

I want to implement javascript in my android application. I was successful in implementing that using PhoneGap. Now my application runs the webpage with javascript, but there is one small problem. I want to place an AdMob banner at the bottom, which i have already implemented in my other application, so i followed the same procedure but that is resulting in force close error. If i run the application without android layout and code it runs perfectly but not with it.

import org.apache.cordova.DroidGap;
import com.google.ads.AdRequest;
import com.google.ads.AdView;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;

public class MainActivity extends DroidGap {

private LayoutInflater mInflater;
private View paramView;

@Override
public void onCreate(Bundle savedInstanceState) {
    Display display = getWindowManager().getDefaultDisplay();
    int width = display.getWidth();
    int height = display.getHeight();
    LayoutParams params = new LayoutParams(height, width);
    paramView = mInflater.inflate(R.layout.activity_main, null);
    super.loadUrl("file:///android_asset/www/webPageWithJavascript.htm");
    super.addContentView(paramView, params);

    AdView adview = (AdView) findViewById(R.id.adView);
    AdRequest re = new AdRequest();
    adview.loadAd(re);          
}
}

Log Cat

11-02 10:15:09.031: E/AndroidRuntime(1249): FATAL EXCEPTION: main
11-02 10:15:09.031: E/AndroidRuntime(1249): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.myapplication/com.test.myapplication.MainActivity}: java.lang.NullPointerException
11-02 10:15:09.031: E/AndroidRuntime(1249):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at android.os.Looper.loop(Looper.java:130)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at android.app.ActivityThread.main(ActivityThread.java:3683)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at java.lang.reflect.Method.invokeNative(Native Method)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at java.lang.reflect.Method.invoke(Method.java:507)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at dalvik.system.NativeStart.main(Native Method)
11-02 10:15:09.031: E/AndroidRuntime(1249): Caused by: java.lang.NullPointerException
11-02 10:15:09.031: E/AndroidRuntime(1249):     at com.test.myapplication.MainActivity.onCreate(MainActivity.java:26)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-02 10:15:09.031: E/AndroidRuntime(1249):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
11-02 10:15:09.031: E/AndroidRuntime(1249):     ... 11 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-06-14T08:11:52+00:00Added an answer on June 14, 2026 at 8:11 am

    It sounds strange but the same code worked after restarting the computer. I don’t know the reason but i thought let me restart the computer and try it again. After restarting the computer, I started eclipse and clicked on run button and the application was working perfectly.

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

Sidebar

Related Questions

I want to implement something with jquery, simple javascript and java but I don't
I want to implement the SRX Segmentation Rules using javascript to extract sentences from
I have made small algorithm and want to implement it using javascript. Here is
I want to implement a regex matching function in javascript that matches one or
I want to implement jQuery Mobile, but only for mobile browsers. Is there a
I want to implement different CSS style sheet using javascript or code behind on
I want to implement data hiding in JavaScript by writing a function that returns
I want to implement a toolbar (probably with javascript) that will be displayed on
I want to implement MVC pattern in JavaScript, but I have a problem with
I want to implement auto complete feature in a rails application. I am using

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.