Java Code Examples for androidx.fragment.app.FragmentActivity#findViewById()

The following examples show how to use androidx.fragment.app.FragmentActivity#findViewById() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScannerFragment.java    From Bluefruit_LE_Connect_Android_V2 with MIT License 5 votes vote down vote up
private void showConnectionStateError(String message) {
    removeConnectionStateDialog();

    FragmentActivity activity = getActivity();
    if (activity != null) {
        View view = activity.findViewById(android.R.id.content);
        Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_LONG);
        StyledSnackBar.styleSnackBar(snackbar, activity);
        snackbar.show();
    }
}
 
Example 2
Source File: Ui.java    From particle-android with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public static <T extends View> T findView(FragmentActivity activity, int id) {
    return (T) activity.findViewById(id);
}