如何调试我的Java应用程序崩溃的原因?

时间:2017-12-10 13:32:04

标签: java xml

当我使用下面的菜单选择代码时,我的应用程序崩溃了。我在这里使用view来显示来自外部类的Snackbar消息。那就是我收到错误的原因。但它将数据保存在数据库中

create table xyz(
  aChar_num smallint not null,
  aChar as (char(aChar_num)),
  primary key(aChar_num)
);

with nums as (
      select 1 as n
      union all
      select n + 1
      from nums
      where n + 1 < 250
     )
insert into xyz (aChar_num)
    select nums.n
    from nums
    option (maxrecursion 0);

1 个答案:

答案 0 :(得分:0)

经过多次搜索后,我用以下代码解决了这个问题:

@Override
public boolean onOptionsItemSelected(MenuItem item)
{
    View view = findViewById(R.id.cl_entry); // id of constraint layout
    if (item.getItemId() == R.id.action_save){
        insertRecord(view);
    }
    return super.onOptionsItemSelected(item);
}