Boa tarde amigos,
Como estou começando no ramo de desenvolvimento de App, gostaria de entender um pouco sobre o ANDROID Studio.
Adicionei um ToggleButton via código em um layout, porém o mesmo não consegue ser referenciado no código java.
LAYOUT:
<ToggleButton
android:id="@+id/btnSoundToggle"
android:background="@drawable/soundtoggle"
android:layout_width="32dp"
android:layout_height="32dp"
android:textOn=""
android:textOff=""
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_alignParentRight="true"
android:layout_marginRight="35dp"
android:layout_marginTop="15dp"/>
CÓDIGO:
ToggleButton toggle = (ToggleButton) findViewById(R.id.btnSoundToggle);
toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// The toggle is enabled
} else {
// The toggle is disabled
}
}
});
ERRO:
Gradle:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':App1:compileDebug'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Alguém poderia me ajudar ?
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.






0 comentários:
Postar um comentário