Redrawing Widget When Changing Orientation

by Matt M » Tue, 27 Apr 2010 05:03:42 GMT


Sponsored Links
 Hello,

I have a widget set up and it displays properly in both portrait and
landscape when added to each. But when I change orientation it has the
problem "Problem Loading Widget". I delete this, re-add the widget,
and it displays correctly. Thus, my widget can support both portrait
and landscape but it doesn't survive an orientation switch.

What am I missing? Do I need to redraw the widget when orientation is
changed? Doesn't it do this automatically? Do I need to call
onUpdate() somehow?

Thank you!

Matt.

--



Redrawing Widget When Changing Orientation

by Matt M » Wed, 28 Apr 2010 08:20:06 GMT


 I've discovered the method call that causes the problem but I still
don't understand why..

In an activity, after saving and exiting I make a static method call
MyAppWidget.forceUpdate(this, "text");

Below is the method which updates the text of the widget
    public static void forceUpdate(Context context, String note)
    {
        if (context != null)
        {
                ComponentName thisWidget = new
ComponentName(context,WhiteboardWidget.class);
                AppWidgetManager manager =
AppWidgetManager.getInstance(context);
                RemoteViews views = new
RemoteViews("whiteboard",R.layout.widget_layout);
                views.setTextViewText(R.id.boardNote, note);
                manager.updateAppWidget(thisWidget, views);
        }
    }

Any ideas now??

--


Sponsored Links


Other Threads

1. Emulator stoped at [emulator: ping command: /home/user1/android-sdk-linux_x86/tools/ddms ping emulator 10.0]

I want to test some drivers in Android by using the
Emulator(Android-2.3.3 kernel-2.6.29-00261-g0097074-dirty )
So I get the config.tgz throgh adb, and download the kernel
linux-2.6-8e0ee43.tar.gz from
http://android.git.kernel.org/?p=kernel/linux-2.6.git;a=snapshot;h=8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84;sf=tgz

I uncompress the config.tgz. and move it to kernel folder with name
".config" ,then make menuconfig and load .config and save to .config
with out and change.

after " make " ,  arch/arm/boot/zImage created!

I start emulator wiht "-kernel arch/arm/boot/zImage" ,but the virtual
machine start android failed, the I use -verbose ,get some log
followed:

------------------------------------------Boot
Log------------------------------------------------------------
[user1@x64 ~]$ emulator -avd dachine -debug-kernel -verbose -kernel ./
Work/TemporaryLook/linux-2.6-8e0ee43/arch/arm/boot/Image
emulator: found SDK root at /home/user1/android-sdk-linux_x86
emulator: root virtual device file at /home/user1/.android/avd/
dachine.ini
emulator: virtual device content at /home/user1/.android/avd/
dachine.avd
emulator: virtual device config file: /home/user1/.android/avd/
dachine.avd/config.ini
emulator:     locking user data image at /home/user1/.android/avd/
dachine.avd/userdata-qemu.img
emulator:     locking cache image at /home/user1/.android/avd/
dachine.avd/cache.img
emulator:     locking SD Card image at /home/user1/.android/avd/
dachine.avd/sdcard.img
emulator: ignoring non-existing snapshots at /home/user1/.android/avd/
dachine.avd/snapshots.img: No such file or directory
emulator: found skin 'QVGA' in directory: /home/user1/android-sdk-
linux_x86/platforms/android-10/skins
emulator: autoconfig: -skin QVGA
emulator: autoconfig: -skindir /home/user1/android-sdk-linux_x86/
platforms/android-10/skins
emulator: keyset loaded from: /home/user1/.android/default.keyset
emulator: trying to load skin file '/home/user1/android-sdk-linux_x86/
platforms/android-10/skins/QVGA/layout'
emulator: skin network speed: 'full'
emulator: skin network delay: 'none'
QEMU options list:
emulator: argv[00] = "emulator"
emulator: argv[01] = "-kernel"
emulator: argv[02] = "./Work/TemporaryLook/linux-2.6-8e0ee43/arch/arm/
boot/Image"
emulator: argv[03] = "-netspeed"
emulator: argv[04] = "full"
emulator: argv[05] = "-netdelay"
emulator: argv[06] = "none"
emulator: argv[07] = "-initrd"
emulator: argv[08] = "/home/user1/android-sdk-linux_x86/platforms/
android-10/images//ramdisk.img"
emulator: argv[09] = "-nand"
emulator: argv[10] = "system,size=0x5900000,initfile=/home/user1/
android-sdk-linux_x86/platforms/android-10/images//system.img"
emulator: argv[11] = "-nand"
emulator: argv[12] = "userdata,size=0x4200000,file=/home/
user1/.android/avd/dachine.avd/userdata-qemu.img"
emulator: argv[13] = "-nand"
emulator: argv[14] = "cache,size=0x4200000,file=/home/user1/.android/
avd/dachine.avd/cache.img"
emulator: argv[15] = "-hda"
emulator: argv[16] = "/home/user1/.android/avd/dachine.avd/sdcard.img"
emulator: argv[17] = "-loadvm"
emulator: argv[18] = "default-boot"
emulator: argv[19] = "-savevm-on-exit"
emulator: argv[20] = "default-boot"
emulator: argv[21] = "-serial"
emulator: argv[22] = "android-kmsg"
emulator: argv[23] = "-serial"
emulator: argv[24] = "android-qemud"
emulator: argv[25] = "-lcd-density"
emulator: argv[26] = "120"
emulator: argv[27] = "-append"
emulator: argv[28] = "qemu=1 console=ttyS0 android.checkjni=1
android.qemud=ttyS1"
emulator: argv[29] = "-m"
emulator: argv[30] = "256"
emulator: argv[31] = "-clock"
emulator: argv[32] = "unix"
emulator: argv[33] = "-android-avdname"
emulator: argv[34] = "dachine"
emulator: argv[35] = "-android-hw"
emulator: argv[36] = "/tmp/android/emulator-WS8NCZ"
Concatenated QEMU options:
 emulator -kernel ./Work/TemporaryLook/linux-2.6-8e0ee43/arch/arm/boot/
Image -netspeed full -netdelay none -initrd /home/user1/android-sdk-
linux_x86/platforms/android-10/images//ramdisk.img -nand
system,size=0x5900000,initfile=/home/user1/android-sdk-linux_x86/
platforms/android-10/images//system.img -nand
userdata,size=0x4200000,file=/home/user1/.android/avd/dachine.avd/
userdata-qemu.img -nand cache,size=0x4200000,file=/home/user1/.android/
avd/dachine.avd/cache.img -hda /home/user1/.android/avd/dachine.avd/
sdcard.img -loadvm default-boot -savevm-on-exit default-boot -serial
android-kmsg -serial android-qemud -lcd-density 120 -append qemu=1
console=ttyS0 android.checkjni=1 android.qemud=ttyS1 -m 256 -clock
unix -android-avdname dachine -android-hw /tmp/android/emulator-WS8NCZ
emulator: registered 'boot-properties' qemud service
emulator: mapping 'system' NAND image to /tmp/android/emulator-VpVzYf
emulator: rounding devsize up to a full eraseunit, now 5913000

emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'dalvik.vm.heapsize' = '24m'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '120'
emulator: using 'pa' audio input backend
emulator: using 'pa' audio output backend
emulator: Trace file name is not set

emulator: control console listening on port 5554, ADB on port 5555
emulator: sent '0012host:emulator:5555' to ADB server
emulator: ping program: /home/user1/android-sdk-linux_x86/tools/ddms
emulator: ping command: /home/user1/android-sdk-linux_x86/tools/ddms
ping emulator 10.0

--------------------------------------END Boot
Log------------------------------------------------------------------

Am I forgot something?

-- 

2. Hardware key combination capture

Hi,

I'm building an app that needs an "emergency" key combination to fire
an alarm. I was planning to use some hardware key combination like
"pressing center button for 3 seconds" or "home and back together",
but all i've been able to find are negative answers to anything that
seems like key capture.
I fully understand the security issues in capturing all the keystrokes
or special keys like home or end call. However, there should be a way
to assign an application to a given hardware key or at least to trap
some of the hardware keys.
Also, it should be done from a service with no user interface.
Otherwise it's impossible to create such an application.

It looks like there are some key loggers out there, and even if don't
want exactly that and will never install such an app, it seems that
after all it is possible to capture key strokes.

Any help would be greatly appreciated.

Thanks in avance,
Narciso

-- 

3. Multi-touch MotionEvent pointer IDs changing over time

4. Custom ListView does not show

5. Peculiar behavior with Matrix class

6. Sharing Data between applications

7. HELP: Retrieve USSD Message