Android - Skipped frames message from Choreographer

落花浮王杯 提交于 2019-12-01 07:06:27

问题


In my application, I am receiving many Skipped frames message from Choreographer. So, I started checking one by one, and I was very much surprised to see 76 Skipped frames when I just click on the default menu button on my MainActivity page.

To find out the problem, I commented out almost all methods from my MainActivity java, and still I am getting 77 Skipped frames! There is not Skipped frames message during loading of MainActivity page, it just pop up whenever I click on menu button on top-right corner.

Can anybody please help?

EDIT: I noticed that method onCreateOptionsMenu is only called one time during first creation. After that it never get called. So, which method is responsible for showing the menu, and why is this delay?

Below are the current active part of my code:

MainActivity:

public class MainActivity extends Activity {
    public static int CURR_BOOK_ID = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //populateData(0,0);
        //ActivitySwipeDetector swipe = new ActivitySwipeDetector(this, (SwipeInterface) this);
        //RelativeLayout swipe_layout = (RelativeLayout) findViewById(R.id.mainll);
        //swipe_layout.setOnTouchListener(swipe);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
}

Menu:

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:icon="@drawable/settings"
        android:showAsAction="ifRoom"
        android:title="@string/action_settings"/>

    <item
        android:id="@+id/importexport"
        android:orderInCategory="50"
        android:icon="@drawable/import_export"
        android:showAsAction="ifRoom"
        android:title="@string/importexport"/>

    <item
        android:id="@+id/deleteentry"
        android:orderInCategory="40"
        android:icon="@drawable/delete_entry"
        android:showAsAction="ifRoom"
        android:title="@string/deleteentry"/>

    <item
        android:id="@+id/editentry"
        android:orderInCategory="20"
        android:icon="@drawable/edit_entry"
        android:showAsAction="ifRoom"
        android:title="@string/editentry"/>

    <item
        android:id="@+id/addentry"
        android:orderInCategory="30"
        android:icon="@drawable/add_entry"
        android:showAsAction="ifRoom"
        android:title="@string/addentry"/>

    <item
        android:id="@+id/showlist"
        android:orderInCategory="10"
        android:icon="@drawable/show_list"
        android:showAsAction="ifRoom"
        android:title="@string/showlist"/>

</menu>

Menu Button (that triggers the message):

来源:https://stackoverflow.com/questions/20143861/android-skipped-frames-message-from-choreographer

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