Issue
I am sure there is something obvious but have not been able to find a solution to this simple problem. The error is in a main activity attempting to start another activity when a user guesses the correct answer:
Error:(85, 23) Unresolved reference: Intent
The code is from the High/Low Android app in the book 'Kotlin Development for Android'.
val intent = Intent("com.example.user.highlow2.CorrectGuessActivity")
startActivity(intent)
The manifest has the following intent-filter for the called activity:
<intent-filter>
<action android:name="com.example.user.highlow2.CorrectGuessActivity"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
Solution
The original syntax and suggestions all yielded the same error. The MainActivity needs the following for the Intent to be recognized: import android.content.Intent
Answered By - tomN
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.