Hello Olli,

what is the size of byte[] data?
may be problem with the heap size. In logcat output, is something like
grow heap? if yes, try with increasing heap size.

pb

On Aug 14, 2:22 pm, Elias <elias.va...@googlemail.com> wrote:
> I have tried to share betweeb two simpleactivities:
>
> On "parent" activity, I'll start ImageCapture Activity:
>
>                     Intent cameraIntent = new Intent();
>                     cameraIntent.setClass(this, ImageCapture.class);
>                     cameraIntent.putExtra("cameraData", "null"); //not sure 
> why
> this is here?
>                     startActivityForResult(cameraIntent, 1);
>
>     @Override
>     protected void onActivityResult(int requestCode, int resultCode,
> Intent data) {
>         CharSequence text = "onActivityResult requestCode " +
> requestCode + " resultCode " + resultCode + " data " + data;
>         int duration = Toast.LENGTH_LONG;
>         Toast toast = Toast.makeText(this, text, duration);
>         toast.show();
>     }
>
> And on camera Activity (I have inner class which implements
> PictureCallback):
>
>       �...@override
>         public void onPictureTaken(byte[] data, Camera camera) {
>             try {
>                 Intent resultIntent = new Intent();
>                 resultIntent.putExtra("cameraData", data);
>                 setResult(Activity.RESULT_OK,resultIntent);
>                 finish();
>             } catch (Exception ex) {
>                 setResult(Activity.RESULT_CANCELED);
>                 finish();
>             }
>         }
>
> It seems that onActivityResult method is never called, what am I
> missing here? Camera activity is closed and first activity is shown
> again but onActivityResult is not called.
> It works perfectly fine (onActivityResult is called and toast is
> displayed) if do following on camera intent:
>
> @Override
>         public void onPictureTaken(byte[] data, Camera camera) {
>             try {
>                 //Intent resultIntent = new Intent();
>                 //resultIntent.putExtra("cameraData", data);
>                 setResult(Activity.RESULT_OK);
>                 finish();
>             } catch (Exception ex) {
>                 setResult(Activity.RESULT_CANCELED);
>                 finish();
>             }
>
> With code above Activity.RESULT_OK (-1) is returned to
> onActivityResult method.
> I'm testing with HTC Hero.
>
> Cheers
> Olli
>
> On 7 elo, 17:48, elpix1 <elp...@gmail.com> wrote:
>
>
>
> > Another way to share data betweenactivitiesin the same process
> > is to use the Application class:
>
> >http://developer.android.com/reference/android/app/Application.html
>
> > You have to specify the name of your Application class in the
> > manifest and the framework will create only an instance of this
> > class, which will live while the application process is running.
>
> > In any activity, you can get the reference for your application
> > instance using:
>
> > Application a = getApplication();
>
> > On Jul 22, 10:49 am, Per Sandström <pg.sandst...@gmail.com> wrote:
>
> > > So far I have been using SharedPreferences to share data between
> > >activities. But I would very much like to find a better way. I would
> > > simply like both Activity1 and Activity2 to share Object1. Activity1
> > > will create Object1 and then start Activity2. What is the smartest way
> > > to give Activity2 a pointer to Object1?
>
> > > To summarize:Activitiesdon't have constructors! How do I send data
> > > to them from their parent activity???
>
> > > Regards,
> > > Per Sandström- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to