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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:43:21+00:00 2026-05-24T22:43:21+00:00

I tried both admob and mobfox. However, there is no advertisement in list activity.

  • 0

I tried both admob and mobfox. However, there is no advertisement in list activity.

RelativeLayout adslayout;
adapter = new ArrayAdapter<String>(this,R.layout.listlayout,R.id.txtmesajlar , messages);
mobfoxView = new MobFoxView(this, publisherId, true, true);
setListAdapter(adapter);
adslayout = (RelativeLayout)findViewById(R.id.adslayout);
adslayout.addView(mobfoxView);

From Logcat: Exception is java lang NullPointerException.

When i tried same codes in my other activity, i put mobfoxview in linearlayout and ads banner succesfully added. Is listactivity ignore advertisement or there is some error from me?

listlayout.xml

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/adslayout" android:layout_width="fill_parent" android:layout_gravity="center"></RelativeLayout>
<TextView android:layout_height="wrap_content" android:id="@+id/txtmesajlar" android:layout_width="fill_parent" android:textColor="@color/White" android:textSize="18sp" android:textStyle="bold" android:drawingCacheQuality="auto" android:drawableLeft="@drawable/listenvelop"></TextView>
</LinearLayout>

LOGCAT

08-25 12:11:59.925: ERROR/AndroidRuntime(887): FATAL EXCEPTION: main
08-25 12:11:59.925: ERROR/AndroidRuntime(887): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mc.bayrammesajlari/com.mc.bayrammesajlari.BayramActivity}: java.lang.NullPointerException
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at android.os.Handler.dispatchMessage(Handler.java:99)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at android.os.Looper.loop(Looper.java:123)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at android.app.ActivityThread.main(ActivityThread.java:3683)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at java.lang.reflect.Method.invokeNative(Native Method)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at java.lang.reflect.Method.invoke(Method.java:507)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at dalvik.system.NativeStart.main(Native Method)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): Caused by: java.lang.NullPointerException
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at com.mc.bayrammesajlari.BayramActivity.onCreate(BayramActivity.java:52)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-25 12:11:59.925: ERROR/AndroidRuntime(887): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)

Many thanks.

  • 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-24T22:43:22+00:00Added an answer on May 24, 2026 at 10:43 pm

    If you want to put ads next to your list, the answers to this question explain how to do it (PreferenceActivity is just a subclass of ListActivity so the solution is the same).

    If you want the ads to actually appear in the list (as rows that scroll with the rest of the list content), I previously wrote this article about how I achieved this for AdMob.

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

Sidebar

Related Questions

I tried: mb_strlen('普通话'); strlen('普通话'); both of them output 9,while in fact there are only
is there any unit test framework for WP7? I have tried both MBUnit and
I have tried integrating mobclix and a admob. Both of them dont not show
I tried both JRSwizzle, and MethodSwizzle. They compile fine on the simulator but throw
I've tried both of the following: repo init -u git://android.git.kernel.org/platform/manifest.git -b android-2.1 repo init
I am using Grails 1.2.x (Tried both 1.2.0 and 1.2.2- same behavior) I am
I am trying to run code on several cores (I tried both the snow
I created a simple test with SendKeys, and tried both SendWait and Send. Private
I tried using both ReadProcessMemory() and WriteProcessMemory() in my application,but in both cases I
I have tried this both on Ubuntu Linux and on Windows. I can not

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.