我想彈出在特定時間對話框中的任何應用程序我的代碼:彈出窗口
public class testPOPDialog extends Activity {
/** Called when the activity is first created. */
private Handler mHandler = new Handler();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mHandler.postDelayed(mUpdateTimeTask, 1000);
}
private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
AlertDialog d = new AlertDialog.Builder(testPOPDialog.this)
.setTitle("tanchulai")
.setMessage("bucuo de tanchulai")
.create();
d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
d.show();
}
};
}
它給我
12-03 10:12:18.162: ERROR/AndroidRuntime(571): android.view.WindowManager$BadTokenException: Unable to add window [email protected] -- permission denied for this window type
這是什麼權限 如果我刪除d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
我應用程序是正確的.....
嘿,你是驚人的,它的作品... – Piyush 2010-12-03 11:03:31