| |
---|
| | Button changeDefaultButton = findViewById(R.id.changeDefaultButton); |
---|
| | 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; |
---|
| | } |
---|
| |
---|
| | |
---|
| | 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(); |
---|
| | }catch (Exception e){ |
---|
| |
---|
| | |