How to scroll Gallery Widget manually

by alex » Sat, 14 Mar 2009 02:10:34 GMT


Sponsored Links
 Hi,

I'm working on a little Player with Playlist and use the Gallery
Widget to visualise the Playlist.
I tried to scroll the Gallery Widget manual to an active item, but the
Widget don't support any functions to do this.
There are several methods in the Gallery.java class

movePrevious()
moveNext()
scrollToChild( int pos )

but the visibility of this methods is default or private. So i can't
override this functions, if I Inherit from Gallery class.

can any one please help for a solution to scroll the Gallery
manual ???

Thanks,

Alex

--~--~---------~--~----~------------~-------~--~----~



How to scroll Gallery Widget manually

by Gesh » Sun, 15 Mar 2009 18:15:30 GMT


 Read the documentation more carefully.
Gallery extends several other classes that offer exactly the
functionality you are looking for.



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Rotating a fragment

I have an Activity with different layouts for portrait and landscape.
Since it has some complex state data I don't want to lose on rotation,
I'm listening for rotation config changes. In onConfigurationChanged()
I call setContentView() to rebuild the view hierarchy using the new
layout.

Now I'm converting the activity to use a Fragment. I want the Fragment
to behave just like the Activity, rebuilding the view hierarchy with
the new layout when it gets onConfigurationChanged(), but there
doesn't seem to be any way to change a Fragment's view after it's been
created. The only way seems to be to create a new Fragment, but then I
lose all the state data from the original Fragment.

Does anyone have any ideas on how to make this work?

-- 

2. Make the virtual keyboard visible without widgets

Hi

 I'm a beginner developer for Android and I'm trying to write a very
simple application. What I'm trying to achieve is an activity composed
by a Bitmap and a virtual Keyboard. I've tried to show the keyboard in
the onCreate method of the activity and also in the constructor of the
View but without a positive result. At this point I suppose I don't
need to write a softKeyboard and the default one will be enought for
my purposes.

Thanks.


public class TC extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
       engine mainWidget = new engine(this);
       super.onCreate(savedInstanceState);
       setContentView(mainWidget);
/*
        InputMethodManager mgr = (InputMethodManager)
getSystemService(context.INPUT_METHOD_SERVICE);
        mgr.showSoftInput(mainWidget, InputMethodManager.SHOW_FORCED);
*/

    }

}

class engine extends View {

    private Bitmap mBitmap;
    private long mStartTime;


   public engine(Context context) // Constructor...
        {
        super(context);

        final int W = 200;
        final int H = 200;

        mBitmap = Bitmap.createBitmap(W, H, Bitmap.Config.RGB_565);

        InputMethodManager mgr = (InputMethodManager)
context.getSystemService(context.INPUT_METHOD_SERVICE);
        mgr.showSoftInput(this, InputMethodManager.SHOW_FORCED);

        }

    @Override protected void onDraw(Canvas canvas)
    {
                canvas.drawColor(0xFFCCCCCC);
        //        renderPlasma(mBitmap, System.currentTimeMillis() -
mStartTime);
                canvas.drawBitmap(mBitmap, 0, 0, null);
                // force a redraw, with a different time-based pattern.
                invalidate();
        }
}

-- 

3. Question I would hope some of the more experienced programers could help answer...

4. Anyone know if there is a charge limit setting in android phones?

5. Problem with "intent"

6. how to use android-2.3.3_r1 for development

7. Animating an Updating TextView