flick scrolling

by bob » Fri, 20 May 2011 08:36:07 GMT


Sponsored Links
 Is there an easy way to do that scrolling where someone moves their
finger really fast across the screen and the scrolling continues a bit
after their finger has lifted?

-- 



Re: flick scrolling

by TreKing » Fri, 20 May 2011 08:43:06 GMT


 



Yup - real easy - just put your finger down on a scrollable item on the
screen and flick it really fast. It will do exactly what you describe.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 


Sponsored Links


Other Threads

1. MediaStore returning loop of images and not entire directory

Hello, I'm testing some code from a demo found in a forum and I'm
getting some strange results.  My goal is to be able to allow users to
access the pictures on their device to choose an avatar/logo.  This
code run flawlessly except that I only get a handful of images on the
phone.  And its not even always the same images.  Whats more is that
it loads those images into a gridview and repeats them for what looks
like a number of times equal to the actual number of images that are
on the device.  And on top of that if I scroll down the through the
pictures, and scroll back up, it reorders the pictures from what they
were previously.  Each time I load the app the pictures seem to be
different as well.  I have around 400 pictures stored on my phone, and
thats what I'm using to test.  If someone could shed some light on
this for me that would be great.  This is my first time using a URI to
access content to I'm not sure where to start troubleshooting this
one.

public class gallery extends Activity {

    /**
     * Cursor used to access the results from querying for images on
the SD card.
     */
    private Cursor cursor;
    /*
     * Column index for the Thumbnails Image IDs.
     */
    private int columnIndex;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gallery);

        // Set up an array of the Thumbnail Image ID column we want
        String[] projection = {MediaStore.Images.Thumbnails._ID};
        // Create the cursor pointing to the SDCard
        cursor = managedQuery
( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
                projection, // Which columns to return
                null,       // Return all rows
                null,
                MediaStore.Images.Thumbnails.IMAGE_ID);
        // Get the column index of the Thumbnails Image ID
        columnIndex = cursor.getColumnIndexOrThrow
(MediaStore.Images.Thumbnails._ID);

        GridView sdcardImages = (GridView) findViewById(R.id.sdcard);
        sdcardImages.setAdapter(new ImageAdapter(this));

        // Set up a click listener
        sdcardImages.setOnItemClickListener(new OnItemClickListener()
{
            public void onItemClick(AdapterView parent, View v, int
position, long id) {
                // Get the data location of the image
                String[] projection = {MediaStore.Images.Media.DATA};
                cursor = managedQuery
( MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                        projection, // Which columns to return
                        null,       // Return all rows
                        null,
                        null);
                columnIndex = cursor.getColumnIndexOrThrow
(MediaStore.Images.Media.DATA);
                cursor.moveToPosition(position);
                // Get image filename
                String imagePath = cursor.getString(columnIndex);
                // Use this path to do further processing, i.e. full
screen display
            }
        });
    }

    /**
     * Adapter for our image files.
     */
    private class ImageAdapter extends BaseAdapter {

        private Context context;

        public ImageAdapter(Context localContext) {
            context = localContext;
        }

        public int getCount() {
            return cursor.getCount();
        }
        public Object getItem(int position) {
            return position;
        }
        public long getItemId(int position) {
            return position;
        }
        public View getView(int position, View convertView, ViewGroup
parent) {
            ImageView picturesView;
            if (convertView == null) {
                picturesView = new ImageView(context);
                // Move cursor to current position
                cursor.moveToPosition(position);
                // Get the current value for the requested column
                int imageID = cursor.getInt(columnIndex);
                // Set the content of the image based on the provided
URI
                picturesView.setImageURI(Uri.withAppendedPath(
 
MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, "" + imageID));
                picturesView.setScaleType
(ImageView.ScaleType.FIT_CENTER);
                picturesView.setPadding(8, 8, 8, 8);
                picturesView.setLayoutParams(new GridView.LayoutParams
(100, 100));
            }
            else {
                picturesView = (ImageView)convertView;
            }
            return picturesView;
        }
    }
}

-- 

2. Keeping an Activity alive instead of destroying it?

Hi Mark,

It's only causing a slight annoyance to the user. Although the UI
takes about 1.5 seconds to completely build, I am doing a staggered
load. This lets the user see content immediately, but they're
wondering why every time they leave the search activity, then come
back, all the content must be reloaded. The actual search data is kept
in a global static singleton, no problem there, just the UI is kind of
heavy to keep regenerating around it.

This would work better as a tabbed-view in a single Activity, but my
spec calls for the search screen to be in a separate Activity. I like
keeping it separated too, just wish I could pause the app to resume it
later since I'm sure it's an Activity users will keep coming back to
while using the app.

Thanks








-- 

3. Tapping activity after startActivityForResult

4. Sending binary signals on the USB port

5. Programmatically setting the layout_above value

6. How to play two videos gapless using MediaPlayer.

7. New to android and java - Cannot run or debug with eclipse 3.5.1 on windows