문제

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();

    }
}
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top