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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:58:31+00:00 2026-06-04T13:58:31+00:00

I am new to android programming…so please be patient.. I am trying to load

  • 0

I am new to android programming…so please be patient..

I am trying to load a custom view (ArticleView) into an activity, where my custom view in defined as a subclass of an activty class. I created the following xml layout file for the activity containing the custom view:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/MainLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/ArticleLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <aarddict.android.ArticleView // here's the line # 14
            android:id="@+id/ArticleView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/ButtonLayout"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="5dp"
        android:layout_marginRight="5dp"
        android:gravity="bottom" >

        <Button
            android:id="@+id/NextButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableRight="@drawable/ic_next"
            android:visibility="gone" />
    </LinearLayout>

</RelativeLayout>

What happens is I am keeping on getting runtime error (the app dies), looking in the LogCat I get:

    05-24 23:41:06.685: E/AndroidRuntime(600): java.lang.RuntimeException: Unable to start activity ComponentInfo{aarddict.alidev.android/aarddict.alidev.android.ArticleViewActivity}: android.view.InflateException: Binary XML file line #14: Error inflating class aarddict.android.ArticleView
05-24 23:41:06.685: E/AndroidRuntime(600):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
05-24 23:41:06.685: E/AndroidRuntime(600):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-24 23:41:06.685: E/AndroidRuntime(600):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-24 23:41:06.685: E/AndroidRuntime(600):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-24 23:41:06.685: E/AndroidRuntime(600):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-24 23:41:06.685: E/AndroidRuntime(600):  at android.os.Looper.loop(Looper.java:137)
05-24 23:41:06.685: E/AndroidRuntime(600):  at android.app.ActivityThread.main(ActivityThread.java:4424)
05-24 23:41:06.685: E/AndroidRuntime(600):  at java.lang.reflect.Method.invokeNative(Native Method)

code:

interface ScrollListener {
    void onScroll(int l, int t, int oldl, int oldt);
}

private ScrollListener scrollListener;

public ArticleView(Context context) {
    super(context);
}

public ArticleView(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public ArticleView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
}

@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
    super.onScrollChanged(l, t, oldl, oldt);
    if (scrollListener != null) {
        scrollListener.onScroll(l, t, oldl, oldt);          
    }
}

public void setOnScrollListener(ScrollListener l) {
    this.scrollListener = l;
}
}
  • 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-04T13:58:34+00:00Added an answer on June 4, 2026 at 1:58 pm

    You can’t put an Activity within an Activity, if you are going to create a custom view you will want to extend View or one of it’s children like (LinearLayout/RelativeLayout/TextView)

    http://developer.android.com/guide/topics/ui/custom-components.html

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

Sidebar

Related Questions

I am new to android programming and trying to build a map activity app.
I'm new in Android Programming. I'm trying to write an app that uses USB
I'm still new to programming/Java/Android so I'm trying to understand everything I do and
I am relatively new to Android programming. So please, forgive me for writing or
Hi I'm new to android programming, I'm trying to initiate the on click method
I'm still new in android programming, what I'm trying to do is, I want
Hi I'm new to Android Programming and I'm trying to make a simple program
I'm new to Android programming and trying to wrap my head around this just
I am new in Android Programming and I am trying to include GTalk application
I'm new to Android programming. I would like to know if I can load

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.