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

Hướng dẫn cài đặt NAS Buffalo

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

Cách thêm file .sqlite hay .db vào project android trong android studio.