androidquickaction

Android menu library: NewQuickAction3D didn't work


I'm try these two library to create a button menu in my android application NewQuickAction and NewQuickAction3D.

The code to use them is the same! But if I use NewQuickAction it works correctly, instead if i change the external library in my project and I use NewQuickAction3D, it doesn't work and return this error:

FATAL EXCEPTION: main java.lang.NullPointerException at net.londatiga.android.QuickAction.addActionItem(QuickAction.java:213)

The code is:

    ActionItem myLocationItem   = new ActionItem(ID_MY_LOCATION, "Mia posizione", getResources().getDrawable(R.drawable.location));
    ActionItem nearestItem      = new ActionItem(ID_NEAREST_STATION, "Stazione piu vicina", getResources().getDrawable(R.drawable.location));
    ActionItem activeGpsItem    = new ActionItem(ID_ACTIVE_GPS, "Attiva GPS", getResources().getDrawable(R.drawable.gps));

    // constructor for NewQuickAction       
    final QuickAction mQuickAction  = new QuickAction(this );

    // constructor for NewQuickAction3D
    //final QuickAction mQuickAction    = new QuickAction(this, QuickAction.VERTICAL);

    mQuickAction.addActionItem(myLocationItem);
    mQuickAction.addActionItem(nearestItem);
    mQuickAction.addActionItem(activeGpsItem);


    //setup the action item click listener
    mQuickAction.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
        @Override
        public void onItemClick(QuickAction quickAction, int pos, int actionId) {

            if (actionId == ID_MY_LOCATION) {
                Toast.makeText(getApplicationContext(), "I have no info this time", Toast.LENGTH_SHORT).show();
            } else if (actionId == ID_NEAREST_STATION ) {
                Toast.makeText(getApplicationContext(), "I have no info this time", Toast.LENGTH_SHORT).show();
            } else {
                Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                startActivity(intent);
            }
        }
    });

    ImageButton buttonMenu = (ImageButton) findViewById(R.id.button_menu);
    buttonMenu.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
                mQuickAction.show(v);
           }
        });

It seems that the icon and text used to create a new ActionItem are not visible with NewQuickAction3D

If I run the libraries as a normal project (the libraries are also a demo projects), they work correctly.

Something ideas?


Solution

  • Finally after trying a lot of solutions, THE ONLY (AND NOT ELEGANT!) way to solve my problem, has been to importing directly into my project the Classes, the Xml files and the drawables of the library necessary to perform the popup menu that I wanted.

    This is not a good way, but anything worked for me!