View unanswered posts | View active topics It is currently 28 Mar 2024, 15:21



Reply to topic  [ 2 posts ] 
 Fragment replacment 
Author Message

Joined: 21 Sep 2012, 10:24
Posts: 10
Post Fragment replacment
Καλημέρα θα ήθελα να κάνω μια ερώτηση αν μπορείτε να με βοηθήσετε. Έχω ενα fragment με 1 action bar item menu. Το κάνω replace και στο επόμενο fragment ο τίτλος του είναι της μορφής Cust... (αντι για Customer Profile) και αντί για 2 items sto action βαρ μου εμφανίζει μόνο 1. Επίσης δεν μου εμφανίζει τίποτα στο content frame άσπρο background. Αν κάνω rotate την συσκευή η κλείσω και ανοίξω την οθόνη τα φορτώνει όλα κανονικά. Με λίγα λόγια αν κάνει refresh το fragment είναι όλα καλά. Σκέφτομαι μήπως έχει κάποιο θέμα με το πρώτο fragment και σκαλώνουν τα menu και οι τίτπλοι.

Έτσι δημιουργώ το ρχικό fragment:

CustomerProfile fragment = new CustomerProfile();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(getResources().getIdentifier("content_frame", "id", getPackageName()), fragment).commit();

Και έτσι κάνω replace το επόμενο fragment που έχω και το πρόβλημα:

CustomerProfileEdit mProfileEdit = new CustomerProfileEdit();
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.content_frame, mProfileEdit);
ft.addToBackStack(null);
ft.commit();
fm.executePendingTransactions();
getFragmentManager().executePendingTransactions();


28 Apr 2014, 13:04
Profile

Joined: 09 Aug 2012, 13:03
Posts: 17
Post Re: Fragment replacment
Καλησπέρα.
Τελικά έλυσες το πρόβλημα; Εκτός του ότι καλείς 2 φορές την executePendingTransactions() δε βλέπω κάτι λάθος στον κώδικα που δείχνεις.


16 May 2014, 20:53
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 46 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.