Interface from one fragment to another android -
Interface from one fragment to another android -
i facing problem implementing interface defined in 1 fragment , using another. know need through activity have added fragments dynamically within fragment. please @ snapshot understand more problem. . have fragment called activity fragment within load fragments dynamically. comments textview clickable , when clicked commentdialogfragment shown. dialog fragment shared fragments. code when comment clicked:
fragmenttransaction ft = getactivity() .getsupportfragmentmanager().begintransaction(); commentdialog fragment = commentdialog.newinstance(id, "activity"); ft.addtobackstack(null); fragment.show(ft, null);
i want increment comment count. made interface:
public interface incrementcomment { public void increasecommentcount(boolean increase); }
i unable utilize interface in fragment within activity fragment. interface detected on activity holds these fragments. heres interface in mainactivity class info upto point:
@override public void increasecommentcount(boolean increase) { // todo auto-generated method stub log.d("interface main activity", "called");//this called }
now unable pass info activity code fragment because fragments loaded dynamically , there can number of fragments(user can see old post). tried create fragment implement interface update value of textview. couldnot working never called. can point me in right direction. tried of links in this , other sources this none of them fit requirement.
android android-fragments interface
Comments
Post a Comment