Reputation: 382
I have a new Intent Activity I want to open when a double click is registered, I know the double click is working properly, but every time I try to start the new activity it stops working ? (Force Quits)
code :
imView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
long thisTime = System.currentTimeMillis();
if (thisTime - lastTouchTime < 250) {
// Double click
//Toast toast = Toast.makeText(getApplicationContext(), "Double Tap Worked!", 10);
//toast.show();
lastTouchTime = -1;
Intent myIntent = new Intent(v.getContext(), zoom.class);
startActivityForResult(myIntent, 0);
} else {
// too slow
lastTouchTime = thisTime;
}
}
});
Upvotes: 3
Views: 5929
Reputation: 7609
You may not have put the second activity in the manifiest file
<activity android:name="zoom"
android:label="@string/app_name"/>
Upvotes: 13
Reputation: 50538
Regardless you haven't shared the LogCat, I guess this is what you are looking for.
Intent myIntent = new Intent(YourClass.this, zoom.class);
Everytime you create new intent you send the caller of the new intent context, not the context of the view you are starting the Intent and add the activity to your manifest.
Upvotes: 1