diff --git a/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java b/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java index cf6713f..093b82e 100644 --- a/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java +++ b/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java @@ -102,7 +102,6 @@ changeDefaultButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - icon = null; iconUrlString = "http://nitta-lab-www.is.konan-u.ac.jp/nemophila-data/test01.jpg"; setIcon(iconButton); iconFlag = true; @@ -232,6 +231,10 @@ InputStream is = con.getInputStream(); Bitmap bitmap = BitmapFactory.decodeStream(is); + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); + byte[] byteArray = stream.toByteArray(); + icon = Base64.getEncoder().encodeToString(byteArray); handler.post(() -> iv.setImageBitmap(bitmap)); is.close(); con.disconnect();