1

I am trying to test to write to a Parcel in Android test but it doesnt't work. s==null! What is wrong?

public class scraptest extends AndroidTestCase {

    public void test() {

        Parcel parcel=Parcel.obtain();
        parcel.writeString("sdfsdf");
        String s=parcel.readString();

    }
}
JohnyTex
  • 3,323
  • 5
  • 29
  • 52

1 Answers1

3

One must reset the Parcel's data position with: parcel.setDataPosition(0);

JohnyTex
  • 3,323
  • 5
  • 29
  • 52