Java Code Examples for android.content.Context#toString()

The following examples show how to use android.content.Context#toString() . 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: OdysseyBaseFragment.java    From odyssey with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onAttach(@NonNull Context context) {
    super.onAttach(context);

    if (null == mComponentCallback) {
        mComponentCallback = new OdysseyComponentCallback();
    }

    // Register the memory trim callback with the system.
    context.registerComponentCallbacks(mComponentCallback);

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mToolbarAndFABCallback = (ToolbarAndFABCallback) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement ToolbarAndFABCallback");
    }
}
 
Example 2
Source File: MonthlyReportFragment.java    From privacy-friendly-pedometer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnFragmentInteractionListener) {
        mListener = (OnFragmentInteractionListener) context;
    } else {
        throw new RuntimeException(context.toString()
                + " must implement OnFragmentInteractionListener");
    }
    if(day == null){
        day = Calendar.getInstance();
    }
    if(!day.getTimeZone().equals(TimeZone.getDefault())) {
        day = Calendar.getInstance();
        generateReports(true);
    }
    // Bind to stepDetector if today is shown
    if (isTodayShown() && StepDetectionServiceHelper.isStepDetectionEnabled(getContext())) {
        bindService();
    }
    registerReceivers();
}
 
Example 3
Source File: TableOfContentFragment.java    From IslamicLibraryAndroid with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnTableOfContentTitleClickListener) {
        mListener = (OnTableOfContentTitleClickListener) context;
    } else {
        throw new RuntimeException(context.toString()
                + " must implement OnTableOfContentTitleClickListener");
    }
}
 
Example 4
Source File: BeaconFragment.java    From beaconloc with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);

    try {
        mBeaconSelectedListener = (OnTrackedBeaconSelectedListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString()
                + " must implement OnTrackedBeaconSelectedListener");
    }
}
 
Example 5
Source File: FragmentLayer2.java    From AndroidPlayground with MIT License 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnFragmentInteractionListener) {
        mListener = (OnFragmentInteractionListener) context;
    } else {
        throw new RuntimeException(
                context.toString() + " must implement OnFragmentInteractionListener");
    }
}
 
Example 6
Source File: ConnectFragment.java    From io16experiment-master with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (!(context instanceof Callbacks)) {
        throw new ClassCastException(context.toString() + " must implement " + ConnectFragment.class.getSimpleName());
    }

    mCallbacks = (Callbacks) context;
}
 
Example 7
Source File: ForgotPasswordFragment.java    From mvvm-starter with MIT License 5 votes vote down vote up
@Override
public void onAttach (Context context)
{
    super.onAttach(context);
    if (context instanceof OnForgotFragmentInteractionListener)
    {
        mListener = (OnForgotFragmentInteractionListener) context;
    }
    else
    {
        throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener");
    }
}
 
Example 8
Source File: DfuProgressFragmentDialog.java    From Bluefruit_LE_Connect_Android_V2 with MIT License 5 votes vote down vote up
@Override
public void onAttach(@NonNull Context context) {
    super.onAttach(context);
    if (context instanceof Listener) {
        mListener = (Listener) context;
    } /*else if (getTargetFragment() instanceof Listener) {
        mListener = (Listener) getTargetFragment();
    } else if (getTargetFragment() != null && getTargetFragment().getActivity() instanceof Listener) {
        mListener = (Listener) getTargetFragment().getActivity();
    } */ else {
        throw new RuntimeException(context.toString() + " must implement Listener");
    }
}
 
Example 9
Source File: BaseFragment.java    From argus-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof ResultListener) {
        resultListener = (ResultListener) context;
    } else {
        throw new RuntimeException(context.toString() + " must implement ResultListener");
    }
}
 
Example 10
Source File: FragmentNews.java    From Pas with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof MainActivity) {
        mListener = (MainActivityInterface) context;
    } else {
        throw new RuntimeException(context.toString()
                + " must implement MainAFInterface");
    }
}
 
Example 11
Source File: OptionMapFragment.java    From MapForTour with MIT License 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);

    try {
        mListener = (OptionFragmentOnclickListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + "must implement OptionFragmentOnclickListener");
    }

}
 
Example 12
Source File: LogFragment.java    From OpenLibre with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    try {
        mCallback = (OnScanDataListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString()
                + " must implement OnScanDataListener");
    }
}
 
Example 13
Source File: FeedListFragment.java    From GitJourney with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnFragmentInteractionListener) {
        mListener = (OnFragmentInteractionListener) context;
    } else {
        throw new RuntimeException(context.toString()
                + " must implement OnFragmentInteractionListener");
    }
}
 
Example 14
Source File: RecyclerDataFragment.java    From AndroidDigIn with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnRecyclerFragmentInteractionListener) {
        mListener = (OnRecyclerFragmentInteractionListener) context;
    } else {
        throw new RuntimeException(context.toString()
                + " must implement OnRecyclerFragmentInteractionListener");
    }
}
 
Example 15
Source File: BehaviorSubFragment.java    From PercentageChartView with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnBehaviorChangedListener) {
        mListener = (OnBehaviorChangedListener) context;
    } else {
        throw new RuntimeException(context.toString()
                + " must implement OnBehaviorChangedListener");
    }
}
 
Example 16
Source File: ConfirmBookDeleteDialogFragment.java    From IslamicLibraryAndroid with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onAttach(@NonNull Context context) {
    super.onAttach(context);
    try {
        mListener = (BookDeleteDialogListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString()
                + " must implement BookDeleteDialogListener");
    }
}
 
Example 17
Source File: ProviderSetupFailedDialog.java    From bitmask_android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    try {
        interfaceWithConfigurationWizard = (DownloadFailedDialogInterface) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString()
                + " must implement NoticeDialogListener");
    }
}
 
Example 18
Source File: TouchableWrapper.java    From Airbnb-Android-Google-Map-View with MIT License 5 votes vote down vote up
public TouchableWrapper(Context context) {
    super(context);
    // Force the host activity to implement the UpdateMapAfterUserInterection Interface
    try {
        updateMapAfterUserInterection = (SearchPlaceOnMapActivity) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement UpdateMapAfterUserInterection");
    }
}
 
Example 19
Source File: ReceiveFragment.java    From xmrwallet with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof Listener) {
        this.listenerCallback = (Listener) context;
    } else {
        throw new ClassCastException(context.toString()
                + " must implement Listener");
    }
    if (context instanceof GenerateReviewFragment.ProgressListener) {
        this.progressCallback = (GenerateReviewFragment.ProgressListener) context;
    }
}
 
Example 20
Source File: BlankFragment.java    From Pas with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnFragmentInteractionListener) {
        mListener = (OnFragmentInteractionListener) context;
    } else {
        throw new RuntimeException(context.toString()
                + " must implement OnFragmentInteractionListener");
    }
}