I'm making my alarm app. There is an Activity to show alarm infomation. I want turn on the screen and unlock it. I wrote these code
AlarmActivity.java:
public class AlarmActivity extends Activity { ...... void onCreate(Bundle bl) { ..... final Window win = getWindow(); win.requestFeature(android.view.Window.FEATURE_NO_TITLE); win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); LayoutInflater inflater = LayoutInflater.from(this); setContentView(inflater.inflate(R.layout.alarm, null)); } ...... }
AndroidManifest.xml
{activity android:name="AlarmTaskActivity" android:excludeFromRecents="true" android:theme="@android:style/Theme.Wallpaper.NoTitleBar" android:launchMode="singleInstance" android:taskAffinity="" android:configChanges="orientation|keyboardHidden|keyboard|navigation"/}
It's ok,but when I change
android:theme="@android:style/Theme.Wallpaper.NoTitleBar"
to
android:theme="@android:style/Theme.Dialog"
the screen did not turn on nor unlock, I am really confused....
Can you please tell me how to make the screen turn on and unlock when I use "@android:style/Theme.Dialog"?
Thanks
by the way,I have android 2.0 in my test device.