sketchub icon

OnClick using XML (inject) and one asd

Paren
10 Likes
3 Comments
91 Downloads

What's new

Check Deception >>>>

Screenshots

About

Create more block and name it Empty or anything

Add one ASD block and paste this code } //This to close the Empty Method //You can create multiple methods within this more block method

public void YourMethod(View view) { // This method will be triggered when the button is clicked intent.setClass(getApplicationContext(), ActivityActivity.class); startActivity(intent);SketchwareUtil.showMessage(getApplicationContext(), "Button Clicked");

}

public void AnotherMethod(View view) {

    // This method will be triggered when the button is clicked
    intent.setClass(getApplicationContext(), Activity2Activity.class);
    startActivity(intent);
    SketchwareUtil.showMessage(getApplicationContext(), "Drawer Button Clicked");

}

//This to close the Empty tag "}" {

Now place this in widget inject (e.g. textview)

android:clickable="true" android:onClick="YourMethod" <!-- Code by Paren -->

You can use this to trigger OnClick events in Drawer widgets and (perhaps Dialogs) no need to call them in on Create Event If you need any help this is my telegram t.me/paren7

©2025 Sketchub | User Policy