In Google Glass, Menu Items are not shown after XE 17.2 Update, any Solutions?

Posted by Amalan Dhananjayan on Stack Overflow See other posts from Stack Overflow or by Amalan Dhananjayan
Published on 2014-05-30T03:57:45Z Indexed on 2014/05/30 21:27 UTC
Read the original article Hit count: 223

Filed under:
|
|

This worked when the Glass in on XE12, I have opened the solution after about 2 Months and now with XE17 the menu items are not shown when tapped on the Live card, instead the live card is disappearing.
I have updated the GDK, I have changed the code to support the latest GDK sneak peek version 2 changes according to this (https://developers.google.com/glass/release-notes#xe12)

This is the code

public class MenuActivity extends Activity {

private static final String TAG = MenuActivity.class.getSimpleName();

private VisionService.VisionBinder mVisionService;
private ServiceConnection mConnection = new ServiceConnection() {
    @Override
    public void onServiceConnected(ComponentName name, IBinder service) {
        if (service instanceof VisionService.VisionBinder) {
            mVisionService = (VisionService.VisionBinder) service;
            openOptionsMenu();
        }
        // No need to keep the service bound.
        unbindService(this);
    }

    @Override
    public void onServiceDisconnected(ComponentName name) {

    }
};
private boolean mResumed;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    bindService(new Intent(this, VisionService.class), mConnection, 0);
}

@Override
protected void onResume() {
    super.onResume();
    mResumed = true;
    openOptionsMenu();
}

@Override
protected void onPause() {
    super.onPause();
    mResumed = false;
}

@Override
public void openOptionsMenu() {
    if (mResumed && mConnection != null) {
        super.openOptionsMenu();
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_send) {
        mVisionService.requestWorkOrderCard();
        finish();
        return true;
    } else if (id == R.id.action_refresh) {
        mVisionService.requestTopWorkOrders();
        finish();
        return true;
    } else if (id == R.id.action_finish) {
        stopService(new Intent(this, VisionService.class));
        finish();
        return true;
    } else {
        return super.onOptionsItemSelected(item);
    }
}

@Override
public void onOptionsMenuClosed(Menu menu) {
    super.onOptionsMenuClosed(menu);
}
}

It would be great if any body could help on this. Thank You

© Stack Overflow or respective owner

Related posts about android

Related posts about google-glass