Gallery Child View Problem

by Alekh » Tue, 14 Apr 2009 00:58:49 GMT

Sponsored Links
 I have created a child class from the Gallery view, named MyGallery. I
did this because I wanted to get rid of the onFling event in the
gallery view. Having that achieved, it lead me to a different problem.
Scrolling the Gallery with the Dpad doesn't work now. When I tried
using the original Gallery class, the dpad works fine. But when I
extend the Gallery and use my custom gallery class, the dpad stops
working. Am I missing something? Please help.


Gallery Child View Problem

by Marco Nelissen » Tue, 14 Apr 2009 01:12:09 GMT

 How did you get rid of the onFling event? It sounds like whatever you
did to achieve that also broke scrolling.


Sponsored Links

Gallery Child View Problem

by Alekh » Tue, 14 Apr 2009 12:29:08 GMT

 Actually I wanted only one image to be scrolled at a time when we
swipe with the finger. Like the image viewer in the iPhone. Or like
the desktop screens that android has. So all i did is, I overrided the
onFling event and just returned true. So now, if i swipe with my
finger, i get only the next or the previous image. But it now doesn't
respond to the dpad. I dunno what is wrong. I tried requestFocus() but
nothing seems to work. Yes u r right. I dint want scrolling in
gallery. Any suggestions?

How do i get the default functionality of the gallery view by just
extending it? i.e. the dpad left and right keys.. Pls reply fast. I m
stuck here.


Gallery Child View Problem

by Alekh » Tue, 14 Apr 2009 13:02:48 GMT

 Ok the problem has been solved!!

When extending the GalleryView, if we set the spacing between images
using the setSpacing(), the Dpad doesn't allow scrolling. If we don't
use setSpacing(), the Dpad works as intended.

I would like to know if this is a bug or is it designed in this way.
Coz I don't understand why the dpad events dont work when setSpacing()
is used..

Pls reply..


Other Threads

1. Building and booting kernel

I haven't seen this all written down in one place so I thought I'd put
it together in a single post.  Here's one way to build and boot an
android kernel.

- Get the android repo and build it
  - you'll need to build system/core/fastboot if it isnt built by
  - your tools will be in a directory like out/host/linux-x86/bin.
You'll probably want these in your path.
  - under linux you'll need to run fastboot and adb as root to access
the usb device

- Get the ramdisk image from your phone.  We'll boot a kernel using
the existing ramdisk.
  - I used JFreke's recovery image.  Get
  - unzip and extract recovery.img from it
  - put your phone into fastboot mode and hook it up using a usb cable
    - on adp1 power on while holding camera, then when its on hit
  - run "fastboot boot recovery.img" to boot into recovery mode.
  - after it boots hit ALT+B to backup your flash to your sdcard.
  - hit HOME+BACK to reboot your phone normally
  - use "adb pull" to get the boot.img from your sdcard
    - it will be under /sdcard/nandroid.  the path will vary based on
the date and your device
    - "adb pull /sdcard/nandroid/HTxxxxxxx/2009xxxx-xxxx/boot.img
- Extract the ramdisk.img from the boot.img
  - grab the attached and run it
    - boot.img; mv ram ramdisk.img
    - you can manually extract the data if you dont have python.
Offsets 8 and 16 in the file have byte lengths of the kernel and
ramdisk.  Round up to 2048-byte page sizes.  The format is 1 page
header + kernel + ramdisk + ....
      - if kernel is 779 pages and ramdisk is 73 pages then:
      - dd if=boot.img of=ramdisk.img bs=2048 skip=780 count=73

- Get the kernel sources and build.  (my android repo is in /mydroid)
  $ git clone git://
  $ cd msm
  $ export PATH=$PATH:/mydroid/prebuilt/linux-x86/toolchain/arm-
  $ ARCH=arm CROSS_COMPILE=arm-eabi- make

- Boot the phone with your new kernel
  - go into fastboot mode again
  - run "fastboot boot arch/arm/boot/zImage ramdisk.img"
  - you can use mkbootimg to create a boot.img from the kernel and
ramdisk and flash it to your device using fastboot if you wish to
permanently boot your new kernel or you can use "fastboot flash:raw
boot zImage ramdisk.img" to automatically create the boot.img and
flash it

---- ----
#!/usr/bin/env python
extract a ramdisk from a boot image.
Usage: boot.img
Outputs to "ram"

import sys, struct

if len(sys.argv) != 2 :
    print "usage:  %s fn" % sys.argv[0]
    raise SystemExit(1)
fn = sys.argv[1]

pgsz = 2048
f = file(fn, "rb")
hdr =
kernlen,dummy,ramlen = struct.unpack("<III", hdr[8:20])
kernpg = (kernlen + pgsz - 1) / pgsz
rampg = (ramlen + pgsz - 1) / pgsz * (1+kernpg))
d = * rampg)
of = file("ram", "wb")
---- end ----

2. 1.6 r1 and sdcard emulator problem

Hi all,

I've updated to SDK 1.6 and created the new AVD and emulator sdcard image
file sucesssfully.
I'm using following code to store binary file in sdcard:
      File file = new File("sdcard/mypackage.folder1");
     if(!file.exists() && file.mkdir())
       file = new File('myfile.bin');

      FileOutputStream stream = new FileOutputStream('myfile.bin');
      objectOut = new ObjectOutputStream(new BufferedOutputStream(stream));
Exactly the same code is working properly with SDK 1.5.

For some reason file.mkdir( ) always returns false.

Does anybody got such problem?

Thanks in advance,


3. EditText default action

4. Problem to add an image in ListActivity.

5. Display Images from a particular folder in sdcard

6. Framework Debug

7. Searchable Dictionary Example: R.raw.definitions cannot be resolved