sendUserActionEvent() is null

2019-01-04 01:01发布

I've got a real doozy here. When I click on spinners, open menu items, or open context menus on long-clicks I get the same Logcat message:

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

The tag is ViewRootImpl, and the message is sendUserActionEvent() mView == null. I could not find anything helpful about this on the web. I searched through the Android sources and found some references to mView, but I could not find the file in which this log message is printed. For reference, I'm using a Samsung Galaxy S4 running 4.2.2, or API 17. The same message does NOT occur when debugging on a Nexus 7 running Android 4.3. Any ideas? Is this a Samsung-specific issue?

6条回答
虎瘦雄心在
2楼-- · 2019-01-04 01:38

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);
}
查看更多
孤傲高冷的网名
3楼-- · 2019-01-04 01:42

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

查看更多
别忘想泡老子
4楼-- · 2019-01-04 01:42

Consider adding the following into main activity

  @Override
    public boolean onOptionsItemSelected(MenuItem item) {
 ...
        if (id == R.id.action_settings) {
            Intent settingsIntent = new Intent(getApplicationContext(), MySettingsActivity.class);
            startActivity(settingsIntent);
            return true;
        }
...
查看更多
祖国的老花朵
5楼-- · 2019-01-04 01:46

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.

查看更多
冷血范
6楼-- · 2019-01-04 01:56

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.

查看更多
We Are One
7楼-- · 2019-01-04 01:56

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

查看更多
登录 后发表回答