Java Code Examples for android.os.Bundle#toString()

The following examples show how to use android.os.Bundle#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: VLog.java    From container with GNU General Public License v3.0 6 votes vote down vote up
public static String toString(Bundle bundle) {
	if (bundle == null) return null;
	if (Reflect.on(bundle).get("mParcelledData") != null) {
		Set<String> keys = bundle.keySet();
		StringBuilder stringBuilder = new StringBuilder("Bundle[");
		if (keys != null) {
			for (String key : keys) {
				stringBuilder.append(key);
				stringBuilder.append("=");
				stringBuilder.append(bundle.get(key));
				stringBuilder.append(",");
			}
		}
		stringBuilder.append("]");
		return stringBuilder.toString();
	}
	return bundle.toString();
}
 
Example 2
Source File: MainActivity.java    From BeFoot with Apache License 2.0 6 votes vote down vote up
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String argStr = args==null?"null":args.toString();
    log("onCreateLoader id:"+ id+" args:"+argStr);
    return new CursorLoader(MainActivity.this,
            MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
            new String[]{
                    MediaStore.Images.Media._ID,
                    MediaStore.Images.Media.DATA,
                    MediaStore.Images.Media.MINI_THUMB_MAGIC,
                    MediaStore.Images.Media.DATE_MODIFIED,
            },
            null, null,
            MediaStore.Images.Media.DATE_MODIFIED + " DESC"
    );
}
 
Example 3
Source File: KVUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
public static String toString(Bundle b) {
    if (b == null) {
        return "";
    }
    Bundle bundle = new Bundle();
    bundle.putAll(b);
    return bundle.toString();
}
 
Example 4
Source File: SafetyNetUtils.java    From SecuritySample with Apache License 2.0 5 votes vote down vote up
public SafetyNetUtils(Context ctx, Callback callback) {
    this.ctx = ctx;
    this.callback = callback;

    GoogleApiClient.OnConnectionFailedListener googleApiConnectionFailedListener = connectionResult -> Log.e(TAG, "onConnectionFailed:" + connectionResult.toString());
    GoogleApiClient.ConnectionCallbacks googleApiConnectionCallbacks = new GoogleApiClient.ConnectionCallbacks() {
        @Override
        public void onConnected(@Nullable Bundle bundle) {
            String logs = bundle == null ? "" : bundle.toString();
            callback.onResponse("GoogleApiClient onConnected " + logs);
        }

        @Override
        public void onConnectionSuspended(int i) {
            Log.d(TAG, "onConnectionSuspended" + i);
        }
    };


    Handler handler = new Handler(MyApplication.INSTANCE.safetyNetLooper.getLooper());
    googleApiClient = new GoogleApiClient.Builder(ctx)
            .addApi(SafetyNet.API)
            .addConnectionCallbacks(googleApiConnectionCallbacks)
            .addOnConnectionFailedListener(googleApiConnectionFailedListener)
            .setHandler(handler) //Run on a new thread
            .build();
    googleApiClient.connect();
    secureRandom = new SecureRandom();
}
 
Example 5
Source File: RemotePlaybackClient.java    From cwac-mediarouter with Apache License 2.0 5 votes vote down vote up
private static String bundleToString(Bundle bundle) {
    if (bundle != null) {
        bundle.size(); // force bundle to be unparcelled
        return bundle.toString();
    }
    return "null";
}
 
Example 6
Source File: DebugLog.java    From PlayerBase with Apache License 2.0 4 votes vote down vote up
public static void onErrorEventLog(int eventCode, Bundle bundle) {
    if (!PLog.LOG_OPEN)
        return;
    String value;
    switch (eventCode){
        case OnErrorEventListener.ERROR_EVENT_DATA_PROVIDER_ERROR:
            value = "ERROR_EVENT_DATA_PROVIDER_ERROR";
            break;
        case OnErrorEventListener.ERROR_EVENT_COMMON:
            value = "ERROR_EVENT_COMMON";
            break;
        case OnErrorEventListener.ERROR_EVENT_UNKNOWN:
            value = "ERROR_EVENT_UNKNOWN";
            break;
        case OnErrorEventListener.ERROR_EVENT_SERVER_DIED:
            value = "ERROR_EVENT_SERVER_DIED";
            break;
        case OnErrorEventListener.ERROR_EVENT_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
            value = "ERROR_EVENT_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK";
            break;
        case OnErrorEventListener.ERROR_EVENT_IO:
            value = "ERROR_EVENT_IO";
            break;
        case OnErrorEventListener.ERROR_EVENT_MALFORMED:
            value = "ERROR_EVENT_MALFORMED";
            break;
        case OnErrorEventListener.ERROR_EVENT_UNSUPPORTED:
            value = "ERROR_EVENT_UNSUPPORTED";
            break;
        case OnErrorEventListener.ERROR_EVENT_TIMED_OUT:
            value = "ERROR_EVENT_TIMED_OUT";
            break;
        default:
            value = "unKnow code error, maybe user custom errorCode";
            break;
    }
    if(bundle!=null){
        value += "," + bundle.toString();
    }
    PLog.e(EVENT_TAG_ERROR_EVENT, value);
}