Which method to override in android fragment to populate a listview -
i have activity holds fragment , fragment hold list view , button, when pressed button directs fragment b.
my question method need override in fragment when pressed button, can re-populate list view inside. or there simple way can make ?
until tried override onresume , onstart, didnt work. btw cant override button pressed in fragment b because in case cant reach ui components in fragment b , getting null pointer normally.
thanks in advance.
your no notice when previous fragment show again. can override onbackpressed() method of fragment's parent activity this:
@override public void onbackpressed() { //1.find fragment tag, tag supplied //when using fragmenttransaction.add(int id, fragment fragment, string tag) //the can find fragment way //fragmenta fragment = getsupportfragmentmanager().findfragmentbytag(name) //2.call method of it! }
Comments
Post a Comment