Example usage for android.content Context toString

List of usage examples for android.content Context toString

Introduction

In this page you can find the example usage for android.content Context toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:Main.java

public static String getActivityName(Context context) {
    String contextString = context.toString();
    return contextString.substring(contextString.lastIndexOf(".") + 1, contextString.indexOf("@"));
}

From source file:biz.varkon.shelvesom.server.ServerInfo.java

public static Uri.Builder buildFindQuery(String id, String searchIndex, Context context, String responseType,
        String responseGroup) {// www. ja v a2  s. c o  m

    /*
     * GJT: Clicking on an item in the Add*Activity list view sometimes
     * returns multiple results, like with EANs 025195018524 & 0786936786866
     * for DVDs. So if we're coming from an Add screen, override whatever
     * load[Item] says and force-use a search on the ASIN Otherwise, resume
     * as planned, like on imports or barcode lookups, which use
     * EAN/ISBN/UPC
     */
    Pattern pattern = Pattern.compile("Add[A-Za-z]+Activity");
    Matcher matcher = pattern.matcher(context.toString());

    final Uri.Builder uri = buildGetMethod(API_ITEM_LOOKUP, context);
    if (matcher.find() || responseType.equals(RESPONSE_TAG_ASIN)) {
        uri.appendQueryParameter(PARAM_IDTYPE, RESPONSE_TAG_ASIN);
        // GJT: Can't have a SearchIndex AND use ASIN
    } else {
        uri.appendQueryParameter(PARAM_SEARCHINDEX, searchIndex);
        uri.appendQueryParameter(PARAM_IDTYPE, responseType);
    }
    uri.appendQueryParameter(PARAM_RESPONSEGROUP, responseGroup);
    uri.appendQueryParameter(PARAM_ITEMID, id);
    return uri;
}

From source file:ch.berta.fabio.popularmovies.presentation.workerfragments.BaseWorker.java

@SuppressWarnings("unchecked")
@Override/*from   w  w w  . ja va 2  s. c o  m*/
public void onAttach(Context context) {
    super.onAttach(context);

    try {
        mActivity = (T) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement WorkerInteractionListener");
    }
}

From source file:org.odk.collect.android.fragments.dialogs.NumberPickerDialog.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);

    try {/*  w  ww  . j a  v a 2 s.  co m*/
        listener = (NumberPickerListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement OnHeadlineSelectedListener");
    }
}

From source file:org.floppp.observerpattern_activityfragments.views.CustomFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnFragmentInteractionListener) {
        mListener = (OnFragmentInteractionListener) context;
    } else {/*from  w w  w .j a  va2 s  . c  o  m*/
        throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener");
    }
    mAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, mData);
}

From source file:com.willowtreeapps.spurceexampleapp.fragments.ViewFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);

    try {/*from   w  ww .  j av a  2 s  .c  o  m*/
        listener = (OnParentAndChildCreationListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement OnParentAndChildCreationListener");
    }
}

From source file:fr.enst.igr201.kanmogne.iconvert.ConvertTabFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    Log.d(TAG, "onAttach --> " + context.toString());

}

From source file:fi.craplab.plugbuddy.SettingsDialog.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);

    try {//from w w w. j a va  2  s.c om
        mListener = (SettingsSaveListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement SettingsSaveListener");
    }

    mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
}

From source file:cz.maresmar.sfm.view.guide.WelcomeFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof DataValidityListener) {
        mListener = (DataValidityListener) context;
    } else {//  ww w .j a  v  a  2  s .  c  o  m
        throw new RuntimeException(context.toString() + " must implement DataValidityListener");
    }
}

From source file:xyz.jamescarroll.tbfilebrowser.UI.FileBrowseFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof FilesViewAdapter.OnItemSelected) {
        mListener = (FilesViewAdapter.OnItemSelected) context;
    } else {/*  ww  w  .j  a v  a2 s. c o  m*/
        throw new RuntimeException(context.toString() + " must implement OnItemSelected");
    }
}