Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------
- Komunikator java
- ---------------------------------------
- public interface Communicator {
- public void respond(String data);
- public void postaviTekst(String tekst);
- }
- ---------------------------------------
- u main activity dodati metode koje su napisaen u komunikatoru
- ------------------------------------------------------------------------------
- @Override
- public void respond(String data) {
- }
- ---------------------------------------
- @Override
- public void postaviTekst(String tekst) {
- Toast.makeText(this, "main respond: " + tekst,
- Toast.LENGTH_LONG).show();
- FragmentA a = (FragmentA) manager.findFragmentByTag("A");
- if (a!=null){
- a.promjeniText(tekst);
- }
- }
- ------------------------------------------------------------------------------
- kako pozvati metodu iz fragmenta
- i onda u metodi radis sta hoces npr uzmes fragment novi i a.metodaUFragmentu(tekst);
- ------------------------------------------------------------------------------
- comm.postaviTekst("test tekst");
- ------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement