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:org.gateshipone.odyssey.fragments.AlbumTracksFragment.java

/**
 * Called when the fragment is first attached to its context.
 *///from w  w w.java2  s .co m
@Override
public void onAttach(Context context) {
    super.onAttach(context);

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mArtistSelectedCallback = (OnArtistSelectedListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement OnArtistSelectedListener");
    }

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

From source file:ro.expectations.expenses.ui.backup.BackupFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof FloatingActionButtonProvider) {
        mFloatingActionButtonProvider = (FloatingActionButtonProvider) context;
    } else {/*from  w  w w .  j av a2 s .  c  o m*/
        throw new RuntimeException(context.toString() + " must implement FloatingActionButtonProvider");
    }
    try {
        mOnAppBarHeightChangeListener = (OnAppBarHeightChangeListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement OnAppBarHeightChangeListener");
    }
}

From source file:com.adamas.client.android.ui.ConnectorsFragment.java

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

From source file:com.jins_meme.bridge.CameraMenuFragment.java

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

    Log.d("DEBUG", "CAMERA:: onAttach");

    ((MainActivity) getActivity()).setIsCameraMenuFragment(true);

    if (context instanceof RootMenuFragment.OnFragmentInteractionListener) {
        mListener = (OnFragmentInteractionListener) context;
    } else {//from   w  w w  .  jav  a2  s . c  o  m
        throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener");
    }
    mCamera = Camera2BasicFragment.newInstance();
    mCamera.setListener(this);
    FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
    transaction.add(R.id.camera, mCamera).commit();
}

From source file:org.gateshipone.malp.application.fragments.serverfragments.AlbumsFragment.java

/**
 * Called when the fragment is first attached to its context.
 *//* ww w. j ava2 s. c om*/
@Override
public void onAttach(Context context) {
    super.onAttach(context);

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mAlbumSelectCallback = (AlbumSelectedCallback) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement OnArtistSelectedListener");
    }

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mFABCallback = (FABFragmentCallback) context;
    } catch (ClassCastException e) {
        mFABCallback = null;
    }
}

From source file:org.gateshipone.odyssey.fragments.MyMusicFragment.java

/**
 * Called when the fragment is first attached to its context.
 *//*from w  ww.j av a  2 s.  c om*/
@Override
public void onAttach(Context context) {
    super.onAttach(context);

    // 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");
    }
}

From source file:org.gateshipone.malp.application.fragments.serverfragments.FilesFragment.java

/**
 * Called when the fragment is first attached to its context.
 *///from  ww w.  j  a v a 2s.  c  o  m
@Override
public void onAttach(Context context) {
    super.onAttach(context);

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mCallback = (FilesCallback) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement OnArtistSelectedListener");
    }

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mPlaylistCallback = (PlaylistCallback) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement OnArtistSelectedListener");
    }

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mFABCallback = (FABFragmentCallback) context;
    } catch (ClassCastException e) {
        mFABCallback = null;
    }
}

From source file:org.gateshipone.odyssey.fragments.OdysseyFragment.java

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

    if (null == mComponentCallback) {
        mComponentCallback = new OdysseyComponentCallback();
    }/*w  w  w. ja  va  2s .com*/

    // 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");
    }
}

From source file:org.gateshipone.odyssey.fragments.FilesFragment.java

/**
 * Called when the fragment is first attached to its context.
 *//*from  www .j a va  2s  . c o m*/
@Override
public void onAttach(Context context) {
    super.onAttach(context);

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mOnDirectorySelectedCallback = (OnDirectorySelectedListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement OnDirectorySelectedListener");
    }
}

From source file:com.c4fcm.actionpath.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set the pattern for the latitude and longitude format
    String latLngPattern = getString(R.string.lat_lng_pattern);

    // Set the format for latitude and longitude
    mLatLngFormat = new DecimalFormat(latLngPattern);

    // Localize the format
    mLatLngFormat.applyLocalizedPattern(mLatLngFormat.toLocalizedPattern());

    // Set the pattern for the radius format
    String radiusPattern = getString(R.string.radius_pattern);

    // Set the format for the radius
    mRadiusFormat = new DecimalFormat(radiusPattern);

    // Localize the pattern
    mRadiusFormat.applyLocalizedPattern(mRadiusFormat.toLocalizedPattern());

    // Create a new broadcast receiver to receive updates from the listeners and service
    mBroadcastReceiver = new GeofenceSampleReceiver();

    // Create a new broadcast receiver to receive updates from SynchronizeDataService
    mSyncDataReceiver = new SynchronizeDataReceiver();

    // Create an intent filter for the broadcast receiver
    mIntentFilter = new IntentFilter();

    // Action for broadcast Intents that report successful addition of geofences
    mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCES_ADDED);

    // Action for broadcast Intents that report successful removal of geofences
    mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCES_REMOVED);

    // Action for broadcast Intents containing various types of geofencing errors
    mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCE_ERROR);

    // All Location Services sample apps use this category
    mIntentFilter.addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES);

    mSyncIntentFilter = new IntentFilter();
    mSyncIntentFilter.addAction(GeofenceUtils.UPDATE_GEOFENCES);

    // Instantiate a new geofence storage area
    Context ctx = this.getApplicationContext();
    Log.i("MainActivityContext", ctx.toString());
    mPrefs = new SurveyGeofenceStore(ctx);

    // Instantiate the current List of geofences
    mCurrentGeofences = new ArrayList<Geofence>();

    // Instantiate a Geofence requester
    mGeofenceRequester = new GeofenceRequester(this);

    // Instantiate a Geofence remover
    mGeofenceRemover = new GeofenceRemover(this);

    //instantiate list of geofences
    mUIGeofences = new ArrayList<SurveyGeofence>();

    //  addGeoFences();

    //disallow the title bar from appearing
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    //Remove notification bar
    //this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // Attach to the main UI
    setContentView(R.layout.activity_main);

    Log.i("MainActivity.OnCreate", "synchronizeDataService");
    synchronizeDataService();//from w  ww . j  a v  a2 s.  c o  m

}