Unable to find Intent character class

I am new to Android development and Java and XML coding.

but I followed this lesson:

http://www.steventrigg.com/activities-and-the-action-bar-create-an-alarm-clock-in-android-tutorial-part-1/#comment-296

then I had this error when using Intent. The word "Intent" turned red when switching, and the error "cannot find the Intent character class" occurred

Can someone explain to me what is happening and how to solve it?

This is the last part of my code in AlarmListActivity.java

@Override

public boolean onOptionsItemSelected(MenuItem item) {

   int id = item.getItemId();
   if (id == R.id.action_settings) {
       return true;
   }

   switch (item.getItemId()) {
       case R.id.action_add_new_alarm: {
           Intent intent = new Intent(this,
                   AlarmDetailsActivity.class);

            startActivity(intent);
            break;
        }
    }
    return super.onOptionsItemSelected(item);
}
+10
source share
2 answers

AlarmListActivity , :

import android.content.Intent;

- , java.lang, . , Android Intent - , Android, /. Intent, , Intent.

new Intent(), , , java.lang, , ., - .

, , , , , , , , .

+24

, , , Android Studio . , Android- - . , Android , .

, ,

, , , , , APP com.example.testingaravind, , , , , .. , , Android Studio, , ,

    public class BootstrapActivity extends ActionBarActivity {

        private static final String TAG = "BootstrapActivity";

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_bootstrap);
        }

        public void startServiceOnClickHandler(View view) {

            Intent intent = new Intent(BootstrapActivity.this , AnalyzerService.class);
            startService(intent);
        }
}

startServiceOnClickHandler : " Intent". google ,

, , ,

   android:name=".activities.BootstrapActivity"

   android:name=".BootstrapActivity"

- Android , BootstrapActivity,

, , Android. Android Studio , .

, , .

+3

All Articles