アプリケーションの右上にあるonCreateOptionsMenuを表示したいと思います。 3つの点に触れることなく。アプリは、私が自動的にユーザーにメニュー項目を表示したい初めて実行するときに私が実際に行うために滑走しています、私はsee the screenshot to get more detailsonCreateOptionsMenuを自動的にトリガーする方法
SharedPreferences preferences= PreferenceManager.getDefaultSharedPreferences(this);
if (!preferences.getBoolean("Time",false))
{
// code to trigger onCreateOptionsMenu
Toast.makeText(getApplicationContext(), "Showing menu items ", Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor=preferences.edit();
editor.putBoolean("Time",true);
editor.commit();
}
コードで実行したいことを探している場合は、_How to ...プログラムで検索することをお勧めします。多くのスタックオーバーフロー解答の横にある - 多くの場合f.e. AppCompat/Toolbarと 'onCreate'のトラブル:http://stackoverflow.com/questions/3133318/how-to-open-the-options-menu-programmaticallyと別のもの、もしあなたがUI(UIスレッド上)プログラムではチェックアウトするのが良いかもしれないhttp://stackoverflow.com/questions/12850143/android-basics-running-code-in-the-ui-thread – makadev