作者:暧gx祢生 | 来源:互联网 | 2023-07-30 10:28
ImlearningAndroidDevelopmentforBeginnersfromUdacityandhavecompletedmakinganappnamedC
I'm learning Android Development for Beginners from Udacity and have completed making an app named Court Counter in which I wrote code for an XML (activity_main.xml) and some code for Java (MainActivity.java) file as some of the code was provided by the Udacity team on Github.
我正在学习Udacity的初学者Android开发,并完成了一个名为Court Counter的应用程序,我在其中编写了一个XML代码(activity_main.xml)和一些Java(MainActivity.java)文件代码,因为提供了一些代码由Github的Udacity团队负责。
But when I click on 'Build APK' I get two errors both from the Java file:
但是当我点击'Build APK'时,我从Java文件中得到两个错误:
Cannot resolve symbol 'menu' in the following code:-
无法在以下代码中解析符号'menu': -
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
- Cannot resolve symbol 'action_settings':-
无法解析符号'action_settings': -
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
I don't know what happens when these block of code are executed but I want to run the app on my phone! Please help.
我不知道当执行这些代码块时会发生什么,但我想在手机上运行应用程序!请帮忙。
Thanks, Kvaibhav01.
3 个解决方案