I am new to Android Studio. I am working on a ArCore sample project. I want to add a button, when clicked the plane finding mode will be vertical otherwise horizontal. Before voting negative, I have gone through these posts: How can I write “if button clicked” in an If statement in android studio?
Checking if a button has been clicked
The following is the snippet of my code:
if(y > 0){
Config config = new Config(session);
//config.setPlaneFindingMode(Config.PlaneFindingMode.VERTICAL); If button clicked, this
config.setPlaneFindingMode(Config.PlaneFindingMode.HORIZONTAL); //otherwise this
session.configure(config);
Globals.notRecording = true;
}
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
}
});
Just use this code in OnClickListener
. when you tap button call this
config.setPlaneFindingMode(Config.PlaneFindingMode.VERTICAL);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.