reload Fragment - Android User Interface

Android examples for User Interface:Fragment

Description

reload Fragment

Demo Code


//package com.java2s;

import android.app.Fragment;

import android.app.FragmentTransaction;

public class Main {
    private static void reloadFragment(Fragment fragment, int id,
            String tag, Fragment fr, FragmentTransaction ft) {
        if (fr.isVisible()) {
            ft.remove(fr);//from  w  w w .  j  ava 2  s.co  m
            ft.add(id, fragment, tag);
        } else {
            ft.show(fr);
        }
    }
}

Related Tutorials