Nextrek
Diff Revisions
761
vs
762
for /Android/SmartCharging/SmartCharging/app/src/main/java/it/fedeloper/smartcharging/Controller/RegisterActivity.java
|
@@ -58,7 +58,7 @@ |
58 |
58 |
|
private TextView cognomeText; |
59 |
59 |
|
private TextView numeTelefono; |
60 |
60 |
|
private RelativeLayout avatarContainer; |
61 |
|
- |
|
|
61 |
+ |
private Bitmap avatarImage=null; |
62 |
62 |
|
public static float convertDpToPixel(float dp) { |
63 |
63 |
|
Resources resources = c.getResources(); |
64 |
64 |
|
DisplayMetrics metrics = resources.getDisplayMetrics(); |
|
@@ -317,7 +317,7 @@ |
317 |
317 |
|
ContentBody str_; |
318 |
318 |
|
if(selectedAvatar != null){ |
319 |
319 |
|
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
320 |
|
- |
((BitmapDrawable) ((ImageView) findViewById(R.id.avatarImage)).getDrawable()).getBitmap().compress(Bitmap.CompressFormat.JPEG, 75, baos); |
|
320 |
+ |
avatarImage.compress(Bitmap.CompressFormat.JPEG, 75, baos); |
321 |
321 |
|
byte[] imageBytes = baos.toByteArray(); |
322 |
322 |
|
|
323 |
323 |
|
bab = new ByteArrayBody(imageBytes, "file.jpeg"); |
|
@@ -613,8 +613,8 @@ |
613 |
613 |
|
1000, |
614 |
614 |
|
1000, |
615 |
615 |
|
Utils.getRealPathFromURI(RegisterActivity.this, selectedAvatar)); |
616 |
|
- |
|
617 |
|
- |
((ImageView) findViewById(R.id.avatarImage)).setImageBitmap(Utils.getOptimizedBitmap(yourSelectedImage, 500)); |
|
616 |
+ |
avatarImage=Utils.getOptimizedBitmap(yourSelectedImage, 500); |
|
617 |
+ |
((ImageView) findViewById(R.id.avatarImage)).setImageBitmap(avatarImage); |
618 |
618 |
|
} catch (FileNotFoundException e) { |
619 |
619 |
|
e.printStackTrace(); |
620 |
620 |
|
} |