[android-developers] Sharing a view among several activities
I want to create a little widget which displays a green bulb if there is network connectivity and a red bulb if there is none. Design: a) register a BroadcastReceiver to listen for network connectivity events b) If the receiver receives a network down/up event, it will notify the NetworkUptimeWidget to update itself. Questions: 1) It looks like I will have to duplicate the code in every activity to listen for updates (I am already using the include element to share the XML declarations for NetworkUptimeWidget ). Is there any way to avoid this ? 2) I am currently using the ContentObserver to notify the widget about changes. Obviously that was meant for database providers. Is it wrong to use it like a publish/subscribe method in the general sense ? Thanks Gavin -- 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
[android-developers] Re: protected member variable mScrollX not accessible to subclasses of ViewGroup
Thanks. scrollTo() solved it for me. On 2 oct, 23:35, Romain Guy romain...@google.com wrote: mScrollX is not part of the public API. Use getScrollX() and scrollBy()/scrollTo() to change it. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: protected member variable mScrollX not accessible to subclasses of ViewGroup
mScrollX is a protected member of View, so should be accessible to any subclass. It should be but eclipse is flagging it. I presume one of Android's eclipse Builders are flagging it. Regards, G --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] protected member variable mScrollX not accessible to subclasses of ViewGroup
In the android Launcher app, Workspace.java accesses the mScrollX member variable. http://www.google.com/codesearch/p?hl=frsa=Ncd=2ct=rc#4r7JaNM0EqE/src/com/android/launcher/Workspace.javaq=computeScroll However it looks like mScrollX is not accessible to my ViewGroup subclass. Eclipse is marking it as unresolved(). Why is it that Launcher's codebase can access it whereas custom subclasses cannot ? And what can I do to set the mScrollX with the Scroller's current X position ? Thanks G --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] ViewGroup#onInterceptTouchEvent is only called once
In my custom ViewGroup, I am returning false after handling the MotionEvent.ACTION_DOWN event. According to the javadoc: For as long as you return false from this function, each following event (up to and including the final up) will be delivered first here and then to the target's onTouchEvent(). However, I notice that all subsequent events ( MotionEvent.ACTION_MOVE and MotionEvent.ACTION_UP) are only delivered to my #onTouchEvent method. In #onTouchEvent , I always return true. What could possibly be my bug ? I am running on Android 1.5r2 SDK. Thanks a lot Regards, Gavin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Correct use of Task Affinities and LaunchModes
My android app contains a suite of mini apps. In short, every screen contains a navbar with several clickable icons, one each for the mini apps (and one for the Main screen). When an icon is clicked, the mini app is launched. In total I have 4 mini apps. So you could imagine that my main screen is like the Home Screen Launcher. Although these mini apps could run standalone by their own, I want the user to be authenticated. Thus there is a LoginActivity right before the MainActivity. LoginActivity --- MainActivity --- AppOneActivity or AppTwoActivity or AppThreeActivity or AppFourActivity (aka PresenceListActivity) I'm still not pretty sure of the benefit of Tasks (arranged set of Activities), so I would like comments from Android experts on my design decisions:- (1) I plan to set the attribute finishOnTaskLaunch to true for LoginActivity. As I understand it, once the login is authenticated, I will navigate the user to MainActivity, and I want LoginActivity to disappear. Is this better than calling #finish on the Activity ? Will MainActivity automatically become the root of the Task without any extra configuration/code ? (2) One of the mini app is an IM client. The PresenceListActivity will hosts many instances of ChatActivity (one-to-one chat session with an active contact in the buddylist). I plan to use the default launchmode for ChatActivity since each Chat should be handled by a new instance. Sounds correct ? (3) As for the sticky navbar, I plan to set the clearTaskOnLaunch attribute to true for all of them. As I understand it, that should clear the stack whenever I plan to launch into any of the mini apps. Also their launchModes will be singleTask. Am I on the right path ? (4) Finally I don't really understand how to read the output of adb shell dumpsys activity. For example Task{10 com.me.rnd.exit} clearOnBackground=false numActivities=1 affinity=com.me.rnd.exit lastActiveTime=5513102 (inactive for 5s) History #1: . Task{2 com.android.launcher} clearOnBackground=true numActivities=1 rootWasReset=true affinity=com.android.launcher lastActiveTime=5512949 (inactive for 6s) Running #0: Sometimes underneath the Tasks, you will see History and in others Running, what do these mean ? Even stranger, sometimes I have two History under a task. Thanks G --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Looking for a TextView with hyperlinks
Has anyone opensourced a TextView that will render urls as clickable links (fire up WebKit on receiving a clickc event) ? If not, I'll write one myself. Thanks Gavin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] SQL aggregate functions via SqlQueryBuilder
Hi, I want to run a query of the form: select sum(salary) from people where department=23 I'm not sure how to do it via the SqlQueryBuilder? Is there an alternative solution ? Thanks all. Regards. Gavin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: SQL aggregate functions via SqlQueryBuilder
Just discovered SQLiteDatabase.rawQuery( ... ) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Why do I get this SQLiteCursor exception ?
Specifically what causes this to happen ? Thanks. DEBUG/dalvikvm(927): Exception Ljava/lang/IllegalStateException; from SQLiteCursor.java:403 not caught locally INFO/dalvikvm(927): Uncaught exception thrown by finalizer (will be discarded): INFO/dalvikvm(927): Ljava/lang/IllegalStateException;: Finalizing cursor [EMAIL PROTECTED] on reports that has not been deactivated or closed INFO/dalvikvm(927): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:403) INFO/dalvikvm(927): at android.dalvik.NativeStart.run(Native Method) DEBUG/SurfaceFlinger(513): Surface 2, heap=0x1236e0 destroyed DEBUG/SurfaceFlinger(513): Surface 1, heap=0x1236e0 destroyed DEBUG/SurfaceFlinger(513): Surface 1, heap=0x1236e0 destroyed DEBUG/SurfaceFlinger(513): Surface 0, heap=0x1236e0 destroyed DEBUG/SurfaceFlinger(513): Surface 1, heap=0x1236e0 destroyed DEBUG/AdContentProvider(927): insert DEBUG/AdContentProvider(927): inserted new uricontent://org.mape.ad/ads/1 DEBUG/AdServerService(927): received Advert for uuid c60e02e1-2ae6-707a6b41e445-Advert28 saved as content://org.mape.ad/ads/1 VERBOSE/org.android.server.service.AdUnitDownloadServiceImpl$2(641): Message (what=2) received DEBUG/AdUnitDownloadService(641): numOfCallbacks 1 DEBUG/AdUnitDownloadService(641): Broadcast advert c60e02e1-2ae6-707a6b41e445-Advert32 INFO/DEBUG(490): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** INFO/DEBUG(490): pid: 927, tid: 1164 org.android.client INFO/DEBUG(490): signal 11 (SIGSEGV), fault addr 03e4 INFO/DEBUG(490): r0 001d r1 400898c8 r2 0140 r3 INFO/DEBUG(490): r4 00f9 r5 ffeb r6 0012ae18 r7 0012ae18 INFO/DEBUG(490): r8 r9 0140 10 fp 400898c8 INFO/DEBUG(490): ip 000e5c20 sp 42ccc644 lr ac035304 pc ac034ff0 cpsr 2010 INFO/DEBUG(490): #01 pc ac034ff0 /system/lib/libsgl.so INFO/DEBUG(490): #01 lr ac035304 /system/lib/libsgl.so INFO/DEBUG(490): #02 pc unknown INFO/DEBUG(490): stack: INFO/DEBUG(490): 42ccc600 03c0 INFO/DEBUG(490): 42ccc604 afe0e5d8 /system/lib/libc.so INFO/DEBUG(490): 42ccc608 03c0 INFO/DEBUG(490): 42ccc60c 0140 INFO/DEBUG(490): 42ccc610 afe3c34c INFO/DEBUG(490): 42ccc614 afe0e448 /system/lib/libc.so INFO/DEBUG(490): 42ccc618 0012ae18 [heap] INFO/DEBUG(490): 42ccc61c c000 INFO/DEBUG(490): 42ccc620 01b4 INFO/DEBUG(490): 42ccc624 afe0b1df /system/lib/libc.so INFO/DEBUG(490): 42ccc628 00179718 [heap] INFO/DEBUG(490): 42ccc62c 0140 INFO/DEBUG(490): 42ccc630 42a42f2c INFO/DEBUG(490): 42ccc634 INFO/DEBUG(490): 42ccc638 df002777 INFO/DEBUG(490): 42ccc63c e3a070ad INFO/DEBUG(490): 42ccc640 0003 INFO/DEBUG(490): == 42ccc644 400898c8 INFO/DEBUG(490): 42ccc648 INFO/DEBUG(490): 42ccc64c 0012ae18 [heap] INFO/DEBUG(490): 42ccc650 ac034fc4 /system/lib/libsgl.so INFO/DEBUG(490): 42ccc654 0140 INFO/DEBUG(490): 42ccc658 42a42f2c INFO/DEBUG(490): 42ccc65c INFO/DEBUG(490): 42ccc660 0577 INFO/DEBUG(490): 42ccc664 ac035304 /system/lib/libsgl.so INFO/DEBUG(490): 42ccc668 INFO/DEBUG(490): 42ccc66c ac1067ec /system/lib/libsgl.so INFO/DEBUG(490): 42ccc670 0064 INFO/DEBUG(490): 42ccc674 000e5c20 [heap] INFO/DEBUG(490): 42ccc678 INFO/DEBUG(490): 42ccc67c 42ccc6a8 INFO/DEBUG(490): 42ccc680 03ec INFO/DEBUG(490): 42ccc684 ac034764 /system/lib/libsgl.so INFO/DEBUG(490): 42ccc688 ac034878 /system/lib/libsgl.so INFO/DEBUG(490): 42ccc68c ac034824 /system/lib/libsgl.so INFO/DEBUG(490): 42ccc690 00150238 [heap] INFO/DEBUG(490): 42ccc694 e0ffd8ff INFO/DEBUG(490): 42ccc698 464a1000 INFO/DEBUG(490): 42ccc69c 01004649 INFO/DEBUG(490): 42ccc6a0 0101 INFO/DEBUG(490): 42ccc6a4 0100 INFO/DEBUG(490): 42ccc6a8 INFO/DEBUG(490): 42ccc6ac INFO/DEBUG(490): 42ccc6b0 INFO/DEBUG(490): 42ccc6b4 INFO/DEBUG(490): 42ccc6b8 INFO/DEBUG(490): 42ccc6bc INFO/DEBUG(490): 42ccc6c0 INFO/DEBUG(490): 42ccc6c4 INFO/DEBUG(490): 42ccc6c8 INFO/DEBUG(490): 42ccc6cc INFO/DEBUG(490): 42ccc6d0 INFO/DEBUG(490): 42ccc6d4 INFO/DEBUG(490): 42ccc6d8 INFO/DEBUG(490): 42ccc6dc INFO/DEBUG(490): 42ccc6e0 INFO/DEBUG(490): 42ccc6e4 INFO/DEBUG(490): 42ccc6e8 INFO/DEBUG(490): 42ccc6ec INFO/DEBUG(490): 42ccc6f0 INFO/DEBUG(490): 42ccc6f4 INFO/DEBUG(490): 42ccc6f8 INFO/DEBUG(490): 42ccc6fc INFO/DEBUG(490): 42ccc700 INFO/DEBUG(490): 42ccc704 INFO/DEBUG(490): 42ccc708 INFO/DEBUG(490): 42ccc70c
[android-developers] Request for comment on Activity flow design
I have a need to intersperse the flow between one Activity to another with an intermediate Activity. Let's call the intermediate activity INTERMEDIATE. So imagine my application having a normal activity flow like this: A - B - C - D Now putting the intermediary activity into the flow, we get: A - INTERMEDIATE - B - INTERMEDIATE - C - INTERMEDIATE - D When the user presses the BACK button starting from D, it will go directly to C. i.e. the INTERMEDIATE activity only appears in the forward direction. Basically INTERMEDIATE will transition between foreground background many times throughout the lifetime of the app. A summary of my requirements: 1) The INTERMEDIATE activity should NOT die unless the initial launch activity A exits. i.e. I only have an exit menu item in A. 2) I need to be able to change the contents displayed by INTERMEDIATE during a transition. i.e. From A - B, I will need the properties of INTERMEDIATE: (2.1) the displayed content. (2.2) the next activity to progress to (activity B). This applies to the other forward transitions. My idea: 3) Store the states in a service. And in INTERMEDIATE's onResume() I can query the service for both (2.1) and (2.2) and change it accordingly. 4) I still don't know which of the launch modes to use for INTERMEDIATE. Based on the docs; it's between singleTask and singleInstance. However I don't understand the concept of Tasks as described in the doc: e.g. Only allow one instance of this activity to ever be running. This activity gets a unique task with only itself running in it; if it is ever launched again with the same Intent, then that task will be brought forward and its onNewIntent(Intent) method called. If this activity tries to start a new activity, that new activity will be launched in a separate task. Any help would be much appreciated. Thanks Gavin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Where do you embed application version ?
In JavaME, the version is specified in the JAD. The documentation for AndroidManifest.xml does not describe any way to version a package. How do you handle this ? Thanks Gavin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Thread safety of using a Handler
Consider the following:- 0Handler mHandler = ... 1Foo foo = new Foo( a ); 2Message.obtain( mHandler, 1, foo ).sendToTarget(); Many threads will be calling line #2 using the shared Handler. Is this thread safe ? Regards, Gavin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Problem making my custom class into a Parcelable
Greetings, I'm getting this error when running ant aidl. [apply] /data/projects2008/android/iteration1/lib/src/org/android/ common/IAdUnitAvailability.aidl:5 parameter 1: 'Advert ad' can be an out parameter, so you must declare it as in, out or inout. In the package, I have: a) Advert.aidl The file contains: package org.android.common parcelable Advert; b) Advert.java I have followed http://code.google.com/android/reference/aidl.html to make Advert.java into a Parcelable. c) IAdUnitAvailability.aidl I have an interface method with signature: void gimmeAds( Advert ad ); What am I missing ? Thanks Gavin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Problem making my custom class into a Parcelable
Thanks Mark. On 12 juin, 18:20, Mark Murphy [EMAIL PROTECTED] wrote: This is only needed for non-primitive parameters to AIDL methods. So if the ad parameter were a float instead of an Advert, you wouldn't have received the error. Observe that java.lang.String parameters are not required to be annotated with those directional keywords. Also java.lang.String is not Parcelable ? I'm guessing that String and other wrapper objects are exceptions. Regards, Gavin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Architecture: one shareable Service used by many apps.
Hello, My goal is to create a specialized service which will download images based on a request. From my readings, I will house this inside a :remote service which resides in its own apk. So I went ahead and created three separate android projects: a) client b) common c) server The Android Manifest in server declares a Service element. (b) contains the generated files via the ant aidl tool. (a) has a dependency on the jar produced by (b). (c) has a dependency on the jar produced by (b). The client is complaining that It is unable to start Service with intent Can inter-app communication be achieved via the aidl facility ? Is there an API to peek into the Service registry of android e.g. to enumerate all available services ? Thanks Regards, Gavin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Architecture: one shareable Service used by many apps.
OK. There was an error in my intent definition. It works now! The following question is about security. From within a service within server.apk; I want to enforce a check such that only a list of packages can call it. I will do this via PackageManager.checkPermission( .. ); The problem with this is that it doesn't stop impersonation. I'm interested in the signature field in AndroidManifest. Is that signature meant to represent a digital signature of app ? Assuming that's the case; I forsee that I will need to:- a) embed the public key of the author of the app in my server.apk b) verify the digsig during the first call. Subsequent calls will not need re-verification. Is this doable ? Regards, Gavin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Architecture: one shareable Service used by many apps.
Mark, Temporary package attribute assigning a signature to the package. This will be removed once real support for package signing is implemented. So, I wouldn't count on that specific attribute being around. Hmmm. That's the price I have to pay, playing with beta software. same caller as a previous one. And, if you *are* passing some sort of caller token with each call, impersonation is merely a matter of intercepting and reusing said token. Even if you check the digital signature on each call, assuming the signature is of some packaging of the call's parameters, you are still subject to a replay attack. Now, My idea here is to tie the pid of the calling process to the verified digsig. That way subsequent calls do not require re-verification. I suspect it is quite hard to impersonate a pid! I'm not sure it can be done in Linux e.g. ask the OS to run your executable under a specific pid. I suspect NOT. At this stage, I am not worried about replay attacks. Regarding decompilation; I wonder if it is possible to obsfuscate bytecode. Java ME has that facility. So the question you need to ask yourself is: will the amount of security gained from going through this be worth the effort? Even if it comes to nought; it's still a good intellectual exercise and I've got lots of spare time. Regards, Gavin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---