public class ReviewActivity extends Activity {
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.reviewfrag_layout);
mInflater = (LayoutInflater) ReviewActivity.this.getSystemService(
LAYOUT_INFLATER_SERVICE);
ContextThemeWrapper mTheme = new ContextThemeWrapper(this,
R.style.customDialog);
mView = mInflater.inflate(R.layout.custom_dialog, null);
// mDialog = new Dialog(this,0); // context, theme
mDialog = new Dialog(mTheme);
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mDialog.setContentView(this.mView);
//if i comment below line code runs otherwise give exception
mDialog.show();
}
}
スタイル:
<style name="customDialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowContentOverlay">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">false</item>
ログメッセージ:10-10 13:20:01.184:E / AndroidRuntime(1417):致命的な例外:メイン10-10 13:20:01.184:E / AndroidRuntime(1417):android.view.WindowManager $ BadTokenException:追加できませんwindow-token android.app.LocalActivityManager $ LocalActivityRecord@411eeaa0は無効です。あなたの活動は実行されていますか?10-10 13:20:01.184:E / AndroidRuntime(1417):android.view.ViewRootImpl.setView(ViewRootImpl.java:585)10-10 13:20:01.184:E / AndroidRuntime(1417):androidでview.WindowManagerImpl.addView(WindowManagerImpl.java:326)10-10 13:20:01.184:E / AndroidRuntime(1417):android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)10-10 13:20: 01.184:E / AndroidRuntime(1417):android.view.WindowManagerImpl $ CompatModeWrapper.addView(WindowManagerImpl.java:149)10-10 13:20:01.184:E / AndroidRuntime(1417):android.view