Guest User

Untitled

a guest
Nov 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public class TestActivity implement GetTextCallback {
  2. public interface GetTextCallback {
  3. String getText()
  4. }
  5.  
  6. @Override
  7. public String getText() {
  8. return editText.getText().toString();
  9. }
  10. }
  11.  
  12. @Override
  13. public void onAttach(Activity activity) {
  14. super.onAttach(activity);
  15. if (getTextCallback == null) {
  16. getTextCallback = (GetTextCallback) activity;
  17. }
  18. }
  19.  
  20. public void whenYouWantToGetText() {
  21. if (getTextCallback != null) {
  22. getTextCallback.getTextYouWant();
  23. }
  24. }
Add Comment
Please, Sign In to add comment