Question

Can someone help me to fix this please. I am stuck in here for a while. I am making a e Pub reader from the great opensource project FBReader for android. The problem is with the buttons of my app. When i click on the buttons, i need to run the same feature provided on the options menu. Please help me.

    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);
        }
Was it helpful?

Solution

Finally i got the answer. This can be done by simply calling the ACTON_CODE associated with the required feature.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top