Stuck with @SuppressLint("NewApi") (developer.android.com/training/basics/firstapp/starting-activity)
android
Solution
Your build target is NOT set to API Level 14 or higher. This is not a bug, please close this issue.
(In eclipse: Project => Properties => Android)
Problem
I'm a begginer with Android and currently stuck with the lession: http://developer.android.com/training/basics/firstapp/starting-activity.html In the part Create the Second Activity, when I try to use the code: ``` public class DisplayMessageActivity extends Activity { @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); // Make sure we're running on Honeycomb or higher to use ActionBar APIs if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // Show the Up button in the action bar. getActionBar().setDisplayHomeAsUpEnabled(true); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } ``` I get the error below: @SuppressLint("NewApi") -> The attribute value is undefined for the annotation type SuppressLint. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) -> HONEYCOMB cannot be resolved or is not a field. getActionBar().setDisplayHomeAsUpEnabled(true); -> The method getActionBar() is undefined for the type DisplayMessageActivity. NavUtils.navigateUpFromSameTask(this); -> NavUtils cannot be resolved Someone let me know how to solve? Here is what I imported: ``` import android.app.Activity; import android.os.Build; import android.os.Bundle; import android.view.MenuItem; ``` Many thanks!