我是新来的Android,这是我在这里的第一个问题,所以请去容易对我。
I am new to Android and this is my first question here so please go easy on me.
是否有可能来检查活动的一些内幕情况的onCreate(),并显示一个AlertDialog?
Is it possible to check some condition inside onCreate() of an Activity and display an AlertDialog?
我创建一个AlertDialog匿名在OnCreate中(),并在该实例上调用秀,但AlertDialog永远不会显示。
I am creating an AlertDialog anonymously in Oncreate() and calling show on that instance but the AlertDialog is never displayed.
推荐答案显示中的onCreate警告对话框导致android.view.WindowLeaked例外,因为该活动尚未创建。
Showing an alert dialog in onCreate causes android.view.WindowLeaked exception, because the activity isn't yet created.
我找到解决的办法是把code,显示在ONSTART)对话框(方法:
The solution I found is to put the code that shows the dialog in onStart() method:
@Override protected void onStart() { super.onStart(); // show dialog here }更多推荐
显示警报Activity.onCreate(..)
发布评论