【发布时间】:2017-08-24 13:23:08
【问题描述】:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setting fullscreen
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.repository_list);
可以看到窗口默认是全屏的。
在异步任务中,要显示通知
@Override
protected void onPreExecute() {
Toast.makeText(this_context,"Downloading",Toast.LENGTH_LONG).show();
mNotifyManager =
(NotificationManager) this_context.getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new NotificationCompat.Builder(this_context);
mBuilder.setContentTitle("Repository")
.setContentText("Download in progress")
.setSmallIcon(android.R.drawable.stat_sys_download);
mBuilder.setProgress(0, 0, false);
// Displays the progress bar for the first time.
mNotifyManager.notify(1, mBuilder.build());
//dialog = ProgressDialog.show(this_context, "Wait", "Downloading...", true);
}
但是窗口是全屏的,看不到通知。 如何在调用 onPostExecute 方法时看到通知然后再次隐藏通知。 感谢您的宝贵时间。
【问题讨论】:
标签: java android android-layout android-asynctask android-notifications