Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TestActivity implement GetTextCallback {
- public interface GetTextCallback {
- String getText()
- }
- @Override
- public String getText() {
- return editText.getText().toString();
- }
- }
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- if (getTextCallback == null) {
- getTextCallback = (GetTextCallback) activity;
- }
- }
- public void whenYouWantToGetText() {
- if (getTextCallback != null) {
- getTextCallback.getTextYouWant();
- }
- }
Add Comment
Please, Sign In to add comment