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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:37:50+00:00 2026-05-22T19:37:50+00:00

I am trying to add ads into my app, and I get this weird

  • 0

I am trying to add ads into my app, and I get this weird error that I just can’t see how I am possibly getting it. Here is the error

  05-30 20:02:48.889: ERROR/AndroidRuntime(3420): FATAL EXCEPTION: main
05-30 20:02:48.889: ERROR/AndroidRuntime(3420): java.lang.RuntimeException: Unable to start activity ComponentInfo{coderaustin.com/coderaustin.com.Main}: java.lang.ClassCastException: android.widget.EditText
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at android.os.Looper.loop(Looper.java:123)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at android.app.ActivityThread.main(ActivityThread.java:4627)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at java.lang.reflect.Method.invokeNative(Native Method)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at java.lang.reflect.Method.invoke(Method.java:521)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at dalvik.system.NativeStart.main(Native Method)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420): Caused by: java.lang.ClassCastException: android.widget.EditText
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at coderaustin.com.Main.onCreate(Main.java:79)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-30 20:02:48.889: ERROR/AndroidRuntime(3420):     ... 11 more

As you can see, it’s somehow getting an instance of EditText out of this code

 AdView adView = new AdView(this, AdSize.BANNER, "my pub code");
    View view = findViewById(R.id.RelLayout);
    if(view instanceof RelativeLayout) {
        Log.e("It's layout", "fixed");
    } else {
        Log.e("NOOOO", "Instance of: " + view.getClass().getName());

    }
   **RelativeLayout layout = (RelativeLayout) findViewById(R.id.RelLayout);**
   layout.addView(adView);

   adView.setGravity(Gravity.BOTTOM);
    // Add the adView to it

    // Initiate a generic request to load it with an ad
    adView.loadAd(new AdRequest());

Maybe it’s something obvious and I am just oblivious to it, I just don’t see where I’m going wrong. Thanks for all help.

Edit: Just incase you wanted to see my layout, here it is

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/RelLayout"
>
  • 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-22T19:37:51+00:00Added an answer on May 22, 2026 at 7:37 pm

    The only thing I can think of is that your project properties (which includes IDs) need fixing. They get out of sync sometimes when you add new IDs/other properties to the project. In eclipse you can right click on the project and select Android > Fix Project Properties. If that doesn’t work I have sometimes had to delete all of my .class files (including R.class) and re-compile.

    Hope that helps.

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

Sidebar

Related Questions

In my android app I'm trying to add ads. I have a doubt about
I am trying to put ads into my Android application, but I'm getting a
I'm trying to implement some mobclix ads into an android app based on wiengine
I am trying to add ads to my Android app using Admob, but have
I am trying to put this function ((click_add)) in library so that i can
So I'm trying to just add a simple ad to my app using admob.
I am trying to get some AdWhirl ads to work with my app, but
Trying to add a blank sample app for a rails tutorial to GitHub, but
Trying to add email notification to my app in the cleanest way possible. When
Trying to add a class object into a List using reflection, but when invoking

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.