M1cKeY
M1cKeY

Reputation: 11

Android Studio cannot find class DisplayMessageActivity

I'm learning android development on https://developer.android.google.cn/training/basics/firstapp/starting-activity#BuildIntent

I try to start an activity and write Intent intent=new Intent(this,DisplayMessageActivity.class);

but the IDE tells that cannot resolve symbol DisplayMessageActivity

So I compare my packages with the example code on the link above, and in the example code it has a package android.support.v7.app.AppCompatActivity, while I only have android.suport.v4.balabala

What can I do?

Upvotes: 1

Views: 217

Answers (1)

Lenin
Lenin

Reputation: 2111

Possible duplicate: DisplayMessageActivity cannot be resolved to a type-Building first android App

The thing is you have to create the activity before starting it, it is not default. The way to create it is some lines below. Check it here: https://developer.android.google.cn/training/basics/firstapp/starting-activity#CreateActivity

Upvotes: 1

Related Questions