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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:37:38+00:00 2026-06-15T19:37:38+00:00

As a beginning Android programmer who is not a beginning programmer, I am alarmed

  • 0

As a beginning Android programmer who is not a beginning programmer, I am alarmed by the amount of time it took me until I realized that the crash was resulting from omitting to use the constructor taking AttributeSet as a second parameter and writing instead the following code for a custom view defined in an XML layout.

////////MyView.java////////

public class MyView extends View {

    public SimpleView(Context context) {
        super(context);
    }
    ...

}

My question is this: What could I have done (in Eclipse, the ADT variant) to be able to determine this error quickly? I look rather carefully at lint messages and was hoping that that habit would spare me spending hours for a single error.

The manual does of course clearly state that custom views defined in an XML layout should use the (Context, AttributeSet) variant of the View constructor, but it is hopeless to program at any level while recalling with precision every last detail in the reference pages.

  • 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-15T19:37:39+00:00Added an answer on June 15, 2026 at 7:37 pm

    There should be the following error in the Graphical Layout:

    Custom view MyView is not using the 2- or 3-argument View
    constructors; XML attributes will not work

    But I agree that a compile-time error would be better…

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

Sidebar

Related Questions

I've borrowed the following code from Wei-Meng Lee's "Beginning Android Application Development": import android.content.Context;
I'm new to Java but not to programming. I'm reading the book Beginning Android
I quote from the SDK docs: Beginning with Android 3.0 (API level 11), Android-powered
Possible Duplicate: Android SMS Receiver not working I am in the beginning stages of
(I'm beginning in the Android dev) I want to export a file from /data/data....
I have to get the time of download in my android application, that's why
I'm practising grid view from the book, Beginning android 2, I typed this xml
I'm following the Mr. Nom tutorial from Beginning Android Game e-book, and in the
I'm working my way through APress's Beginning Android 2 and I've made it all
I'm beginning with android NDK. I have to compile a native library for the

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.