Last active
November 28, 2023 22:41
-
-
Save ziadasem/8a2796afbcf682d41f86acddf6a08d78 to your computer and use it in GitHub Desktop.
Basic AppCompatActivity class with two buttons and TextInputLayout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JavaActivity extends AppCompatActivity { | |
Button flutterJavaNavigationButton; | |
Button kotlinSendingButton ; | |
TextInputLayout textInputLayout ; | |
TextView resultTV ; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Intent intent = new Intent(this, KotlinActivity.class); | |
String value = intent.getStringExtra("value"); | |
flutterJavaNavigationButton = findViewById(R.id.flutterJavaNavigationButton); | |
kotlinSendingButton = findViewById(R.id.kotlinSendingButton); | |
textInputLayout = findViewById(R.id.inputField); | |
resultTV = findViewById(R.id.resultTV); | |
resultTV.setText(value == null? "" : value); | |
kotlinSendingButton.setOnClickListener(view -> navigateToKotlin()); | |
} | |
void navigateToKotlin(){ | |
Intent intent = new Intent(this, KotlinActivity.class); | |
// | |
intent.putExtra("value", textInputLayout.getEditText().getText().toString() ); | |
startActivity(intent); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment