FBReader Opensource onOptionsSelected to Button click listener

时间:2013-10-09 06:25:07

标签: android eclipse button open-source onclicklistener

请有人帮我解决这个问题。我被困在这里一段时间了。 我正在从伟大的开源项目FBReader for android制作一个e Pub阅读器。问题出在我的应用程序的按钮上。当我点击按钮时,我需要运行选项菜单上提供的相同功能。请帮我。

    protected void onCreate(Bundle icicle) 
    {
    super.onCreate(icicle);
        myFBReaderApp.addAction(ActionCode.SHOW_LIBRARY, new ShowLibraryAction(this,    myFBReaderApp));
        myFBReaderApp.addAction(ActionCode.SHOW_PREFERENCES, new ShowPreferencesAction(this, myFBReaderApp));
        myFBReaderApp.addAction(ActionCode.SHOW_BOOK_INFO, new ShowBookInfoAction(this, myFBReaderApp));

    ImageView plus = (ImageView) findViewById(R.id.BookMarkCropButton);
         plus.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {

**HERE IS THE PROBLEM**
            }
         });



@Override

 public boolean onPrepareOptionsMenu(Menu menu) {
            final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLibrary.Instance();
            if (!zlibrary.isKindleFire() && !zlibrary.ShowStatusBarOption.getValue()) {
                getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            }

            setupMenu(menu);

            return super.onPrepareOptionsMenu(menu);
        }

        @Override
        public void onOptionsMenuClosed(Menu menu) {
            super.onOptionsMenuClosed(menu);
            final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLibrary.Instance();
            if (!zlibrary.isKindleFire() && !zlibrary.ShowStatusBarOption.getValue()) {
                getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            }
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLibrary.Instance();
            if (!zlibrary.isKindleFire() && !zlibrary.ShowStatusBarOption.getValue()) {
                getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            }
            return super.onOptionsItemSelected(item);
        }

1 个答案:

答案 0 :(得分:0)

最后我得到了答案。只需调用与所需功能关联的 ACTON_CODE 即可完成此操作。