//MainActivity.java file
...
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ...
		// Set the visual state
        JSONObject visualState = null;
        try {
            visualState = new JSONObject("{\"activity\":\"main\"}");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        alanButton.setVisualState(visualState.toString());
		...
    };
}
...

//MainActivity.kt file
...
class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        ...
		// Set the visual state
		var visualState: JSONObject? = null
        try {
            visualState = JSONObject("{\"activity\":\"main\"}")
        } catch (e: JSONException) {
            e.printStackTrace()
        }
        alan_button.setVisualState(visualState.toString())
	}
}
...