Android design question

by frizzo » Wed, 11 Mar 2009 13:53:12 GMT


Sponsored Links
 The system in place to pass information between the screens... I am
confused why the team chose to reinvent the wheel via the putExtras
methods.  Instead of making the transport objects inherit from
Parcelable and the like, why not just use Java's OO strength and set
objects to Activities themselves.  For instance, like this:


class Caller extends Activity {
   public on buttonClick() {
          ThisScreen ts = new ThisScreen();
          ts.SetCustomValue(10);

          startActivity(ts)
   }
}

class ThisScreen extends Activity {
   public void onCreate() {
       txtBox.setText(Integer.toString(i));
   }

   public void SetCustomValue (int i) {
            ...
   }
}

Instead we are having to unnecessarily learn new concepts.  Was there
a compelling reason to implement it they it's implemented that I am
not seeing?

Thanks.

--~--~---------~--~----~------------~-------~--~----~



Android design question

by Jean-Baptiste Queru » Wed, 11 Mar 2009 21:18:32 GMT


 The reason is that the activities in question might live in different
processes, and therefore the parameters that are passed to
startActivity might have to be marshalled across virtual machines,
across processes (and across UIDs).

JBQ






-- 
Jean-Baptiste M. "JBQ" Queru
Android Engineer, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Android design question

by frizzo » Thu, 12 Mar 2009 14:53:20 GMT


 Ahh, understood.  Having said that, perhaps in the next rev, it'd be
good include a shortcut for in-process activity changes.

Regards




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. dalvikvm unable to dlopen(/system/lib/libdvsdk.so)

Hi All
    I have used the CodeSourcery toolchain to create a Shared Library out of
my C file and a file containing my JNI wrappers for calling the C functions.
In my JAVA application i am loading this Shared Library and calling the JNI
function for printing helloworld.But i am getting the following error:
    dalvikvm unable to dlopen(/system/lib/libdvsdk.so):unable to find
library

So is it possible to load a Shared Library(libdvsdk.so) which is created
using a different toolchain?Or only NDK toolchain compiled Shared libraries
can be loaded from JAVA application?

Cheers
Aney

2. Catching an action without setting an intent filter?

Context.registerReceiver() is probably what you are looking for.






> 

3. App widget configue activity opens main activity.

4. How to Read/Write .CSV

5. Calling .net webservice from app?

6. HELP...about T Mobile G1

7. Windows XP Driver for Nexus One so that Adb can detect the phone