@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); UMemo.DatabaseOneView(this, info.position); UMemo.DatabaseDelete(this, UMemo.string_id); UMemo.ListUpdate(memo, this, memoAdapter); UMemo.snackBar(view, "삭제되었습니다."); return super.onContextItemSelected(item); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); UMemo = new UMemo(); mContext = MainActivity.this; activity = MainActivity.this; // Toolbar S tb = (Toolbar) findViewById(R.id.toobars); setSupportActionBar(tb); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Toolbar F & DrawerLayout S drawer = (DrawerLayout) findViewById(R.id.drawerlayout); actiondt = new ActionBarDrawerToggle(this, drawer, R.string.app_name, R.string.app_name); drawer.setDrawerListener(actiondt); // DrawerLayout F & NavigationView S navi = (NavigationView) findViewById(R.id.navigation_view); navi.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.side1: Toast.makeText(MainActivity.this, "M", Toast.LENGTH_SHORT).show(); break; } return true; } }); // NavigationView F memoHelper = new MemoHelper(this); // Database S & F & ListView S list_memo = (ListView) findViewById(R.id.list_memo); memo = new ArrayList<memo>(); memoAdapter = new MemoAdapter(this, memo); UMemo.DatabaseAllView(this, memoAdapter); list_memo.setAdapter(memoAdapter); registerForContextMenu(list_memo); // ListView F floating = (FloatingActionButton) findViewById(R.id.main_floating); }
// ListView F public void Floating(View v) { UMemo.TextClear(); UMemo.startActivity(this, MemoActivity.class, activity); }