Creating a custom widget from the Android source code
<p>I am trying to make a custom Gallery widget. I found that I wanted to remove and add some behaviors to the gallery widget for my application, but the functions I need to derive are private in the Gallery class. I thought maybe I could just copy the file and work from there, but most of the members (i.e mSelectedPosition, mAdapter) are not visible even though the class' package is android.widget and extends the proper class (AbsSpanner).</p>

<p><em><strong>EDIT:</em></strong> Actually, it doesn't look like this is possible without including the entire android library, which doesn't make sense because I only need to change 20-30 lines in Gallery.java. To fully emulate the class, it seems one would need to be able to access the members of the parent classes to change and access members such mFirstPosition (needs to be settable), mGroupFlags (unaccessable), mInLayout (unaccessable), mDataChanged, mSelectedPosition (is hidden, getSelectedItemPosition returns mNextSelectedPosition, and using mNextSelectedPosition doesn't seem to work), setNextSelectedPositionInt(), handleDataChanged(), resetList(). Other than that in Gallery, I was able to work around the other members, but without the ones listed, its not going to compile.</p>

<p>I saw someone else on StackOverflow ask a similar question, I am just listing the brick walls I faced.  </p>
