I am doing the android development with travis thenewboston on youtube. I'm getting an error in some lines with R. It was all working fine until i added my R.id.Exit and did a project clean then all went haywire. None of my xml files are throwing any warnings or errors. I have triple checked my spelling and i just think i need another set of eyes to help me out. Thank you in advance.
package com.apphouse.enterprises;
import android.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class Menu extends ListActivity {
String classes[] = { "StartingPoint", "TextPlay", "Email", "Camera",
"Data", "Example5", "Example6", "Example7" };
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(Menu.this,
android.R.layout.simple_list_item_1, classes));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
String cheese = classes[position];
try {
Class ourClass = Class
.forName("com.apphouse.enterprises." + cheese);
Intent ourIntent = new Intent(Menu.this, ourClass);
startActivity(ourIntent);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
@Override
public boolean onCreateOptionsMenu(android.view.Menu menu) {
// TODO Auto-generated method stub
super.onCreateOptionsMenu(menu);
MenuInflater blowUp = getMenuInflater();
blowUp.inflate(R.menu.cool_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch (item.getItemId()) {
case R.id.aboutUs:
Intent i = new Intent("com.apphouse.enterprises.ABOUT");
startActivity(i);
break;
case R.id.Preferences:
Intent p = new Intent("com.apphouse.enterprises.PREFS");
startActivivty(p);
break;
case R.id.Exit:
finish();
break;
}
return false;
}
private void startActivivty(Intent p) {
// TODO Auto-generated method stub
}
}
I have tried a project clean and also tried deleting the import android.R; Not sure how that got there, but ya. Please any help would be awesome. My errors are being set on the ones with R.menu.cool_menu, and every R. below that.
This is xml, It is under my menu folder.
<item
android:title="Preferences"
android:id="@+id/Preferences"
android:nuemericShortcut="1"
android:alphabeticShortcut="a">
</item>
<item
android:title="Exit"
android:id="@+id/Exit">
</item>