AlertDialog并未(在背景中) [英] AlertDialog didn't appear (was in background)

查看:141
本文介绍了AlertDialog并未(在背景中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图表明一个AlertDialog使用低于code我的手机应用程序。虽然我的应用程序运行的入口点,在AlertDialog没露面用户。

改为深色的手机屏幕被锁定。不过,我可以preSS手机的返回按钮让应用程序去像取消函数pressed的行为下一个步骤。

在AlertDialog似乎隐藏在应用背景。我想它打电话给前台。

怎么办呢?

顺便说一句,有一对LogCat中显示错误消息。

有人能指出我在哪里,我错了,我也可以提供其他什么信息?

谢谢!

  AlertDialog.Builder助洗剂=新AlertDialog.Builder(Mainx.this);
builder1.setTitle(getResources()的getString(R.string.str_sel_player));
LayoutInflater吹气= LayoutInflater.from(本);
查看functionListView = inflater.inflate(R.layout.dialog_pickitem_action,NULL);
builder1.setView(functionListView);
mlistView =(ListView控件)functionListView.findViewById(R.id.m_functions_listview);
mlistView.setAdapter(新ArrayAdapter<串GT;(这一点,
    android.R.layout.simple_list_item_1,mPlayers));
selDialog = builder1.create();
selDialog.show();


解决方案

这是奇怪的。

您可以尝试使用的ShowDialog()连同onCreateDialog()

覆盖活动的

对话框onCreateDialog(INT ID)

然后调用的ShowDialog(INT ID)

I attempted to show an AlertDialog for my phone application using the code below. While my application ran to the entry point, the AlertDialog did not show up for user.

The phone screen changed to a dark color was locked. However, I can press phone's Back button to let the application go to next step like the behavior of Cancel function pressed.

The AlertDialog seems hidden in the application background. I would like to call it to foreground.

How to do it ?

By the way, there was no error message shown on the LogCat.

Could somebody point me out where I was wrong or what other information I can provide?

Thanks !

AlertDialog.Builder builder1 = new AlertDialog.Builder(Mainx.this);
builder1.setTitle(getResources().getString(R.string.str_sel_player));
LayoutInflater inflater = LayoutInflater.from(this);
View functionListView = inflater.inflate(R.layout.dialog_pickitem_action,null); 
builder1.setView(functionListView);   
mlistView = (ListView) functionListView.findViewById(R.id.m_functions_listview); 
mlistView.setAdapter(new ArrayAdapter<String>(this,                 
    android.R.layout.simple_list_item_1, mPlayers)); 
selDialog = builder1.create();
selDialog.show();

解决方案

It is strange.

You can try to use showDialog() together with onCreateDialog()

override Activity's

Dialog onCreateDialog(int id)

then invoke showDialog(int id)

这篇关于AlertDialog并未(在背景中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆