Code example for Parcel

Methods: readStringArraywriteStringArray

0
    } 
 
    @Test 
    public void testReadWriteStringArray() throws Exception { 
        final String[] strings = {"foo", "bar"};
        parcel.writeStringArray(strings);
        final String[] strings2 = new String[strings.length];
        parcel.readStringArray(strings2);
        assertTrue(Arrays.equals(strings, strings2));
    } 
 
    @Test 
    public void testReadWriteMultipleInts() { 
        for (int i = 0; i < 10; ++i) {
            parcel.writeInt(i);
        } 
        for (int i = 0; i < 10; ++i) {
            assertThat(parcel.readInt(), equalTo(i));
        } 
        // now try to read past the number of items written and see what happens 
Contextual code suggestions in your IDE  Get Codota for Java