hey and thanks for watching 🤗. In this tutorial I took time to explain and code hope I didn't bore u😏? adding fragments to linear layout is a one line code while back press in fragments is 5 (one more block) , but I took 4mins to explain rather than just coding in 30 secs . please support my effort by subscribing to this channel and share this video 🙏🙏🙏.
Add Onback pressed listener to Fragments and add fragments to linear Layout in sketchware pro
video : • Add Fragments to Linear Layout , Onback pr...
apk signer : https://play.google.com/store/apps/de...
developer tools: https://play.google.com/store/apps/de...
telegram: t.me/deftclicksapp
t.me/sketchlycommunity
Join me on Facebook 😊❤️. / 1620751488112944
WhatsApp:
https://chat.whatsapp.com/Ge7SUTPcBXk...
codes :
ADD FRAGMENTS TO LINEARLAYOUT
getSupportFragmentManager().beginTransaction(). replace(R.id.parent,new FragFragmentActivity()).commit();
ADD ONBACKPRESSED LISTENER IN FRAGMENTS
//add to fragments oncreate()
OnBackPressedCallback callback = new OnBackPressedCallback(true /* enabled by default */) {
@Override
public void handleOnBackPressed() {
// Handle the back button event / action here
linear1.setBackgroundColor(0xFF2196F3);
}
};
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
IMPORT IN FRAGMENTS
androidx.activity.OnBackPressedCallback
#android
#java
#sketchware
#youtube
#fragments
#backtobasics