Android Navigation Drawer unable to setText in a Fragment from MainActivity -
i trying set gps coordinates on textview of fragment mainactivity can not figure out how this.
i have:
mainactivity.java locationfragment.java i want update textview in locationfragment mainactivity's onlocationchanged() method.
is chance :
public void onlocationchanged(location location) { lat = (double) (location.getlatitude()); lng = (double) (location.getlongitude()); fragment.updatetext(lat +" "+lng); }
you can utilize interface main objective of fragment re-usability maintained. can implement communication between activity-fragment or fragment-fragment via using next :
android android-activity android-fragments fragment drawer
No comments:
Post a Comment