Java Code Examples for android.widget.GridView#setOnCreateContextMenuListener()
The following examples show how to use
android.widget.GridView#setOnCreateContextMenuListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyPinsActivity.java From android-pdk with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_pins); setTitle("My Pins"); _pinAdapter = new PinsAdapter(this); _gridView = (GridView) findViewById(R.id.grid_view); _gridView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.context_menu_boards, menu); } }); _gridView.setAdapter(_pinAdapter); myPinsCallback = new PDKCallback() { @Override public void onSuccess(PDKResponse response) { _loading = false; myPinsResponse = response; _pinAdapter.setPinList(response.getPinList()); } @Override public void onFailure(PDKException exception) { _loading = false; Log.e(getClass().getName(), exception.getDetailMessage()); } }; _loading = true; fetchPins(); }
Example 2
Source File: HCActivity.java From styT with Apache License 2.0 | 4 votes |
/** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.hc); toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); // 初始化Toolbar控件 setSupportActionBar(toolbar); bn_add = (Button) findViewById(R.id.bn_add); bn_clear = (Button) findViewById(R.id.bn_clear); bn_hc = (Button) findViewById(R.id.bn_hc); list = (GridView) findViewById(R.id.list); bn_add.setOnClickListener(this); bn_clear.setOnClickListener(this); bn_hc.setOnClickListener(this); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(THIS_ACTION); registerReceiver(br, intentFilter); //FileList.curpath = "/mnt/sdcard"; FileList.curpath = Environment.getExternalStorageDirectory().getAbsolutePath(); FileList.broadcastAction = THIS_ACTION; initAdapter(); formatter = new SimpleDateFormat("yyyy-MM-dd HH_mm_ss"); //广告初始化 sp = PreferenceManager.getDefaultSharedPreferences(this); list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu p1, View p2, ContextMenu.ContextMenuInfo p3) { // TODO: Implement this method //p1.setHeaderTitle("选项"); //第二个参数是id p1.add(0, 0, 0, "设置持续时间"); p1.add(0, 1, 0, "移除该图片"); } }); }
Example 3
Source File: HCActivity.java From stynico with MIT License | 4 votes |
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.hc); StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary)); toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); // 初始化Toolbar控件 setSupportActionBar(toolbar); // 用Toolbar取代ActionBar //toolbar.setTitleTextColor(getResources().getColor(R.color.text_font_white));//标题颜色 // toolbar.setSubtitleTextColor(getResources().getColor(R.color.text_font_white));//副标题颜色 // 设置导航按钮监听 //overridePendingTransition(R.anim.out_to_right, R.anim.in_from_left); bn_add = (Button)findViewById(R.id.bn_add); bn_clear = (Button)findViewById(R.id.bn_clear); bn_hc = (Button)findViewById(R.id.bn_hc); list = (GridView)findViewById(R.id.list); bn_add.setOnClickListener(this); bn_clear.setOnClickListener(this); bn_hc.setOnClickListener(this); IntentFilter intentFilter=new IntentFilter(); intentFilter.addAction(THIS_ACTION); registerReceiver(br, intentFilter); //FileList.curpath = "/mnt/sdcard"; FileList.curpath = Environment.getExternalStorageDirectory().getAbsolutePath(); FileList.broadcastAction = THIS_ACTION; initAdapter(); formatter = new SimpleDateFormat("yyyy-MM-dd HH_mm_ss"); //广告初始化 sp = PreferenceManager.getDefaultSharedPreferences(this); list.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){ @Override public void onCreateContextMenu(ContextMenu p1, View p2, ContextMenu.ContextMenuInfo p3) { // TODO: Implement this method //p1.setHeaderTitle("选项"); //第二个参数是id p1.add(0, 0, 0, "设置持续时间"); p1.add(0, 1, 0, "移除该图片"); } }); }