error java.lang.RuntimeException: Can't create handler inside
thread that has not called Looper.prepare() =(
Если я позвоню showDialog (id)
в GameActivity
- работает Но если я называю activity.showDialog
из другого класса - ошибкаAndEngine alertdialog ошибка
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case 1:
Log.d("Dialog", "Dialog 1");
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Help");
alert.setMessage("Help");
WebView wv = new WebView(this);
wv.loadUrl("http:\\www.google.com");
wv.setWebViewClient(new WebViewClient()
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});
alert.setView(wv);
AlertDialog ALERT = alert.create();
return ALERT;
default:
return null;
}
}
Я хочу, чтобы вызвать диалоговое окно с любым другим классом
ОБНОВЛЕНИЕ:
new code activiti.runOnUiUpdate()
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case 1:
this.runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("Dialog", "Dialog 1");
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Help");
alert.setMessage("Help");
WebView wv = new WebView(this);
wv.loadUrl("http:\\www.google.com");
wv.setWebViewClient(new WebViewClient()
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});
alert.setView(wv);
AlertDialog aALERT = alert.create();
}
});
return ALERT;
default:
return null;
}
}
сделать ваш диалог в 'activity.runOnUiThread (...)' метод – kabuto178
ошибка - Конструктор AlertDialog.Builder (новый Runnable() {}) не определен – user2828109
Конструктор WebView (новый Runnable() {}) является undefined – user2828109