I tried opening new Activity in setup of Sketch.java using startActivity(intent) but on second activity I noticed back button not working ie not leading to first activity… Is this a issue in core library? I am using processing for android through android studio
@pallav12 ===
can you put some code snippet?
when are you creating the second activity?
when you hit the back button what is happening?- Do you stay in the 2° activity?
Maybe this helps you
@Override
public void onBackPressed() {
Intent gBack = new Intent(getActivity(),MainActivity.class);
startActivity(gBack);
}
public class Sketch extends PApplet {
PImage leaf;
public void settings() {
fullScreen();
}
public void setup() {
leaf = loadImage("leaf.png");
imageMode(CENTER);
Intent intent=new Intent(getActivity(), Main2Activity.class);
startActivity(intent);
}
public void draw() {
background(9);
image(leaf, mouseX, mouseY);
Button button=new Button(getContext());
}
}
this is how i opened new activity
Now back press isn’t doing anything
but when I changed PApplet code
synchronized public void onBackPressed() {
requestedBackPress = true;
}
to
synchronized public void onBackPressed() {
requestedBackPress = true;
handleBackPressed();
}
it worked perfectly as expected.
Is this a bug?