Reputation: 927
happyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent response = new Intent(this, UserResponse.class);
startActivity(response);
};
});
There's an error in the line (this, UserResponse.class); even after I created a new class called UserResponse.
Upvotes: 2
Views: 41
Reputation: 105
Its because you use .this in an onClicklistener change it to getApplicaton()
Upvotes: 0
Reputation: 454
If you had created the class manually, Check for two things:
UserResponse
class extends Activity
The Activity is included in the Manifest
It should be something like this
<activity
android:name="UserResponse"
android:label="@string/User_Response">
</activity>
Also change the intent as Guilherme P has suggested
Upvotes: 2
Reputation: 18687
Change
Intent response = new Intent(this, UserResponse.class);
To
Intent response = new Intent(MainActivity.this, UserResponse.class);
Replace the MainActivity
by the name of your current activity (current.. not target activity)
Upvotes: 4