Hello,

I am looking to use a custom View found in the Android source code.
Since it wasn't available in the public API I simply used the source
code to place the widget into my application. The View works
correctly, however, when I tried to make a slight modification within
my package that change did not take effect.

I do understand that using private API classes is considered bad
practice and comes with the high risk of breaking, but I am more
curious as to why the changes made to the class did not take effect in
my package.

The change I implemented to test this was simply dropping a Log.d into
the constructor. Let's assume for this question's sake that I am
constructing the component correctly in Java.

Some code as an example to supplement:
Original class taken from source:

package com.android.internal.widget;
class SampleWidget extends View {

    public SampleWidget(Context context, AttributeSet attrs){
         super(context, attrs);
          // the rest of the constructor
    }

    // all the required methods to draw this view correctly,
unmodified from original source
}

My modification:
package com.custom.mypackage.widget;

class MySampleWidget extends View {

    public MySampleWidget(Context context, AttributeSet attrs){
         super(context, attrs);
         Log.d("MySampleWidget", "<This output should appear in my
LogCat>");
          // the rest of the constructor
    }

    // all the required methods to draw this view correctly,
unmodified from original source
}

Any suggestions would be greatly appreciated. If further clarification
is required I would be happy to provide such.

Thank you.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to