Fragment

Replace fragment with another fragment

 FragmentManager fm = getSupportFragmentManager();
 FragmentTransaction ft = fm.beginTransaction();
 ft.replace(R.id.content, fragment, TAG);
 ft.addToBackStack(TAG);
 ft.commit();

Passing data between Fragments in the same Activity

Fragment A:

Bundle b = new Bundle();
b.putString("Key", "YourValue");
b.putInt("YourKey", 1);

FragmentB fragB = new FragmentB();
fragB.setArguments(b); 
getFragmentManager().beginTransaction().replace(R.id.your_container, fragB);

Fragment B:

Bundle b = this.getArguments();
if(b != null){
   int i = b.getInt("YourKey");
   String s =b.getString("Key");
}

Nhận xét

Bài đăng phổ biến từ blog này

Phần 2. Hướng dẫn cài đặt Transmission trên NAS Buffalo chạy CPU ARM

Hướng dẫn cài đặt nguồn file để cài addon Kodi