나는 안드로이드를 처음 접했다. 내가 뭘하려는 건 바보 야?활동에 의도를 세우고 조각에서받는 방법
//Defining intent for loading image to the edit page
Intent recentPhoto = new Intent(this, ImportPhoto.class);
//Defining byte stream of image chosen
ByteArrayOutputStream bs = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, 50, bs);
//Transforming image to EditPhoto class in byte stream
recentPhoto.putExtra("byteArray", bs.toByteArray());
//Starting the intent
startActivity(recentPhoto);
을 그리고 난 다른 활동 (ImportPhoto)에서 조각 (FirstFragment)에서 수신을 시도하고 아래와 같이 다음과 같이 나는 활동 (EditPhoto)에 의도를 구축해야
// Getting the image back imported from EditPhoto page
final Bitmap photo = BitmapFactory.decodeByteArray(getIntent().
getByteArrayExtra("byteArray"),
0,getIntent().getByteArrayExtra("byteArray").length);
//Displaying the image in the image viewer
viewGalleryImages.setImageBitmap(photo);
조각 클래스가 정적이므로 "유형 액티비티에서 비 정적 메서드 getIntent()에 정적 참조를 만들 수 없습니다"라고 표시됩니다.
번들을 사용하고 프래그먼트에 인수를 설정했지만 동일한 문제가 다시 발생했습니다.
는 또한, 내가 getActivity을 시도(). getIntent .... 또한이 같은 getActivity 캐스팅 ((ImportPhoto) getActivity()). getIntent ... 두 방법은 응용 프로그램을 실행하지만, 그것을 충돌합니다.
모든 종류의 도움을 주실 수 있습니다. 미리 감사드립니다.