[android-developers] How to detect orientation change in home screen widget?

2010-03-15 Thread kknight
I am writing a home screen widget and want to update (modify) the home screen widget when the device orientation changes from portrait to landscape or the other way. How can I make it? Currently, I tried to register to CONFIGURATION_CHANGED action like the code below, but the Android didn't allow

[android-developers] Is it OK to use Thread instead of Service in Android home screen widget?

2010-03-06 Thread kknight
I am writing a home screen widget following Jeff Shakey's tutorial, http://android-developers.blogspot.com/2009/04/introducing-home-screen-widgets-and.html. This tutorial uses service to avoid any ANR timeouts. I just wonder, can I use Thread instead of service to do the work of getting data and

[android-developers] How to get rid of WebHistoryItem instances to avoid memory leak?

2010-02-26 Thread kknight
My application often experienced OutOfMemory exception. To trace memory leak, I got memory dump from my application process and examined it in Eclipse Memory Analysis. The tool gave me a report of potential memory leak. The report is listed below. The report said there are many

[android-developers] How to center a button vertically in LinearLayout?

2010-02-03 Thread kknight
I have a LinearLayout, which only contains one button. I want this button to be centered vertically and aligned to the right. I tried many ways, but I couldn't make this button centered vertically. It is always aligned to the top. I also tried to put a button in RelativeLayout, the button can not

[android-developers] Pass event to parent view?

2010-01-25 Thread kknight
I have a layout which contains five TextView. When user clicks any of the five TextView, it will do the same thing: open another activity. So, the OnClickerListener behavior to the five TextView is the same. Is it possible that I only add OnClickListerner to one view, e.g. to layout, so I don't

[android-developers] How to center a ImageView vertically in its parent view?

2010-01-23 Thread kknight
My layout design is a TextView with long text and a ImageView to the right of the TextView. I want to center the ImageView in its parent vertically, so I used android:layout_centerVertical=true, but it turned out that the ImageView was aligned to the bottom of its parent. If I don't use