Example usage for android.support.v4.app Fragment getClass

List of usage examples for android.support.v4.app Fragment getClass

Introduction

In this page you can find the example usage for android.support.v4.app Fragment getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.simplaapliko.trips.presentation.activity.BaseActivity.java

protected void addFragment(int containerViewId, Fragment fragment) {
    getSupportFragmentManager().beginTransaction()
            .add(containerViewId, fragment, fragment.getClass().getSimpleName()).commit();
}

From source file:org.ciasaboark.tacere.activity.MainActivity.java

private void loadFragment(@NonNull Fragment fragment) {
    if (lastFragment != null && fragment.getClass().equals(lastFragment.getClass())) {
        Log.w(TAG, "will not load new fragment " + fragment.getClass() + " existing fragment is of same type");
    } else {/*from  ww  w.j a  va 2  s  .  c  om*/
        getSupportFragmentManager().beginTransaction().replace(R.id.main_fragment, fragment).commit();
    }
}

From source file:com.dena.app.bootloadhid.MainActivity.java

public void pushFragment(Fragment fragment) {
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.container, fragment, fragment.getClass().getName())
            .addToBackStack(fragment.getClass().getName()).commit();
}

From source file:com.simplaapliko.trips.presentation.activity.BaseActivity.java

protected void addFragmentToBackStack(int containerViewId, Fragment fragment) {
    getSupportFragmentManager().beginTransaction()
            .replace(containerViewId, fragment, fragment.getClass().getSimpleName())
            .addToBackStack(fragment.getClass().getSimpleName()).commit();
}

From source file:com.dalaran.annotation.FieldMerge.java

public boolean merge(Fragment fragment, View view) {
    Field[] declaredFields = fragment.getClass().getDeclaredFields();
    boolean valid = false;
    for (Field field : declaredFields) {
        Annotation[] annotations = field.getAnnotations();
        for (Annotation annotation : annotations) {
            if (annotation.annotationType().equals(ViewById.class)) {
                boolean b = checkToMerge(fragment, field, (ViewById) annotation, view);
                if (b) {
                    valid = b;//from   w ww .  ja v  a  2 s  . c o m
                }
            }
        }
    }
    return valid;
}

From source file:ch.swissonid.navigator.Navigator.java

/**
 * This is just a helper method which returns the simple name of
 * the fragment.//w w  w  . java  2s. co m
 * @param fragment That get added to the history (BackStack)
 * @return The simple name of the given fragment
 */
protected String getTag(final Fragment fragment) {
    return fragment.getClass().getSimpleName();
}

From source file:com.jetradar.multibackstack.sample.MainActivity.java

private boolean isRootTabFragment(@NonNull Fragment fragment, int tabId) {
    return fragment.getClass() == rootTabFragment(tabId).getClass();
}

From source file:com.example.app.view.activity.BaseActivity.java

/**
 * Adds a {@link Fragment} to this activity's layout.
 *
 * @param containerViewId The container view to where add the fragment.
 * @param fragment The fragment to be added.
 *//*from   w  w w  .  j  a  va2 s .  com*/
protected void addFragment(int containerViewId, Fragment fragment) {
    FragmentTransaction fragmentTransaction = this.getSupportFragmentManager().beginTransaction();
    fragmentTransaction.add(containerViewId, fragment, fragment.getClass().getName());
    fragmentTransaction.commit();
}

From source file:org.kei.android.phone.netcap.MainPagerActivity.java

@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    // Check which request we're responding to
    if (requestCode == FileChooserActivity.FILECHOOSER_SELECTION_TYPE_FILE) {
        if (resultCode == RESULT_OK) {
            final String msg = data.getStringExtra(FileChooserActivity.FILECHOOSER_USER_MESSAGE);
            for (Fragment f : fragments) {
                if (f.getClass().getSimpleName().equals(msg) && InputFragment.class.isInstance(f)) {
                    final String file = data.getStringExtra(FileChooserActivity.FILECHOOSER_SELECTION_KEY);
                    ((InputFragment) f).validateAndOpen(file);
                    break;
                } else if (f.getClass().getSimpleName().equals(msg) && OutputFragment.class.isInstance(f)) {
                    final String file = data.getStringExtra(FileChooserActivity.FILECHOOSER_SELECTION_KEY);
                    ((OutputFragment) f).setFile(file);
                    break;
                }//w  ww.j av  a2  s .c o  m
            }
        }
    }
}

From source file:org.jraf.android.bikey.common.widget.fragmentcycler.FragmentCycler.java

private String getTag(Fragment fragment) {
    return getTag(fragment.getClass());
}