OnClickListener in Android Studio

前端 未结 5 1983
栀梦
栀梦 2020-12-09 10:46

I\'m attempting to develop and app using the new Android Studio, but I keep receiving major errors on my OnClickListeners. Mainly it is telling me that it cannot resolve sym

5条回答
  •  眼角桃花
    2020-12-09 11:42

    @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
    
     @Override
        public boolean onOptionsItemSelected(MenuItem item) {
             int id = item.getItemId();
             if (id == R.id.standingsButton) {
                startActivity(new Intent(MainActivity.this,StandingsActivity.class));
                return true;
            }
            return super.onOptionsItemSelected(item);
        }
    

提交回复
热议问题