06-15 17:18:33.744: E/AndroidRuntime(402): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 06-15 17:18:33.744: E/AndroidRuntime(402): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 06-15 17:18:33.744: E/AndroidRuntime(402): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 06-15 17:18:33.744: E/AndroidRuntime(402): at android.os.Handler.dispatchMessage(Handler.java:99) 06-15 17:18:33.744: E/AndroidRuntime(402): at android.os.Looper.loop(Looper.java:123) 06-15 17:18:33.744: E/AndroidRuntime(402): at android.app.ActivityThread.main(ActivityThread.java:4627) 06-15 17:18:33.744: E/AndroidRuntime(402): at java.lang.reflect.Method.invokeNative(Native Method) 06-15 17:18:33.744: E/AndroidRuntime(402): at java.lang.reflect.Method.invoke(Method.java:521) 06-15 17:18:33.744: E/AndroidRuntime(402): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 06-15 17:18:33.744: E/AndroidRuntime(402): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 06-15 17:18:33.744: E/AndroidRuntime(402): at dalvik.system.NativeStart.main(Native Method) 06-15 17:18:33.744: E/AndroidRuntime(402): Caused by: java.lang.NullPointerException 06-15 17:18:33.744: E/AndroidRuntime(402): at java.io.File.fixSlashes(File.java:234) 06-15 17:18:33.744: E/AndroidRuntime(402): at java.io.File.init(File.java:201) 06-15 17:18:33.744: E/AndroidRuntime(402): at java.io.File.(File.java:152) 06-15 17:18:33.744: E/AndroidRuntime(402): at com.example.newprojimage.upload.onCreate(upload.java:18) 06-15 17:18:33.744: E/AndroidRuntime(402): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 06-15 17:18:33.744: E/AndroidRuntime(402): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 06-15 17:18:33.744: E/AndroidRuntime(402): ... 11 more
Asked
Active
Viewed 54 times
1 Answers
0
Two different questions in one eh, you can send the selectedImageURI
to the next activity via an Intent
;
Intent intent = new Intent(CurrentActivity.this, NextActivity.class);
intent.putExtra("selected image",selectedImageURI);
startActivity(intent);
Add that to your onActivityResult
and then resize the image there.
In the next activity, probably in onCreate
, resize image acc to what you need. Doing that would be a combination of:
Bitmap bitmap = decodeFile(new File(getIntent().getExtras().getString("selected image")));
yourImageView.setImageBitmap(bitmap);
and need to understand a bit of re-sizing the image, as you have a few options depending on how it changes the quality of image, , how will it affect memory consumption etc so:
Resize image bitmap
or
Shrink/scale bitmap
Here's another tutorial to resize a bitmap
-
what do you mean by show me error? if not calling it in oncreate, try Activity.this.getIntent... – Pararth Jun 14 '14 at 20:21
-
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activityfcy_main); ImageView imgv1 = (ImageView)findViewById(R.id.ImageView01); Bitmap bitmap = decodeFile(new File(this.getIntent.getExtras.getString("selected image"))); imgv1.setImageBitmap(bitmap); I do like this – user3702580 Jun 14 '14 at 20:26
-
Take string separately from getintent and check if it is being passed correctly, and that its not null. What is the error that you get...check logcat man – Pararth Jun 14 '14 at 21:05
-
check edit, missing the brackets in getIntent() and getExtras(), please read more about android development also, you'l then avoid [such questions also](http://stackoverflow.com/questions/24012412/select-image-from-phone-gallery) – Pararth Jun 14 '14 at 21:16
-
good it helped you, welcome, can try various tutorials available online and read as much as possible from [Android Developer Official - Section: Develop](http://developer.android.com/develop/index.html) – Pararth Jun 14 '14 at 21:24
-
Can ask a new question actually as you figured the first part out, now its a different problem :) – Pararth Jun 15 '14 at 10:58