Android 1.5 SDK and setTheme problem

by Rmac » Wed, 29 Apr 2009 05:56:21 GMT

Sponsored Links
 Before I report this as a bug, has anyone been able to set a theme in
1.5?  What worked in 1.1 no longer does in 1.5 for setting themes.
For example the following:

 protected void onCreate(Bundle savedInstanceState) {

doesn't seem to work unless you move the setTheme before
super.onCreate like this:

 protected void onCreate(Bundle savedInstanceState) {

Is this the way themes have to be set or is it a 1.5 bug?

Other Threads

1. How do I stop cycling of content in an AppWidget when homescreen is not displayed?

Hi all,

I'm developing what amounts to an RSS homescreen widget that
periodically (every few hours) downloads headlines from an RSS feed,
then displays each headline in the widget one at a time, cycling to a
new item every 10 seconds.

All this functionality is working correctly, however watching some log
statements generated by the widget on the DDMS console, I see that
even when the homescreen of the device is not displayed (either
another application is in the foreground, or the display itself is
asleep), the widget content is still cycling every 10 seconds.  This
is obviously a concern for battery life.

Currently I'm using an AlarmManager to handle the cycling of the
widget content at this 10 second interval, but I have no idea how to
suspend the alarm when the homescreen is not displayed or the device
is asleep.  I have scoured the documentation, but cannot find any
obvious event I can listen for or API I can query to find out if the
homescreen is currently displayed or not.

Google's "News and Weather" widget that comes out of the box with
Froyo has similar functionality to the widget I'm developing, but it
does seem to stop cycling through news items when the homescreen is
not in the foreground or the screen is off.

Any help on how to achieve this would be greatly appreciated!




2. Gestures - onFling() not called when longPressed is enabled

Hello developers,

I have got a serious problem concerning the detection of gesture

I have implemented my own gesture detector and have the following

When I pressed the touchscreen for a long time (onLongPress() is
called) and I keep touching the screen my application doesn't listen
to my touch events anymore. Do you maybe know why the touch events
don't get detected anymore after keeping the finger on the screen?
I want to implement a swipe gesture after keeping the finger on the
screen for a longer time (after onLongpress() is called). I hope you
understood my problem  and here is my code:

import android.os.Bundle;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

public class GestureDetect extends Activity implements
OnGestureListener {
   private LinearLayout main;
   private TextView viewA;

   boolean longPress;

   private static final int SWIPE_MIN_DISTANCE = 120;
   private static final int SWIPE_MAX_OFF_PATH = 250;
   private static final int SWIPE_THRESHOLD_VELOCITY = 200;

   private GestureDetector gestureScanner;

   public void onCreate(Bundle savedInstanceState) {
      gestureScanner = new GestureDetector(this);
      main = new LinearLayout(this);
      main.setLayoutParams(new LinearLayout.LayoutParams(320, 480));
      viewA = new TextView(this);
      viewA.setLayoutParams(new LinearLayout.LayoutParams(320, 80));

   public boolean onTouchEvent(MotionEvent me) {
      return gestureScanner.onTouchEvent(me);

   public boolean onDown(MotionEvent e) {
      viewA.setText("-" + "DOWN" + "-");
      return true;

   public boolean onFling(MotionEvent e1, MotionEvent e2, float
         float velocityY) {
      try {
         if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
            return false;
         // right to left swipe
         if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE
               && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
               Toast.makeText(getApplicationContext(), "Left Swipe",
         } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
               && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
            Toast.makeText(getApplicationContext(), "Right Swipe",
         } else if (e1.getY() - e2.getY() > SWIPE_MIN_DISTANCE
               && Math.abs(velocityY) > SWIPE_THRESHOLD_VELOCITY) {
            Toast.makeText(getApplicationContext(), "Swipe up",
         } else if (e2.getY() - e1.getY() > SWIPE_MIN_DISTANCE
               && Math.abs(velocityY) > SWIPE_THRESHOLD_VELOCITY) {
            Toast.makeText(getApplicationContext(), "Swipe down",
      } catch (Exception e) {
         // nothing
      return true;

   public void onLongPress(MotionEvent e) {
      Toast mToast = Toast.makeText(getApplicationContext(),"Long

   public boolean onScroll(MotionEvent e1, MotionEvent e2, float
         float distanceY) {
      viewA.setText("-" + "SCROLL" + "-");
      return true;

   public void onShowPress(MotionEvent e) {
      viewA.setText("-" + "SHOW PRESS" + "-");

   public boolean onSingleTapUp(MotionEvent e) {
      Toast mToast = Toast.makeText(getApplicationContext(), "Single
      return true;


Best regards and thank you,


3. resources as strings

4. "SKD Manager.exe" doesn't even work on Windows XP SP3...

5. Connect to apache webserver from android emulator

6. Intercept bluetooth headset button or action (again...)

7. disable hard Search button while contextmenu is on.