Using java Syntax Highlighting
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.main);
- findViewById(R.id.button).setOnPopulateContextMenuListener(contextMenuListener);
- }
- private OnPopulateContextMenuListener contextMenuListener = new OnPopulateContextMenuListener() {
- public void onPopulateContextMenu(ContextMenu menu, View view, Object obj) {
- menu.setHeader("Title");
- populateMenu(menu);
- }
- };
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- populateMenu(menu);
- return true;
- }
- private void populateMenu(Menu menu) {
- ...
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
Using xml Syntax Highlighting
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <Button
- android:id="@+id/button"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Hello World, MenuDemo"
- />
- </LinearLayout>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
When I click roughly 2 seconds the center button(on keyboard) context menu is shown.
But when I touching roughly 2 seconds context menu isn't shown.
What is wrong?


