• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Beginner problem with OnCreateOptionsMenu

Hi,

I'm a french Android rookie, so excuse my english and my perhaps naive questions...

I am developing an app for Android (minSdk 14).
My main activity is a Processing PApplet, which has to be fullscreen, without an action bar.
From this activity, I want to launch a view to pass variables to my applet. I use onCreateOptionsMenu to open the options menu.
When I press the only item on this menu, I launch a "activity_settings"activity.
So far so good, but it bothers me that the user has to press the Options button, then the "Settings" button in the options menu.

So I tried to directly launch my "activity_settings" activity in onCreateOptionsMenu, without inflating the options menu.
It works the first time, but then "activity_settings" doesnt want to open any more ...
If I do the same thing using onPrepareOptionsMenu instead of onCreateOptionsMenu, it works and works again without problems ...
I do not understand why! If any nice coder wants to explain to me ... that would be nice!


Another issue, I cannot capture the size of an OnTouch event .
Code:
@Override
public boolean onTouchEvent(MotionEvent event) {
Log.d("Touched", String.valueOf(event.getSize()));
return super.onTouchEvent(event);
}
LogCat always shows "Touched" 0.0
Is it because of my device? Samsung GT7560 (Galaxy Trend)

Thank you in advance!
 
Last edited:
My problem is solved. I did figure out that OnCreateOptionsMenu was called once vs OnPrepareOptionsMenu which is called everytime you press the option button...
My device is definitely not able of evaluating size or pressure of a touch event, which I saw when I showed the pointers from dev options.
 
Back
Top Bottom