Android x86_64 and x86 emulator crash on AlertDialog.onClick event

ぐ巨炮叔叔 提交于 2019-12-10 19:59:39

问题


I'm testing an Android app in x86_64 and x86 emulator and it crash (Android emulator closed unexpectedly) after select an item from a AlertDialog that shows a list. AlertDialog is called from onOptionsItemSelected overrided method in class that extends from AppCompatActivity.

Some code:

public class ListViewActivity extends AppCompatActivity {

  private static final String TAG = "android-user-interface";

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.menu_main, menu);
      return true;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      Toast.makeText(this, "Item de menu seleccionado", Toast.LENGTH_SHORT).show();
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setTitle("titulo")
              .setItems(new String[]{"uno", "dos", "tres"}, new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                      //fails before this
                  }
              });
      AlertDialog alertDialog = builder.create();
      alertDialog.show();
      //return super.onOptionsItemSelected(item);
      return true;
  }
  //...
}

In crash windows I got

Operating system: Windows NT
                  10.0.10586 
CPU: amd64
     family 6 model 60 stepping 3
     8 CPUs

Crash reason:  EXCEPTION_ACCESS_VIOLATION_READ
Crash address: 0x18
Assertion: Unknown assertion type 0x00000000
Process uptime: not available
... more info

Some ideas / information about this issue?

来源:https://stackoverflow.com/questions/39893311/android-x86-64-and-x86-emulator-crash-on-alertdialog-onclick-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!