Java Code Examples for android.os.Bundle.getByteArray()

The following are Jave code examples for showing how to use getByteArray() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Nird2   File: ReblogFragment.java   View Source Code Vote up 7 votes
@Override
public View onCreateView(LayoutInflater inflater,
		@Nullable ViewGroup container,
		@Nullable Bundle savedInstanceState) {

	Bundle args = getArguments();
	blogId = new GroupId(args.getByteArray(GROUP_ID));
	postId = new MessageId(args.getByteArray(POST_ID));

	View v = inflater.inflate(R.layout.fragment_reblog, container, false);
	ui = new ViewHolder(v);
	ui.post.setTransitionName(postId);
	ui.input.setSendButtonEnabled(false);
	showProgressBar();

	return v;
}
 
Example 2
Project: Nird2   File: ContactSelectorActivity.java   View Source Code Vote up 7 votes
@Override
public void onCreate(@Nullable Bundle bundle) {
	super.onCreate(bundle);

	setContentView(getLayout());

	if (bundle != null) {
		// restore group ID if it was saved
		byte[] groupBytes = bundle.getByteArray(GROUP_ID);
		if (groupBytes != null) groupId = new GroupId(groupBytes);
		// restore selected contacts if a selection was saved
		ArrayList<Integer> intContacts =
				bundle.getIntegerArrayList(CONTACTS);
		if (intContacts != null) {
			contacts = getContactsFromIntegers(intContacts);
		}
	}
}
 
Example 3
Project: androidscan   File: ResultActivity.java   View Source Code Vote up 7 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_result);
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP);
        if (compressedBitmap != null) {
            mBitmap = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
            mBitmap = mBitmap.copy(Bitmap.Config.ARGB_8888, true);
        }

        mResultStr = extras.getString(BUNDLE_KEY_SCAN_RESULT);
        mDecodeMode = extras.getInt(DecodeThread.DECODE_MODE);
        mDecodeTime = extras.getString(DecodeThread.DECODE_TIME);
    }
    initViews();
}
 
Example 4
Project: Nird2   File: ReblogFragment.java   View Source Code Vote up 7 votes
@Override
public View onCreateView(LayoutInflater inflater,
		@Nullable ViewGroup container,
		@Nullable Bundle savedInstanceState) {

	Bundle args = getArguments();
	blogId = new GroupId(args.getByteArray(GROUP_ID));
	postId = new MessageId(args.getByteArray(POST_ID));

	View v = inflater.inflate(R.layout.fragment_reblog, container, false);
	ui = new ViewHolder(v);
	ui.post.setTransitionName(postId);
	ui.input.setSendButtonEnabled(false);
	showProgressBar();

	return v;
}
 
Example 5
Project: Udacity_Sunshine   File: ItemChoiceManager.java   View Source Code Vote up 7 votes
public void onRestoreInstanceState(Bundle savedInstanceState) {
    byte[] states = savedInstanceState.getByteArray(SELECTED_ITEMS_KEY);
    if ( null != states ) {
        Parcel inParcel = Parcel.obtain();
        inParcel.unmarshall(states, 0, states.length);
        inParcel.setDataPosition(0);
        mCheckStates = inParcel.readSparseBooleanArray();
        final int numStates = inParcel.readInt();
        mCheckedIdStates.clear();
        for (int i=0; i<numStates; i++) {
            final long key = inParcel.readLong();
            final int value = inParcel.readInt();
            mCheckedIdStates.put(key, value);
        }
    }
}
 
Example 6
Project: Nird2   File: ContactSelectorActivity.java   View Source Code Vote up 7 votes
@Override
public void onCreate(@Nullable Bundle bundle) {
	super.onCreate(bundle);

	setContentView(getLayout());

	if (bundle != null) {
		// restore group ID if it was saved
		byte[] groupBytes = bundle.getByteArray(GROUP_ID);
		if (groupBytes != null) groupId = new GroupId(groupBytes);
		// restore selected contacts if a selection was saved
		ArrayList<Integer> intContacts =
				bundle.getIntegerArrayList(CONTACTS);
		if (intContacts != null) {
			contacts = getContactsFromIntegers(intContacts);
		}
	}
}
 
Example 7
Project: auto-value-bundle   File: AutoValue_TestClassBundled.java   View Source Code Vote up 6 votes
public static TestClassBundled unbundle(Bundle bundle, Gson gson) {
    return new AutoValue_TestClassBundled(
            bundle,
            bundle.getByte("some_byte"),
            bundle.getBoolean("some_boolean"),
            bundle.getShort("some_short"),
            bundle.getInt("some_int"),
            bundle.getLong("some_long"),
            bundle.getChar("some_char"),
            bundle.getFloat("some_float"),
            bundle.getDouble("some_double"),
            bundle.getString("some_string"),
            bundle.getCharSequence("some_char_sequence"),
            bundle.getParcelable("some_parcelable"),
            bundle.getParcelableArrayList("some_parcelable_array_list"),
            bundle.getSparseParcelableArray("some_parcelable_sparse_array"),
            bundle.getSerializable("some_serializable"),
            bundle.getIntegerArrayList("some_integer_array_list"),
            bundle.getStringArrayList("some_string_array_list"),
            bundle.getCharSequenceArrayList("some_char_sequence_array_list"),
            bundle.getByteArray("some_byte_array"),
            bundle.getShortArray("some_short_array"),
            bundle.getCharArray("some_char_array"),
            bundle.getFloatArray("some_float_array"),
            gson.fromJson(bundle.getString("some_unknown_object"), new com.google.common.reflect.TypeToken<UnknownObject>(){}.getType()),
            gson.fromJson(bundle.getString("some_unknown_object_list"), new com.google.common.reflect.TypeToken<ArrayList<UnknownObject>>(){}.getType()),
            gson.fromJson(bundle.getString("test_enum"), new com.google.common.reflect.TypeToken<TestEnum>(){}.getType()));
}
 
Example 8
Project: MyFire   File: ResultActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_result);

	Bundle extras = getIntent().getExtras();

	mResultImage = (ImageView) findViewById(R.id.result_image);
	mResultText = (TextView) findViewById(R.id.result_text);

	if (null != extras) {
		int width = extras.getInt("width");
		int height = extras.getInt("height");

		LayoutParams lps = new LayoutParams(width, height);
		lps.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics());
		lps.leftMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
		lps.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
		
		mResultImage.setLayoutParams(lps);

		String result = extras.getString("result");
		mResultText.setText(result);

		Bitmap barcode = null;
		byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP);
		if (compressedBitmap != null) {
			barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
			// Mutable copy:
			barcode = barcode.copy(Bitmap.Config.RGB_565, true);
		}

		mResultImage.setImageBitmap(barcode);
	}
}
 
Example 9
Project: Nird2   File: FeedPostFragment.java   View Source Code Vote up 6 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,
		@Nullable ViewGroup container,
		@Nullable Bundle savedInstanceState) {

	Bundle args = getArguments();
	byte[] b = args.getByteArray(GROUP_ID);
	if (b == null) throw new IllegalStateException("No group ID in args");
	blogId = new GroupId(b);

	return super.onCreateView(inflater, container, savedInstanceState);
}
 
Example 10
Project: BarcodeReaderView   File: BarcodeReaderHandler.java   View Source Code Vote up 6 votes
@Override
public void handleMessage(Message message) {
    switch (message.what) {
        case MESSAGE_RESTART_PREVIEW:
            restartPreviewAndDecode();
            break;
        case MESSAGE_DECODE_SUCCEEDED:
            state = State.SUCCESS;
            Bundle bundle = message.getData();
            Bitmap barcode = null;
            float scaleFactor = 1.0f;
            if (bundle != null) {
                byte[] compressedBitmap = bundle.getByteArray(DecodeThread.BARCODE_BITMAP);
                if (compressedBitmap != null) {
                    barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
                    // Mutable copy:
                    barcode = barcode.copy(Bitmap.Config.ARGB_8888, true);
                }
                scaleFactor = bundle.getFloat(DecodeThread.BARCODE_SCALED_FACTOR);
            }
            barcodeReaderView.handleDecode((Result) message.obj, barcode, scaleFactor);
            break;
        case MESSAGE_DECODE_FAILED:
            // We're decoding as fast as possible, so when one decode fails, start another.
            state = State.PREVIEW;
            cameraManager.requestPreviewFrame(decodeThread.getHandler(), MESSAGE_DECODE);
            break;
    }
}
 
Example 11
Project: Android-2017   File: MainActivity.java   View Source Code Vote up 6 votes
/**
 * recupera el estat de la activity
 */
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);

    if (savedInstanceState.getByteArray(PHOTO_INTENT) != null) {
        ImageView imageView = findViewById(R.id.imgPhoto);
        Bitmap bitmap = BitmapFactory.decodeByteArray(savedInstanceState.getByteArray(PHOTO_INTENT)
                , 0
                , savedInstanceState.getByteArray(PHOTO_INTENT).length);
        imageView.setImageBitmap(bitmap);
    }
}
 
Example 12
Project: AndroidMuseumBleManager   File: BluetoothLeDevice.java   View Source Code Vote up 6 votes
/**
 * Instantiates a new bluetooth le device.
 *
 * @param in the in
 */
@SuppressWarnings("unchecked")
protected BluetoothLeDevice(final Parcel in) {
    final Bundle b = in.readBundle(getClass().getClassLoader());
    mCurrentRssi = b.getInt(PARCEL_EXTRA_CURRENT_RSSI, 0);
    mCurrentTimestamp = b.getLong(PARCEL_EXTRA_CURRENT_TIMESTAMP, 0);
    mDevice = b.getParcelable(PARCEL_EXTRA_BLUETOOTH_DEVICE);
    mFirstRssi = b.getInt(PARCEL_EXTRA_FIRST_RSSI, 0);
    mFirstTimestamp = b.getLong(PARCEL_EXTRA_FIRST_TIMESTAMP, 0);
    mRecordStore = b.getParcelable(PARCEL_EXTRA_DEVICE_SCANRECORD_STORE);
    mRssiLog = (Map<Long, Integer>) b.getSerializable(PARCEL_EXTRA_DEVICE_RSSI_LOG);
    mScanRecord = b.getByteArray(PARCEL_EXTRA_DEVICE_SCANRECORD);
}
 
Example 13
Project: NaiveDemos   File: BleServiceTestActivity.java   View Source Code Vote up 6 votes
private void handleNotify(Bundle bundle) {
    if (null == bundle) {
        LogUtils.w(TAG, "handleNotify():bundle = null");
        return;
    }
    byte[] byteArray = bundle.getByteArray(Key.KEY_CHARACTER_NOTIFY);
    builder.append(HexUtil.encodeHexStr(byteArray) + "\n");
    tvShow.setText(builder.toString());
}
 
Example 14
Project: tvConnect_android   File: CaptureActivityHandler.java   View Source Code Vote up 5 votes
@Override
public void handleMessage(Message message) {
	if (message.what == R.id.restart_preview) {
		restartPreviewAndDecode();

	} else if (message.what == R.id.decode_succeeded) {
		state = State.SUCCESS;
		Bundle bundle = message.getData();
		Bitmap barcode = null;
		float scaleFactor = 1.0f;
		if (bundle != null) {
			byte[] compressedBitmap = bundle
					.getByteArray(DecodeThread.BARCODE_BITMAP);
			if (compressedBitmap != null) {
				barcode = BitmapFactory.decodeByteArray(compressedBitmap,
						0, compressedBitmap.length, null);
				// Mutable copy:
				barcode = barcode.copy(Bitmap.Config.ARGB_8888, true);
			}
			scaleFactor = bundle
					.getFloat(DecodeThread.BARCODE_SCALED_FACTOR);
		}
		activity.handleDecode((Result) message.obj, barcode, scaleFactor);

	} else if (message.what == R.id.decode_failed) {// We're decoding as fast as possible, so when one decode fails,
		// start another.
		state = State.PREVIEW;
		cameraManager.requestPreviewFrame(decodeThread.getHandler(),
				R.id.decode);

	} else if (message.what == R.id.return_scan_result) {
		activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
		activity.finish();

	} else if (message.what == R.id.launch_product_query) {
		String url = (String) message.obj;

		Intent intent = new Intent(Intent.ACTION_VIEW);
		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
		intent.setData(Uri.parse(url));

		ResolveInfo resolveInfo = activity.getPackageManager()
				.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
		String browserPackageName = null;
		if (resolveInfo != null && resolveInfo.activityInfo != null) {
			browserPackageName = resolveInfo.activityInfo.packageName;
			Log.d(TAG, "Using browser in package " + browserPackageName);
		}

		// Needed for default Android browser / Chrome only apparently
		if ("com.android.browser".equals(browserPackageName)
				|| "com.android.chrome".equals(browserPackageName)) {
			intent.setPackage(browserPackageName);
			intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			intent.putExtra(Browser.EXTRA_APPLICATION_ID,
					browserPackageName);
		}

		try {
			activity.startActivity(intent);
		} catch (ActivityNotFoundException ignored) {
			Log.w(TAG, "Can't find anything to handle VIEW of URI " + url);
		}

	}
}
 
Example 15
Project: android-state   File: InjectionHelper.java   View Source Code Vote up 5 votes
public byte[] getByteArray(Bundle state, String key) {
    return state.getByteArray(key + mBaseKey);
}
 
Example 16
Project: boohee_v5.6   File: WXImageObject.java   View Source Code Vote up 5 votes
public void unserialize(Bundle bundle) {
    this.imageData = bundle.getByteArray("_wximageobject_imageData");
    this.imagePath = bundle.getString("_wximageobject_imagePath");
    this.imageUrl = bundle.getString("_wximageobject_imageUrl");
}
 
Example 17
Project: letv   File: Util.java   View Source Code Vote up 5 votes
public static Statistic upload(Context context, String str, Bundle bundle) throws MalformedURLException, IOException, NetworkUnavailableException, HttpStatusException {
    int size;
    int i;
    byte[] byteArray;
    if (context != null) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
        if (connectivityManager != null) {
            NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
            if (activeNetworkInfo == null || !activeNetworkInfo.isAvailable()) {
                throw new NetworkUnavailableException(NetworkUnavailableException.ERROR_INFO);
            }
        }
    }
    Bundle bundle2 = new Bundle(bundle);
    String str2 = "";
    str2 = bundle2.getString("appid_for_getting_config");
    bundle2.remove("appid_for_getting_config");
    HttpClient httpClient = HttpUtils.getHttpClient(context, str2, str);
    HttpUriRequest httpPost = new HttpPost(str);
    Bundle bundle3 = new Bundle();
    for (String str22 : bundle2.keySet()) {
        Object obj = bundle2.get(str22);
        if (obj instanceof byte[]) {
            bundle3.putByteArray(str22, (byte[]) obj);
        }
    }
    httpPost.setHeader(HttpRequest.HEADER_CONTENT_TYPE, "multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f");
    httpPost.setHeader("Connection", "Keep-Alive");
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    byteArrayOutputStream.write(getBytesUTF8("--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
    byteArrayOutputStream.write(getBytesUTF8(encodePostBody(bundle2, "3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f")));
    if (!bundle3.isEmpty()) {
        size = bundle3.size();
        byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
        i = -1;
        for (String str222 : bundle3.keySet()) {
            i++;
            byteArrayOutputStream.write(getBytesUTF8("Content-Disposition: form-data; name=\"" + str222 + "\"; filename=\"" + "value.file" + "\"" + "\r\n"));
            byteArrayOutputStream.write(getBytesUTF8("Content-Type: application/octet-stream\r\n\r\n"));
            byteArray = bundle3.getByteArray(str222);
            if (byteArray != null) {
                byteArrayOutputStream.write(byteArray);
            }
            if (i < size - 1) {
                byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
            }
        }
    }
    byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f--\r\n"));
    byteArray = byteArrayOutputStream.toByteArray();
    i = byteArray.length + 0;
    byteArrayOutputStream.close();
    httpPost.setEntity(new ByteArrayEntity(byteArray));
    HttpResponse execute = httpClient.execute(httpPost);
    size = execute.getStatusLine().getStatusCode();
    if (size == 200) {
        return new Statistic(a(execute), i);
    }
    throw new HttpStatusException(HttpStatusException.ERROR_INFO + size);
}
 
Example 18
Project: ZXingAndroidExt   File: CaptureActivityHandler.java   View Source Code Vote up 5 votes
@Override
public void handleMessage(Message message) {
    int what = message.what;
    if (what == R.id.restart_preview) {
        restartPreviewAndDecode();
    } else if (what == R.id.decode_succeeded) {
        state = State.SUCCESS;
        Bundle bundle = message.getData();
        Bitmap barcode = null;
        float scaleFactor = 1.0f;
        if (bundle != null) {
            byte[] compressedBitmap = bundle.getByteArray(DecodeThread.BARCODE_BITMAP);
            if (compressedBitmap != null) {
                barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
                // Mutable copy:
                barcode = barcode.copy(Bitmap.Config.ARGB_8888, true);
            }
            scaleFactor = bundle.getFloat(DecodeThread.BARCODE_SCALED_FACTOR);
        }
        activity.handleDecode((Result) message.obj, barcode, scaleFactor);
    } else if (what == R.id.decode_failed) {
        // We're decoding as fast as possible, so when one decode fails, start another.
        state = State.PREVIEW;
        cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
    } else if (what == R.id.return_scan_result) {
        activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
        activity.finish();
    } else if (what == R.id.launch_product_query) {
        String url = (String) message.obj;

        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
        intent.setData(Uri.parse(url));

        ResolveInfo resolveInfo =
                activity.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
        String browserPackageName = null;
        if (resolveInfo != null && resolveInfo.activityInfo != null) {
            browserPackageName = resolveInfo.activityInfo.packageName;
            Log.d(TAG, "Using browser in package " + browserPackageName);
        }

        // Needed for default Android browser / Chrome only apparently
        if ("com.android.browser".equals(browserPackageName) || "com.android.chrome".equals(browserPackageName)) {
            intent.setPackage(browserPackageName);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.putExtra(Browser.EXTRA_APPLICATION_ID, browserPackageName);
        }

        try {
            activity.startActivity(intent);
        } catch (ActivityNotFoundException ignored) {
            Log.w(TAG, "Can't find anything to handle VIEW of URI " + url);
        }
    }
}
 
Example 19
Project: weex-3d-map   File: CaptureActivityHandler.java   View Source Code Vote up 5 votes
@Override
public void handleMessage(Message message) {
  if (message.what == R.id.restart_preview) {
    restartPreviewAndDecode();

  } else if (message.what == R.id.decode_succeeded) {
    state = State.SUCCESS;
    Bundle bundle = message.getData();
    Bitmap barcode = null;
    float scaleFactor = 1.0f;
    if (bundle != null) {
      byte[] compressedBitmap = bundle.getByteArray(DecodeThread.BARCODE_BITMAP);
      if (compressedBitmap != null) {
        barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
        // Mutable copy:
        barcode = barcode.copy(Bitmap.Config.ARGB_8888, true);
      }
      scaleFactor = bundle.getFloat(DecodeThread.BARCODE_SCALED_FACTOR);
    }
    activity.handleDecode((Result) message.obj, barcode, scaleFactor);

  } else if (message.what == R.id.decode_failed) {// We're decoding as fast as possible, so when one decode fails, start another.
    state = State.PREVIEW;
    cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.decode);

  } else if (message.what == R.id.return_scan_result) {
    activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
    activity.finish();

  } else if (message.what == R.id.launch_product_query) {
    String url = (String) message.obj;

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    intent.setData(Uri.parse(url));

    ResolveInfo resolveInfo =
            activity.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
    String browserPackageName = null;
    if (resolveInfo != null && resolveInfo.activityInfo != null) {
      browserPackageName = resolveInfo.activityInfo.packageName;
      Log.d(TAG, "Using browser in package " + browserPackageName);
    }

    // Needed for default Android browser / Chrome only apparently
    if ("com.android.browser".equals(browserPackageName) || "com.android.chrome".equals(browserPackageName)) {
      intent.setPackage(browserPackageName);
      intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      intent.putExtra(Browser.EXTRA_APPLICATION_ID, browserPackageName);
    }

    try {
      activity.startActivity(intent);
    } catch (ActivityNotFoundException ignored) {
      Log.w(TAG, "Can't find anything to handle VIEW of URI " + url);
    }

  }
}
 
Example 20
Project: minion-android   File: CompileActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    tintStatusBarIcons(this, true);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_compile);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(R.string.compile);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    adapter = new MinionRecyclerAdapter(this);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this,
            LinearLayoutManager.VERTICAL, false);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);

    adapter.setGroupListener(this);
    adapter.setRecordListener(this);

    storage = MemoryStorage.create();
    if (savedInstanceState == null) {
        String extra = getIntent().getStringExtra(EXTRA_INI_STRUCTURE);
        if (extra != null) {
            bytesToStorage(extra.getBytes());
        }
    } else {
        final byte[] data = savedInstanceState.getByteArray(EXTRA_INI_STRUCTURE);
        if (data != null) {
            bytesToStorage(data);
        }
    }
    minion = Minion.lets().load(storage).and().store(storage).sync();

    adapter.setData(minion);
    adapter.notifyDataSetChanged();
}