Inter-Activity memory restriction and API documents

by Jack Jia » Mon, 07 Sep 2009 00:04:23 GMT

Sponsored Links
 Hi Mark,

I can give my app as an example. The app uses the camera API to catch a
bitmap and tries to pass the bitmap to the cropping activity. It worked on
the emulator but not on the real device because the inter-activity
limitation on memory. I can persist the data and pass it to the cropping
activity and pass the result back in the same way, but that will be very
slow. In the end I have to write my own cropping in the same activity. You
can see the cropping activity is not very useful (also, it is not documented
as well) because of the limitation.

If the two activities have the same signature or one of them (such as the
cropping) is a shared tool and provides only service (not data) then there
is no security concern. By "single process framework", I mean I can do
everything in my process and at the same time to use libraries and tools etc
from the SDK.

I really like Android but I hope it can improve on this.



Inter-Activity memory restriction and API documents

by Dianne Hackborn » Mon, 07 Sep 2009 02:22:36 GMT


This won't work because if you process has to get killed at some point while
in the background, there is no way for the system to restore this data to

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


Sponsored Links

Inter-Activity memory restriction and API documents

by Jack Jia » Mon, 07 Sep 2009 12:20:37 GMT

 Thank you for the idea of using static data member or service. But in my
app, I want to use an activity built in Android which I cannot change, the
only way seems to be using an intent with either data or uri. Also,
sometimes, it seems too much work to create service when I just want to
share a bitmap. Since there are so many ways to use the intent with so many
flags, maybe there is a way to make it work. I haven't tried all the
different flags. I would really like to just instantiate a cropping class
and call a method with my bitmap that would ausome.



Other Threads

1. external native lib description

Is there a one liner description for the external projects listed



2. swapping two buttons isung translate animation

I am trying to swap the position of two buttons.
my swapping code looks as below.

private void exchangeButtons(Button btn1, Button btn2) {
        // Create the animation set

        AnimationSet exchangeAnimation = new AnimationSet(true);
        TranslateAnimation translate = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, btn2.getLeft(),
Animation.RELATIVE_TO_SELF, btn1.getLeft(),
Animation.RELATIVE_TO_SELF, btn2.getRight(),
Animation.RELATIVE_TO_SELF, btn1.getRight()
//      int fromX = btn1.getLeft();
//      int fromY = btn1.getRight();
//      int toX = btn2.getLeft();
//      int toY = btn2.getRight();

        Log.d("ArrangeMe", "view1 pos:" + btn1.getLeft() + ", "
+btn1.getRight() + "view2 pos:" + btn2.getLeft() + ", " +

        AnimationSet exchangeAnimation1 = new AnimationSet(true);
        TranslateAnimation translate1 = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, btn1.getLeft(),
Animation.RELATIVE_TO_SELF, btn2.getLeft(),
Animation.RELATIVE_TO_SELF, btn1.getRight(),
Animation.RELATIVE_TO_SELF, btn2.getRight()

                // EXECUTE


I call the code as below

exchangeButtons(button1, button2);

my layout looks as below

<LinearLayout android:layout_width="fill_parent"
<Button android:text="One" android:id="@+id/button1"
android:layout_height="70px" android:layout_width="70px"
<Button android:text="Two" android:id="@+id/button2"
android:layout_height="70px" android:layout_width="70px"

what happens when i execute the code is,

instead of the buttons exchanging their positions, they just
for sometime[may be 500 ms] and reappear as they were originally.

how to resolve this problem ? will it work properly in device ?



itried this too

but i dont know how he made it work, this variable being non final
cant be used inside thread, hence the code does not compile


3. problem creating new android project

4. run emulator on remote computer?

5. How do I simulate a "Home", "Menu", Or "Back" key press

6. Access to DATA BASE from Android application

7. modular programming (design pattern)