sendUserActionEvent()为null

我在这里有一个真正的愚蠢。 当我单击spinners时,打开菜单项,或长时间打开上下文菜单我得到相同的Logcat消息:

08-02 21:20:57.264: E/ViewRootImpl(31835): sendUserActionEvent() mView == null 

标记是ViewRootImpl ,消息是sendUserActionEvent() mView == null 。 我在网上找不到任何有用的信息。 我search了Android的来源,发现一些引用mView ,但我找不到打印此日志消息的文件。 作为参考,我使用的是运行4.2.2或API 17的Samsung Galaxy S4。在运行Android 4.3的Nexus 7上进行debugging时,不会出现相同的消息。 有任何想法吗? 这是一个三星特定的问题?

我也在S4中也一样。 我已经testing了Galaxy Grand,HTC,Sony Experia的应用程序,但是只有在S4。 你可以忽略它,因为它与你的应用程序无关。

我通过replacecontext.startActivity(addAccountIntent)解决了我的Galaxy S4手机上的这个问题; 用startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));

Galaxy Tab和Xperia S上的同样的问题,卸载并重新安装后似乎消失。

突然出现这个问题的代码是这样的:

 public void unlockMainActivity() { SharedPreferences prefs = getSharedPreferences("CALCULATOR_PREFS", 0); boolean hasCode = prefs.getBoolean("HAS_CODE", false); Context context = this.getApplicationContext(); Intent intent = null; if (!hasCode) { intent = new Intent(context, WellcomeActivity.class); } else { intent = new Intent(context, CalculatingActivity.class); } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); (context).startActivity(intent); } 

即使我在与光标相关的代码中做了一些修改后,也面临类似的问题。

 public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo)item.getMenuInfo(); Cursor c = (Cursor)adapter.getItem(info.position); long id = c.getLong(...); String tempCity = c.getString(...); //c.close(); ... } 

在我注释掉//c.close()之后; 它工作正常。 尝试在你的最后和更新初始设置是因为…我有一个列表视图在片段,并试图删除和项目从列表通过contextMenu。

考虑将以下内容添加到主要活动中

  @Override public boolean onOptionsItemSelected(MenuItem item) { ... if (id == R.id.action_settings) { Intent settingsIntent = new Intent(getApplicationContext(), MySettingsActivity.class); startActivity(settingsIntent); return true; } ...