I already asked a similar question, but now the situation is a bit different: you need to throw an activity in the collision with a message that you lost. Did:

Context context = getContext(); Intent intent = new Intent(context, FiledActivity.class); context.startActivity(intent); 

But it is no reaction. Maybe there is some other way, because I understand that this option is for a click?

UPD: Fully all function:

 private void testCollision() { /*Движение с лево на право по Х*/ Iterator<SpriteListX> i = rx.iterator(); while(i.hasNext()) { SpriteListX sp = i.next(); if ((Math.abs(sp.x - px) <= (sp.width + p.width) / 2f) && (Math.abs(sp.y - py) <= (sp.height + p.height) / 2f)) { i.remove(); this.running = false; Context context = getContext(); Intent intent = new Intent(context, FiledActivity.class); //а не new Intent(this, MyActivity.class) context.startActivity(intent); } } } 
  • Come on folks, no one knows? - dajver
  • one
    show better the code-condition of the transition to your message, otherwise it’s just a call that should work - Gorets
  • one
    It’s difficult to say something about this method, I would advise you to go and monitor everything in the debager, see if ((Math.abs (sp.x - px) <= (sp.width + p.width) / 2f ) && (Math.abs (sp.y - py) <= (sp.height + p.height) / 2f)) { - Gorets
  • collisions all work perfectly well, and lie the transition does not plow. - dajver
  • one
    the error takes off?))) - Gorets

1 answer 1

 <activity android:name=".FiledActivity"/> 
  • and now the error takes off! - dajver
  • one
    then I was right and you did not register the activation in the manifesto? - Gorets
  • I didn’t register, but at least a mistake appeared)) Thank you - dajver
  • one
    now even it became interesting to me what the error could be there =) usually if not registered - the error crashes, if registered, in this case, everything should work ... in short, if you figure it out - write down what it was, if not you will understand - write too) - Gorets
  • Such a simple decision did not allow me to continue writing for a whole week, drinking, and this is already some kind of insanity ... Thanks buddy! - dajver