SendUserActionEvent()为空

我这里有一个很特别的东西。当我点击旋转器,打开菜单项,或打开上下文菜单的长点击,我得到相同的 Logcat 消息:

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

标记是 ViewRootImpl,消息是 sendUserActionEvent() mView == null。我在网上找不到任何有用的信息。我搜索了 Android 源代码,找到了一些对 mView的引用,但是找不到打印这条日志消息的文件。作为参考,我使用的是一个运行4.2.2或 API 17的三星Galaxy S4。在运行 Android 4.3的 Nexus 7上进行调试时,不会出现同样的消息。有什么想法吗?这是三星特有的问题吗?

123473 次浏览

I also encuntered the same in S4. I've tested the app in Galaxy Grand , HTC , Sony Experia but got only in s4. You can ignore it as its not related to your app.

Same issue on a Galaxy Tab and on a Xperia S, after uninstall and install again it seems that disappear.

The code that suddenly appear to raise this problem is this:

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);
}

Even i face similar problem after I did some modification in code related to Cursor.

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();
...
}

After i commented out //c.close(); It is working fine. Try out at your end and update Initial setup is as... I have a list view in Fragment, and trying to delete and item from list via contextMenu.

I solved this problem on my Galaxy S4 phone by replacing context.startActivity(addAccountIntent); with startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));

This has to do with having two buttons with the same ID in two different Activities, sometimes Android Studio can't find, You just have to give your button a new ID and re Build the Project

It is an error on all Samsung devices, the solution is: put this line in your activity declaration in Manifest.

android:configChanges="orientation|screenSize"

also when you start the activity you should do this:

Intent intent = new Intent(CurrentActivity.this, NextActivity.class);
intent.setType(Settings.ACTION_SYNC_SETTINGS);
CurrentActivity.this.startActivity(intent);
finish();

I used this to make an activity as fullscreen mode, but this question does not need the fullscreen code, but in all cases might someone need it you can refer to this question for the rest of the code:

How to make VideoView full screen