[android-developers] System signing a test suite
I'm writing a testing suite (for personal use only) for my other apps that triggers system intents. I know I need to add android:sharedUserId=android.uid.system to my android manifest in the manifest tag and I need to install my app in / system/app instead of the normal /data/data to have permission to send system broadcast intents. I have root access so that's not a problem. The problem I'm running into is, it appears I also need to sign my app with a system key. Where do I get a system key store, users names, and passwords? I assume I could build my own version of Android and sign it with my own keys, but since I have root access there should be an easier way right? I have a N1 with CM7 and the emulator I'd be fine with keys for either. Thanks. -- 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: Parental Control Applications for Android
I would check out my app, Smart Lock. It is the only Android app that I am aware of that allows you to white list apps that are safe for kids. I'm working on a more comprehensive parental controls solution. I'd love to hear from you. Find out more on my website: www.nightshadelabs.com On Jan 21, 10:37 am, ParentalcontrolApps.com Cell Phone Parental Control jonmi...@gmail.com wrote: Hello, We offer Parental Control Software for Android Cell Phones athttp://www.parentalcontrolapps.com/spy-software. We are interested in representing the best products to our customers. We also have Windows Parental Controlhttp://www.parentalcontrolapps.com/windows-xp/ for Windows users. If you can suggest any that we do not have please let us know so that we can better serve our customers. thanks for your support! ~Jon -- 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: how to detect if a phone is running HTC sense UI
Looks like a good solution for an unfortunate problem David. Anyone know what package is MotoBlur would be? @Dianne I'm using this to instruct the user to change the Lock phone after or the Security lock timer for SenseUI or MotoBlur respectively. I need to use the right terminology. Also these two settings are value added features that break my app, Smart Lock. I'm pretty sure I can't access those custom skin api's. I know my app is a statistical outlier, but I'd call this fragmentation. Thanks, David Shellabarger On Aug 7, 12:50 pm, David david_almi...@yahoo.com wrote: This is how I do it. I would use it sparingly though so you don't bind your app to a particular phone. I really only use it to determine whether or not I should be showing light or dark icons in the notification bar. This seems to work fine with my HTC Incredible and the emulator to determine whether it is there or not. Of course I don't have two home screens installed on my incredible so I don't know what would happen in that case. Hope this helps, David private static final String SENSE_UI_LAUNCHER_NAME = com.htc.launcher.Launcher; private static BooleansenseUI; public static final boolean isSenseUI(Context context) { if (senseUI== null) { senseUI= false; PackageManager packageManager = context.getPackageManager(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); ListResolveInfo list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo info : list) { if (info.activityInfo != null SENSE_UI_LAUNCHER_NAME.equals(info.activityInfo.name)) { senseUI= true; break; } } } returnsenseUI; } -- 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: Apkbuilder problems with new android SDK tools revision 7
I have the exact same problem. I'll check ant_rules_r3.xml for the fix tonight. On Sep 14, 1:10 pm, Xavier Ducrohet x...@android.com wrote: To support library projects properly (with dependencies on library), we've had to change this custom task a bit (also did some clean up). I'd recommend looking at the usage of this task in the new ant rules files (SDK/tools/ant/ant_rules_r3.xml) to see what's missing. Xav On Tue, Sep 14, 2010 at 7:32 AM, Claudio Veas claudio.v...@gmail.com wrote: Hello Group, Im having a problem with my ant task that I use to compile my project. The build.xml that I was using with revision 6 of the SDK stopped working after the upgrade of the SDK tools to revision 7 and I havent been able to figure why this happen, all I know is that certain task attributes where deprecated and some warnings came up but when executig apkbuilder, a NulPointerException is thrown and I have not been able to see why. BTW, I already fixed the warnings of the deprecated tasks so that was not the problem. -package-debug-sign: [apkbuilder] Creating android-build and signing it with a debug key... BUILD FAILED ..\build.xml:349: The following error occurred while executing this line: ..\build.xml:206: java.lang.NullPointerException Line 349 is target name=-package-debug-sign depends=-dex, -package- resources package-helper sign.package=true / -- This one /target and Line 246 is macrodef name=package-helper attribute name=sign.package / element name=extra-jars optional=yes / sequential apkbuilder outfolder=${out.absolute.dir} apkfilepath=${ant.project.name} signed=@{sign.package} verbose=${verbose} -- This one dex path=${intermediate.dex.file}/ sourcefolder path=${source.absolute.dir} / nativefolder path=${native.libs.absolute.dir} / jarfolder path=${external.libs.absolute.dir} / /apkbuilder /sequential /macrodef I really hope you can help me. If you know why revision 7 of the sdk has this problems or at leas if you know how I can go back to revision 6 I would really apreciate ir. Thanks in advance Claudio Veas -- 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 -- Xavier Ducrohet Android SDK Tech Lead Google Inc. Please do not send me questions directly. Thanks! -- 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] SeekBar.OnSeekBarChangeListener only Touch Events
Anybody else find it weird that OnSeekBarChangeListener has a onStartTrackingTouch and a onStopTrackingTouch method but no corresponding non-touch methods? I have a SeekBar that acts as the volume control of the phone. When I slide it I want to play a sound. I only want to play a sound when it stops tacking. I think this is a very common use case for adjusting volume. It works great for touch events; doesn't work at all for tackball events. That's strange. Thanks, David Shellabarger http://www.nightshadelabs.com -- 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: LOCK_PATTERN_ENABLED on API 8 (Froyo)
I'm also interested in this. I can't find anything like LOCK_PASSWORD_ENABLED or LOCK_PIN_ENABLED in the docs. I assume Anybody know if it will be in Gingerbread or if its somewhere else that I'm missing? I've been looking at DevicePolicyManager http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#getPasswordQuality(android.content.ComponentName) It looks like mDPM.getPasswordQuality(null) should work but it doesn't. As far as I can tell getPasswordQuality(admin | null) always returns zero even with the Sample Device Admin enabled. Possible bug? Thanks, David Shellabarger http://www.nightshadelabs.com twitter.com/godsmoon On Jul 22, 3:23 pm, Joseph Earl joseph.w.e...@gmail.com wrote: It is working correctly.LOCK_PATTERN_ENABLEDtells you only about if the lock pattern is enabled. It has nothing to do with the password as far as I am aware. I'm afraid I do not know how to tell if the password lock is enabled or not, a quick scan of the docs didn't reveal anything to me. On Jul 21, 3:29 pm, Nea ehsan@gmail.com wrote: According to the documentation System.Secure.LOCK_PATTERN_ENABLED tells you whether the autolock is enabled or not. If you set a lock pattern it will return true and if you don't set any screen lock it will return false, which is all in order. However on the Android virtual device emulator you could set a screen lock with a pin code or password instead of a lock pattern. But if you set a pin or passwordLOCK_PATTERN_ENABLEDwill return false instead of true. Isn't this a bug? Or is there another way to find out if a screen lock is set or not (independent of it's a lock pattern, pin or password)? This seemingly wrong behaviour has also been discovered on a Motorola Milestone device with Android 2.1 installed. It let's the user set a lock pattern or password as a screen lock, however if a password is setLOCK_PATTERN_ENABLEDwill return false. -- 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: IconPreferenceScreen that extends PreferenceScreen
Yeah I was on that route, but it has unresolved references to PreferenceManager and PreferenceGroupAdapter along with com.android.internal.R. I see a chain here... I don't want to copy 10 classes into my project, but I guess if that's the only reasonable way, then maybe I'll try that again. On Jul 28, 1:24 am, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 28, 2010 at 12:55 AM, GodsMoon godsm...@gmail.com wrote: I can copy that into my project without problem, but I'd like the behavior of the PreferenceScreen instead of just the Preference Class. I could like to click on it to show its children Preferences. I thought it would be a easy to change to make IconPreferenceScreen extend PreferenceScreen instead of Preference, but PreferenceScreen is Final. Why on earth would google make PreferenceScreen a final class? Is there anyway to achieve what I would like to do, short of dividing up my Preference into several other Preferences that all receive intents (That's how the system settings works.) Copy PreferenceScreen into your project. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.9 Available! -- 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] IconPreferenceScreen that extends PreferenceScreen
I would like to have a Preferences activity that has icons like the system settings has had since Eclair. It uses a special Preference called IconPreferenceScreen. Link: http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob;f=src/com/android/settings/IconPreferenceScreen.java I can copy that into my project without problem, but I'd like the behavior of the PreferenceScreen instead of just the Preference Class. I could like to click on it to show its children Preferences. I thought it would be a easy to change to make IconPreferenceScreen extend PreferenceScreen instead of Preference, but PreferenceScreen is Final. Why on earth would google make PreferenceScreen a final class? Is there anyway to achieve what I would like to do, short of dividing up my Preference into several other Preferences that all receive intents (That's how the system settings works.) Thanks for the help, David Shellabarger http://www.nightshadelabs.com -- 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: What is a WeakReference?
I think the difference in the code I've written in the past was I was referring to a window progress bar and not an independent view in the onPostExecute. That's why I was getting a Null Pointer when the activity was killed. I'm starting to get a grasp on this stuff. Clearly I don't know how the GC works. Thanks for the links guys. I'll keep reading. David Shellabarger www.nightshadelabs.com On Jul 22, 5:26 pm, GodsMoon godsm...@gmail.com wrote: Perhaps the difference was because I was declaring my view in the onCreate method instead of in the onPostExecute method of the AsyncTask? If I declare the view in my activity, maybe it gets GCed when my activity is killed, but in the blog post example he tries to declare it in the AsyncTask even though the activity is long gone. Am I on the right track here? David Shellabargerwww.nightshadelabs.com On Jul 22, 4:09 pm, Joseph Earl joseph.w.e...@gmail.com wrote: I am confused somewhat about the issue myself now. Hopefully someone else it will clear it up once and for all. On Jul 22, 9:01 pm, GodsMoon godsm...@gmail.com wrote: I have done something like that and got a null pointer reference. I was starting a AsyncTask and if you backed out of the activity before the AsyncTask was finished I would get a null pointer when I tried to refer to the activities elements (force close). So I just check to see if the views are null first. I thought that if it returned null then it must have been GCed. But that's not the case? David Shellabargerwww.nightshadelabs.com On Jul 22, 3:49 pm, Joseph Earl joseph.w.e...@gmail.com wrote: When your UI activity is killed as far as I am aware the GC will collect your Views. The problem is (I think) if the GC closes your UI thread while the downloader is still running - in this case your downloader thread maintains a reference to the ImageView so the GC cannot collect it - hence memory leak - the downloader thread cannot actually do anything to the ImageView since the UI thread no longer exists. Thus the downloader thread should only store a weak reference to the ImageView so that if the UI thread is killed the GC may reclaim the memory associated with the ImageView. On Jul 22, 8:34 pm, GodsMoon godsm...@gmail.com wrote: The blog post is confusing. Note that this ImageView is stored as a WeakReference, so that a download in progress does not prevent a killed activity's ImageView from being garbage collected. I didn't know that would cause a memory leak. I thought the garbage collector would clean up ImageView if its activity gets killed. Am I wrong? David Shellabargerwww.nightshadelabs.com On Jul 22, 3:06 pm, Joseph Earl joseph.w.e...@gmail.com wrote: No. I'm unsure as to what to use a WeakReference for exactly - as Romain Guy said above it is too weak for this purpose, but I think (hopefully Romain will correct me if I'm wrong) that a SoftReference could be suitable for this purpose. A ListView already does efficient management of your Views by recycling. This means that you must ensure the correct details are set in the view each time getView is called, even if you do not inflate a view or call findViewById that time. Recycling does not mean that the ListView caches all your items or their content. Suppose you had a list of 10 items, all of the same type but only 5 will fit on the screen at a time. The ListView only really needs 5 views to show the rows since the other 5 won't be visible. Thus at the top of the list the ListView might use 'View 1' for the first item, but scroll down to the bottom and 'View 1' would now contain item 6. As far as I understand it this is recycling. Recycling does not take care of the amount time of it takes to get content and set it to the view - thus if it takes a long time to get a piece of information and display it in a list item (such as downloading an image from the web), you will want to cache the result in a way that does not adversely affect memory usage (as much as possible). In this case you will also want to use a Thread or Async task to download/get the info off the UI thread. On Jul 22, 7:36 pm, GodsMoon godsm...@gmail.com wrote: So you'd only want to use WeakReference when you think your activity might run out of memory? But a list view already does efficient memory management for you right? You'd saying if I were create a large array or something like that then it would be good to use WeakReference. right? Thanks for the help guys, David Shellabargerwww.nightshadelabs.com On Jul 22, 2:26 pm, Romain Guy romain...@android.com wrote: You definitely do NOT want to use a WeakReference
[android-developers] What is a WeakReference?
Google just posted a new blog post on http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html. I understand the AsyncTask and I'm even using one in a list with images already. But I don't understand what a WeakReference is. I gather is is a garbage collector directive, but I thought I didn't need to manage garbage collection on Android. http://developer.android.com/reference/java/lang/ref/WeakReference.html isn't as helpful as I was hoping it would be. -- 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: What is a WeakReference?
So you'd only want to use WeakReference when you think your activity might run out of memory? But a list view already does efficient memory management for you right? You'd saying if I were create a large array or something like that then it would be good to use WeakReference. right? Thanks for the help guys, David Shellabarger www.nightshadelabs.com On Jul 22, 2:26 pm, Romain Guy romain...@android.com wrote: You definitely do NOT want to use a WeakReference to cache object. If you do so, as soon as your data is put in the cache and not used outside of the cache, it gets garbage collected. On Thu, Jul 22, 2010 at 11:07 AM, Joseph Earl joseph.w.e...@gmail.com wrote: Suppose you had a long list of images. As the user scrolled down you load the images from the net, and then display them. To avoid having to reload the images again if the user scrolls back up, you put the images in a cache (probably something like a MapString, Drawable) However because it is a long list you don't want to run into an out of memory situation if the user scrolls very far down and lots of images are put in the cache. So instead of storing the Drawables directly in the map, you create a MapString, WeakReferenceType (although I would use SoftReference for the purpose described here). This means that if Android is going to encounter an out of memory situation it will clear all of the Soft/Weak references (and thus hopefully avoid running out of memory). You will have to load the images again since your cache has been cleared, but this is far better than your application running out of memory and crashing. So you do something like: // caching an image MapString, SoftReference cache = new HashMapString, SoftReferenceDrawable(); cache.put(http://mysite.com/images/1.jpg;, new SoftReferenceDrawable.put(myDrawable)); // retrieve an image if (cache.containsKey(url)) { // looks like we have this image cached Drawable drawable = cache.get(url).get(); if (drawable == null) { // the softreference has been cleared by the GC, reload the image } else { // softreference is still valid, got our image } } Essentially a weak reference is a weaker reference than a soft reference - the GC should free weak references to regain memory before soft references. I think that's (mostly) correct, hope it helps. On Jul 22, 6:48 pm, GodsMoon godsm...@gmail.com wrote: Google just posted a new blog post onhttp://android-developers.blogspot.com/2010/07/multithreading-for-per I understand the AsyncTask and I'm even using one in a list with images already. But I don't understand what a WeakReference is. I gather is is a garbage collector directive, but I thought I didn't need to manage garbage collection on Android. http://developer.android.com/reference/java/lang/ref/WeakReference.html isn't as helpful as I was hoping it would be. -- 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 -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- 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: What is a WeakReference?
The blog post is confusing. Note that this ImageView is stored as a WeakReference, so that a download in progress does not prevent a killed activity's ImageView from being garbage collected. I didn't know that would cause a memory leak. I thought the garbage collector would clean up ImageView if its activity gets killed. Am I wrong? David Shellabarger www.nightshadelabs.com On Jul 22, 3:06 pm, Joseph Earl joseph.w.e...@gmail.com wrote: No. I'm unsure as to what to use a WeakReference for exactly - as Romain Guy said above it is too weak for this purpose, but I think (hopefully Romain will correct me if I'm wrong) that a SoftReference could be suitable for this purpose. A ListView already does efficient management of your Views by recycling. This means that you must ensure the correct details are set in the view each time getView is called, even if you do not inflate a view or call findViewById that time. Recycling does not mean that the ListView caches all your items or their content. Suppose you had a list of 10 items, all of the same type but only 5 will fit on the screen at a time. The ListView only really needs 5 views to show the rows since the other 5 won't be visible. Thus at the top of the list the ListView might use 'View 1' for the first item, but scroll down to the bottom and 'View 1' would now contain item 6. As far as I understand it this is recycling. Recycling does not take care of the amount time of it takes to get content and set it to the view - thus if it takes a long time to get a piece of information and display it in a list item (such as downloading an image from the web), you will want to cache the result in a way that does not adversely affect memory usage (as much as possible). In this case you will also want to use a Thread or Async task to download/get the info off the UI thread. On Jul 22, 7:36 pm, GodsMoon godsm...@gmail.com wrote: So you'd only want to use WeakReference when you think your activity might run out of memory? But a list view already does efficient memory management for you right? You'd saying if I were create a large array or something like that then it would be good to use WeakReference. right? Thanks for the help guys, David Shellabargerwww.nightshadelabs.com On Jul 22, 2:26 pm, Romain Guy romain...@android.com wrote: You definitely do NOT want to use a WeakReference to cache object. If you do so, as soon as your data is put in the cache and not used outside of the cache, it gets garbage collected. On Thu, Jul 22, 2010 at 11:07 AM, Joseph Earl joseph.w.e...@gmail.com wrote: Suppose you had a long list of images. As the user scrolled down you load the images from the net, and then display them. To avoid having to reload the images again if the user scrolls back up, you put the images in a cache (probably something like a MapString, Drawable) However because it is a long list you don't want to run into an out of memory situation if the user scrolls very far down and lots of images are put in the cache. So instead of storing the Drawables directly in the map, you create a MapString, WeakReferenceType (although I would use SoftReference for the purpose described here). This means that if Android is going to encounter an out of memory situation it will clear all of the Soft/Weak references (and thus hopefully avoid running out of memory). You will have to load the images again since your cache has been cleared, but this is far better than your application running out of memory and crashing. So you do something like: // caching an image MapString, SoftReference cache = new HashMapString, SoftReferenceDrawable(); cache.put(http://mysite.com/images/1.jpg;, new SoftReferenceDrawable.put(myDrawable)); // retrieve an image if (cache.containsKey(url)) { // looks like we have this image cached Drawable drawable = cache.get(url).get(); if (drawable == null) { // the softreference has been cleared by the GC, reload the image } else { // softreference is still valid, got our image } } Essentially a weak reference is a weaker reference than a soft reference - the GC should free weak references to regain memory before soft references. I think that's (mostly) correct, hope it helps. On Jul 22, 6:48 pm, GodsMoon godsm...@gmail.com wrote: Google just posted a new blog post onhttp://android-developers.blogspot.com/2010/07/multithreading-for-per I understand the AsyncTask and I'm even using one in a list with images already. But I don't understand what a WeakReference is. I gather is is a garbage collector directive, but I thought I didn't need to manage garbage collection on Android. http://developer.android.com/reference/java/lang/ref/WeakReference.html isn't as helpful as I was hoping
[android-developers] Re: What is a WeakReference?
I have done something like that and got a null pointer reference. I was starting a AsyncTask and if you backed out of the activity before the AsyncTask was finished I would get a null pointer when I tried to refer to the activities elements (force close). So I just check to see if the views are null first. I thought that if it returned null then it must have been GCed. But that's not the case? David Shellabarger www.nightshadelabs.com On Jul 22, 3:49 pm, Joseph Earl joseph.w.e...@gmail.com wrote: When your UI activity is killed as far as I am aware the GC will collect your Views. The problem is (I think) if the GC closes your UI thread while the downloader is still running - in this case your downloader thread maintains a reference to the ImageView so the GC cannot collect it - hence memory leak - the downloader thread cannot actually do anything to the ImageView since the UI thread no longer exists. Thus the downloader thread should only store a weak reference to the ImageView so that if the UI thread is killed the GC may reclaim the memory associated with the ImageView. On Jul 22, 8:34 pm, GodsMoon godsm...@gmail.com wrote: The blog post is confusing. Note that this ImageView is stored as a WeakReference, so that a download in progress does not prevent a killed activity's ImageView from being garbage collected. I didn't know that would cause a memory leak. I thought the garbage collector would clean up ImageView if its activity gets killed. Am I wrong? David Shellabargerwww.nightshadelabs.com On Jul 22, 3:06 pm, Joseph Earl joseph.w.e...@gmail.com wrote: No. I'm unsure as to what to use a WeakReference for exactly - as Romain Guy said above it is too weak for this purpose, but I think (hopefully Romain will correct me if I'm wrong) that a SoftReference could be suitable for this purpose. A ListView already does efficient management of your Views by recycling. This means that you must ensure the correct details are set in the view each time getView is called, even if you do not inflate a view or call findViewById that time. Recycling does not mean that the ListView caches all your items or their content. Suppose you had a list of 10 items, all of the same type but only 5 will fit on the screen at a time. The ListView only really needs 5 views to show the rows since the other 5 won't be visible. Thus at the top of the list the ListView might use 'View 1' for the first item, but scroll down to the bottom and 'View 1' would now contain item 6. As far as I understand it this is recycling. Recycling does not take care of the amount time of it takes to get content and set it to the view - thus if it takes a long time to get a piece of information and display it in a list item (such as downloading an image from the web), you will want to cache the result in a way that does not adversely affect memory usage (as much as possible). In this case you will also want to use a Thread or Async task to download/get the info off the UI thread. On Jul 22, 7:36 pm, GodsMoon godsm...@gmail.com wrote: So you'd only want to use WeakReference when you think your activity might run out of memory? But a list view already does efficient memory management for you right? You'd saying if I were create a large array or something like that then it would be good to use WeakReference. right? Thanks for the help guys, David Shellabargerwww.nightshadelabs.com On Jul 22, 2:26 pm, Romain Guy romain...@android.com wrote: You definitely do NOT want to use a WeakReference to cache object. If you do so, as soon as your data is put in the cache and not used outside of the cache, it gets garbage collected. On Thu, Jul 22, 2010 at 11:07 AM, Joseph Earl joseph.w.e...@gmail.com wrote: Suppose you had a long list of images. As the user scrolled down you load the images from the net, and then display them. To avoid having to reload the images again if the user scrolls back up, you put the images in a cache (probably something like a MapString, Drawable) However because it is a long list you don't want to run into an out of memory situation if the user scrolls very far down and lots of images are put in the cache. So instead of storing the Drawables directly in the map, you create a MapString, WeakReferenceType (although I would use SoftReference for the purpose described here). This means that if Android is going to encounter an out of memory situation it will clear all of the Soft/Weak references (and thus hopefully avoid running out of memory). You will have to load the images again since your cache has been cleared, but this is far better than your application running out of memory and crashing. So you do something like: // caching
[android-developers] Re: What is a WeakReference?
Perhaps the difference was because I was declaring my view in the onCreate method instead of in the onPostExecute method of the AsyncTask? If I declare the view in my activity, maybe it gets GCed when my activity is killed, but in the blog post example he tries to declare it in the AsyncTask even though the activity is long gone. Am I on the right track here? David Shellabarger www.nightshadelabs.com On Jul 22, 4:09 pm, Joseph Earl joseph.w.e...@gmail.com wrote: I am confused somewhat about the issue myself now. Hopefully someone else it will clear it up once and for all. On Jul 22, 9:01 pm, GodsMoon godsm...@gmail.com wrote: I have done something like that and got a null pointer reference. I was starting a AsyncTask and if you backed out of the activity before the AsyncTask was finished I would get a null pointer when I tried to refer to the activities elements (force close). So I just check to see if the views are null first. I thought that if it returned null then it must have been GCed. But that's not the case? David Shellabargerwww.nightshadelabs.com On Jul 22, 3:49 pm, Joseph Earl joseph.w.e...@gmail.com wrote: When your UI activity is killed as far as I am aware the GC will collect your Views. The problem is (I think) if the GC closes your UI thread while the downloader is still running - in this case your downloader thread maintains a reference to the ImageView so the GC cannot collect it - hence memory leak - the downloader thread cannot actually do anything to the ImageView since the UI thread no longer exists. Thus the downloader thread should only store a weak reference to the ImageView so that if the UI thread is killed the GC may reclaim the memory associated with the ImageView. On Jul 22, 8:34 pm, GodsMoon godsm...@gmail.com wrote: The blog post is confusing. Note that this ImageView is stored as a WeakReference, so that a download in progress does not prevent a killed activity's ImageView from being garbage collected. I didn't know that would cause a memory leak. I thought the garbage collector would clean up ImageView if its activity gets killed. Am I wrong? David Shellabargerwww.nightshadelabs.com On Jul 22, 3:06 pm, Joseph Earl joseph.w.e...@gmail.com wrote: No. I'm unsure as to what to use a WeakReference for exactly - as Romain Guy said above it is too weak for this purpose, but I think (hopefully Romain will correct me if I'm wrong) that a SoftReference could be suitable for this purpose. A ListView already does efficient management of your Views by recycling. This means that you must ensure the correct details are set in the view each time getView is called, even if you do not inflate a view or call findViewById that time. Recycling does not mean that the ListView caches all your items or their content. Suppose you had a list of 10 items, all of the same type but only 5 will fit on the screen at a time. The ListView only really needs 5 views to show the rows since the other 5 won't be visible. Thus at the top of the list the ListView might use 'View 1' for the first item, but scroll down to the bottom and 'View 1' would now contain item 6. As far as I understand it this is recycling. Recycling does not take care of the amount time of it takes to get content and set it to the view - thus if it takes a long time to get a piece of information and display it in a list item (such as downloading an image from the web), you will want to cache the result in a way that does not adversely affect memory usage (as much as possible). In this case you will also want to use a Thread or Async task to download/get the info off the UI thread. On Jul 22, 7:36 pm, GodsMoon godsm...@gmail.com wrote: So you'd only want to use WeakReference when you think your activity might run out of memory? But a list view already does efficient memory management for you right? You'd saying if I were create a large array or something like that then it would be good to use WeakReference. right? Thanks for the help guys, David Shellabargerwww.nightshadelabs.com On Jul 22, 2:26 pm, Romain Guy romain...@android.com wrote: You definitely do NOT want to use a WeakReference to cache object. If you do so, as soon as your data is put in the cache and not used outside of the cache, it gets garbage collected. On Thu, Jul 22, 2010 at 11:07 AM, Joseph Earl joseph.w.e...@gmail.com wrote: Suppose you had a long list of images. As the user scrolled down you load the images from the net, and then display them. To avoid having to reload the images again if the user scrolls back up, you put the images in a cache (probably something like a MapString, Drawable
[android-developers] Re: Any chance to deactivate the lock pattern in Froyo from code?
@Anders and @Brad Gies, If you are frustrated with not having a lock timer, I'd suggest checking out Smart Lock. Its a good alternative while we wait for Google to make the lock screen situation better. Smart Lock lets you use one app, and only one app at a time, without unlocking your phone. It dismissed the lock screen until your try to change apps and then it locks. Its also works really well as a Child Lock for your phone. It uses an API that will work for the foreseeable future as long as you aren't using an Exchange Server (or other server that uses a device admin). Hopefully, Google will do more to address the lock screen annoyance issue, but in the mean time you can use Smart Lock. :) David Shellabarger www.nightshadelabs.com Creator of Smart Lock On Jul 9, 3:22 pm, Frank Weiss fewe...@gmail.com wrote: Although I agree with you, I think you've misposted. It is not an SDK issue. -- 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: problem accessing widget in Preference widgetLayout
I think you need to do findPreference instead of findViewById. so like: ib = (Preference) findPreference(displayimagekey); Hope that helps. On Jun 1, 3:20 pm, Noah noah.belc...@gmail.com wrote: Did you ever get this resolved? I'm having the same problem. Thanks On Apr 18, 1:27 am, hacksoft hacks...@gmail.com wrote: Hi, I can't seem to get a handle to the embedded widget (via widgetLayout) in my preference. My Preference XML is: PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android; android:key=first_preferencescreen EditTextPreference android:key=displayname android:title=Display Name android:summary=Choose a display name / Preference android:id=@+id/displayimageview android:key=displayimagekey android:title=Display Image android:summary=Select Display Image android:widgetLayout=@layout/displayimage / /PreferenceScreen My widget XML is: LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal ImageButton android:id=@+id/displayimagebutton android:layout_width=wrap_content android:layout_height=wrap_content android:padding=1dp / /LinearLayout I'm trying to get a handle on the displayimagebutton to embed an ImageButton in a preference row. My java code is: View v1 = null; v1 = findViewById(R.layout.preferences); ImageButton ib = null; if (v1 == null) Log.d(SUBSYSTEM_TAG, v1 = null); else { ib = (ImageButton)v1.findViewById(R.id.displayimagebutton); } I can't seem to get a view to the preferences I setup in preferences.xml. in my OnCreate() I'm calling: addPreferencesFromResource(R.layout.preferences); and this seems to work fine since the preferences layout is represented on the screen. However I can't get a View to this layout as my java code is trying above, so I can find the embedded widget. I've tried: v1 = findViewById(R.id.displayimageview); but that just returns null also. Any ideas on how I can get the ImageButton reference to my displayimagebutton? I'm really disappointed on the lack of an Android example for this. Thanks! John Roberts -- 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 athttp://groups.google.com/group/android-developers?hl=en -- 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] Detecting button type of front nav keys
I posted this on Stack Overflow and didn't get an answer. Anybody here have an answer? I would like to detect if the navigation keys of the front of the phone (Home,Menu,Back,Search) are hard-keys (ex. G1) or soft-keys (ex. Nexus One). This api http://d.android.com/reference/android/content/res/Configuration.html#keyboard gets close but is related to the keyboard and not the front facing keys. KeyEvent (http://d.android.com/reference/android/view/KeyEvent.html) has a FLAG_VIRTUAL_HARD_KEY flag, I can only detect that after the key is pressed. I'd like to find out what type of buttons the user has without asking the user to press a key first. I would have expected such an api to be under http://d.android.com/reference/android/hardware/package-summary.html but android.hardware has very little info about the actual hardware of the device. -- 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] Detecting button type of front nav keys
I asked this on stackoverflow but I didn't get an answer: http://stackoverflow.com/questions/3241739/detecting-button-type-of-front-nav-keys Can anybody help me out? I would like to detect if the navigation keys of the front of the phone (Home,Menu,Back,Search) are hard-keys (ex. G1) or soft-keys (ex. Nexus One). This api http://d.android.com/referenc/android/content/res/Configuration.html#keyboard gets close but is related to the keyboard and not the front facing keys. KeyEvent (http://d.android.com/reference/android/view/KeyEvent.html) has a FLAG_VIRTUAL_HARD_KEY flag, I can only detect that after the key is pressed. I'd like to find out what type of buttons the user has without asking the user to press a key first. I would have expected such an api to be under http://d.android.com/referenc/android/hardware/package-summary.html but android.hardware has very little info about the actual hardware of the device. -- 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: Detecting button type of front nav keys
Sorry dup. please ignore. Google Groups is acting strangely for me. There is not a link to this post from my profile page... On Jul 14, 3:06 pm, GodsMoon godsm...@gmail.com wrote: I asked this on stackoverflow but I didn't get an answer:http://stackoverflow.com/questions/3241739/detecting-button-type-of-f... Can anybody help me out? I would like to detect if the navigation keys of the front of the phone (Home,Menu,Back,Search) are hard-keys (ex. G1) or soft-keys (ex. Nexus One). This apihttp://d.android.com/referenc/android/content/res/Configuration.html#... gets close but is related to the keyboard and not the front facing keys. KeyEvent (http://d.android.com/reference/android/view/KeyEvent.html) has a FLAG_VIRTUAL_HARD_KEY flag, I can only detect that after the key is pressed. I'd like to find out what type of buttons the user has without asking the user to press a key first. I would have expected such an api to be underhttp://d.android.com/referenc/android/hardware/package-summary.html but android.hardware has very little info about the actual hardware of the device. -- 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: Detecting button type of front nav keys
Dianne Hackborn, Unfortunate. I would recommend adding an api detailing what kind of hardware is available especially since Android runs on such deserve hardware. Should I file a bug report? Thanks for the response though. David Shellabarger http://www.nightshadelabs.com http://twitter.com/godsmoon On Jul 14, 1:04 pm, Dianne Hackborn hack...@android.com wrote: What you describe is all there is. On Wed, Jul 14, 2010 at 9:04 AM, GodsMoon godsm...@gmail.com wrote: I posted this on Stack Overflow and didn't get an answer. Anybody here have an answer? I would like to detect if the navigation keys of the front of the phone (Home,Menu,Back,Search) are hard-keys (ex. G1) or soft-keys (ex. Nexus One). This api http://d.android.com/reference/android/content/res/Configuration.html... gets close but is related to the keyboard and not the front facing keys. KeyEvent (http://d.android.com/reference/android/view/KeyEvent.html) has a FLAG_VIRTUAL_HARD_KEY flag, I can only detect that after the key is pressed. I'd like to find out what type of buttons the user has without asking the user to press a key first. I would have expected such an api to be under http://d.android.com/reference/android/hardware/package-summary.html but android.hardware has very little info about the actual hardware of the device. -- 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.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com 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. -- 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: Mimic Home button in software
Oh. That is important information! My app, Smart Lock, manipulates the Keyguard a lot. That's the main feature actually. To clarify, who is a device admin? On Jun 20, 12:22 am, Dianne Hackborn hack...@android.com wrote: Ah. Replacing the lock screen and such is not at this point supported. You may figure out a hack to do what you want, but we can't guarantee it will work on future versions of the platform or even across devices. The disableKeyguard method was original introduced for very specific situations such as showing the in-call screen while the device is locked. It has a lot of problems, and is becoming deprecated -- we have been introducing new window flags that provide a much better way to interact with the lock screen for the uses that disableKeyguard was originally done for. Also you will start to find that the method doesn't work in some situations. For example starting in Froyo it will not work when a device admin is requiring the user have a lock screen, since disabling uncontrollably (not using one of the newer window flags) would conflict with the security the admin is enforcing. On Sat, Jun 19, 2010 at 6:10 PM, GodsMoon godsm...@gmail.com wrote: Sorry, my app disables the keyguard with disableKeyguard(). This makes inKeyguardRestrictedInputMode() return true so clicking on the home button brings up the lock screen (the special one without the Emergency Call button). I would like to see this lock screen when pressing the back button. Actually, I just want to know how to bring up that special lock screen on demand. I know it comes up with the home button so I was going to try to mimic that. Thanks for your help, David Shellabarger On Jun 19, 5:40 pm, Dianne Hackborn hack...@android.com wrote: I'm not sure I understand... if you want to switch to home from your app (which I am pretty sure the intent you give below is the right way), what would this have to do with the keyguard? If the user is in your app, they aren't in the keyguard... I don't understand the connection you have between the two. On Sat, Jun 19, 2010 at 11:03 AM, GodsMoon godsm...@gmail.com wrote: I would like the back button to work exactly like the home button in my activity. I know that doesn't sounds like something I would want to do, but it makes sense in the context of my app. I've tried an intent: Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.addCategory(Intent.CATEGORY_HOME); startActivity(intent); But this doesn't work the same way. I've tried super.onKeyDown(KeyEvent.KEYCODE_HOME, event); on the onKeyDown method and it does nothing. They problem is the keyguard acts different when you push the home button when you have an unlock pattern set. There is usually a Emergency Call button on the unlock pattern screen, but there is not when you click the home button and you have dismissed the keyguard. I would like the back button to behave the same way. Would I be able to do this with the instrument class? Is there a better way to do 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.comandroid-developers%2Bunsubs cr...@googlegroups.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com 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. -- 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.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com 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. -- 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
[android-developers] Mimic Home button in software
I would like the back button to work exactly like the home button in my activity. I know that doesn't sounds like something I would want to do, but it makes sense in the context of my app. I've tried an intent: Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.addCategory(Intent.CATEGORY_HOME); startActivity(intent); But this doesn't work the same way. I've tried super.onKeyDown(KeyEvent.KEYCODE_HOME, event); on the onKeyDown method and it does nothing. They problem is the keyguard acts different when you push the home button when you have an unlock pattern set. There is usually a Emergency Call button on the unlock pattern screen, but there is not when you click the home button and you have dismissed the keyguard. I would like the back button to behave the same way. Would I be able to do this with the instrument class? Is there a better way to do 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: Mimic Home button in software
Sorry, my app disables the keyguard with disableKeyguard(). This makes inKeyguardRestrictedInputMode() return true so clicking on the home button brings up the lock screen (the special one without the Emergency Call button). I would like to see this lock screen when pressing the back button. Actually, I just want to know how to bring up that special lock screen on demand. I know it comes up with the home button so I was going to try to mimic that. Thanks for your help, David Shellabarger On Jun 19, 5:40 pm, Dianne Hackborn hack...@android.com wrote: I'm not sure I understand... if you want to switch to home from your app (which I am pretty sure the intent you give below is the right way), what would this have to do with the keyguard? If the user is in your app, they aren't in the keyguard... I don't understand the connection you have between the two. On Sat, Jun 19, 2010 at 11:03 AM, GodsMoon godsm...@gmail.com wrote: I would like the back button to work exactly like the home button in my activity. I know that doesn't sounds like something I would want to do, but it makes sense in the context of my app. I've tried an intent: Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.addCategory(Intent.CATEGORY_HOME); startActivity(intent); But this doesn't work the same way. I've tried super.onKeyDown(KeyEvent.KEYCODE_HOME, event); on the onKeyDown method and it does nothing. They problem is the keyguard acts different when you push the home button when you have an unlock pattern set. There is usually a Emergency Call button on the unlock pattern screen, but there is not when you click the home button and you have dismissed the keyguard. I would like the back button to behave the same way. Would I be able to do this with the instrument class? Is there a better way to do 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.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com 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. -- 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: Mimic Home button in software
special lockscreen looks like this btw http://nightshadelabs.appspot.com/static/lockscreen.png On Jun 19, 9:10 pm, GodsMoon godsm...@gmail.com wrote: Sorry, my app disables the keyguard with disableKeyguard(). This makes inKeyguardRestrictedInputMode() return true so clicking on the home button brings up the lock screen (the special one without the Emergency Call button). I would like to see this lock screen when pressing the back button. Actually, I just want to know how to bring up that special lock screen on demand. I know it comes up with the home button so I was going to try to mimic that. Thanks for your help, David Shellabarger On Jun 19, 5:40 pm, Dianne Hackborn hack...@android.com wrote: I'm not sure I understand... if you want to switch to home from your app (which I am pretty sure the intent you give below is the right way), what would this have to do with the keyguard? If the user is in your app, they aren't in the keyguard... I don't understand the connection you have between the two. On Sat, Jun 19, 2010 at 11:03 AM, GodsMoon godsm...@gmail.com wrote: I would like the back button to work exactly like the home button in my activity. I know that doesn't sounds like something I would want to do, but it makes sense in the context of my app. I've tried an intent: Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.addCategory(Intent.CATEGORY_HOME); startActivity(intent); But this doesn't work the same way. I've tried super.onKeyDown(KeyEvent.KEYCODE_HOME, event); on the onKeyDown method and it does nothing. They problem is the keyguard acts different when you push the home button when you have an unlock pattern set. There is usually a Emergency Call button on the unlock pattern screen, but there is not when you click the home button and you have dismissed the keyguard. I would like the back button to behave the same way. Would I be able to do this with the instrument class? Is there a better way to do 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.comandroid-developers%2Bunsubs cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com 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. -- 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: Janky Custom Cursor Adapter
It looks like the Twitter app does AsyncTask correctly in a list view. Can't wait for it to be open sources! On May 25, 4:53 pm, GodsMoon godsm...@gmail.com wrote: Ah! I didn't see put(String key, byte[] value) before in ContentValues. That will probably work. Thanks for the info and the link! Would still like to do know how to do AsyncTask in a custom adapter for future reference but I think your solution will work. On May 25, 9:29 am, blcooley blcoo...@gmail.com wrote: A Cursor returned by a SQLiteDatabase query can indeed get a blob. http://developer.android.com/reference/android/database/Cursor.html#g...) http://www.tutorialforandroid.com/2009/10/how-to-insert-image-data-to... On May 24, 11:16 pm, GodsMoon godsm...@gmail.com wrote: However, I can't store the application icon in the db because sqlite doesn't support blobs. -- 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 athttp://groups.google.com/group/android-developers?hl=en -- 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: Janky Custom Cursor Adapter
Ah! I didn't see put(String key, byte[] value) before in ContentValues. That will probably work. Thanks for the info and the link! Would still like to do know how to do AsyncTask in a custom adapter for future reference but I think your solution will work. On May 25, 9:29 am, blcooley blcoo...@gmail.com wrote: A Cursor returned by a SQLiteDatabase query can indeed get a blob. http://developer.android.com/reference/android/database/Cursor.html#g...) http://www.tutorialforandroid.com/2009/10/how-to-insert-image-data-to... On May 24, 11:16 pm, GodsMoon godsm...@gmail.com wrote: However, I can't store the application icon in the db because sqlite doesn't support blobs. -- 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 athttp://groups.google.com/group/android-developers?hl=en -- 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] Janky Custom Cursor Adapter
I have a Custom Cursor Adapter. It shows a list of installed applications with an icon, name and checkbox on each line item. I cache the list of applications in a database for faster retrieve and to store the state of the checkbox. However, I can't store the application icon in the db because sqlite doesn't support blobs. They list works rather well except that it is janky as described by Brad Fitzpatrick at Google IO (https://wave.google.com/wave/waveref/ googlewave.com/w+3kgmObZwO ). I'm trying to make my app non-janky by following the tutorial here: http://github.com/bradfitz/zippy-android-talk/blob/master/src/com/google/io2010/zippy/JankableListAdapter.java but I'm having trouble. The reason my list is janky is because I look up each icon as you scroll down the list. drawable = pm.getApplicationIcon(c.getString(c.getColumnIndex(SmartLockDbAdapter.KEY_PACKAGE))); getApplicationIcon takes too long to return to make for a smooth scrolling list. I would like to perform the action in the background with an AsyncTask but because bindView gets called repeatedly in a short time span, my icons end up with the wrong list item. I need help. I've posted my whole ListActivity below in hopes that it helps other people. It's much harder to find an example of a working CursorAdapter then it is an ArrayAdapter. PS if you have any other notes about how I could do things better please let me know. public class AppList extends ListActivity { private static final boolean DEBUG = true; private static final int MENU_ALL_APPS = 2; private static final int MENU_APPROVED_APPS = 1; public static SmartLockDbAdapter mDbHelper; private Cursor cursor; LayoutInflater inflater; ProgressDialog dialog; CheckBoxAdapter mAdapter; Activity activity; private AutoCompleteTextView filterText; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity = this; activity.requestWindowFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.app_list); mDbHelper = new SmartLockDbAdapter(this); mDbHelper.open(); new populateDb().execute(this); cursor = mDbHelper.fetchAllApps(); startManagingCursor(cursor); mAdapter = new CheckBoxAdapter(this, cursor); setListAdapter(mAdapter); startManagingCursor(cursor); filterText = (AutoCompleteTextView) findViewById(R.id.search_box); filterText.setAdapter(mAdapter); filterText.setDropDownHeight(0); // hide the drop down, just filter the listActivity filterText.setThreshold(1); } private class populateDb extends AsyncTaskContext, Integer, Long { protected Long doInBackground(Context... context) { PackageManager pm = getPackageManager(); SmartLockDbAdapter mDbHelper = new SmartLockDbAdapter(context[0]); mDbHelper.open(); Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); ListResolveInfo mApps; mApps = getPackageManager().queryIntentActivities(mainIntent, 0); int count = mApps.size(); for (int index=0; indexcount; index++) { ResolveInfo content = mApps.get(index); // put in while loop to prevent db locking while(!mDbHelper.updateApp((String) pm.getApplicationLabel(content.activityInfo.applicationInfo), content.activityInfo.packageName, 1)) { Log.v(GoldFishView, Conflict Resolving ); try { Thread.sleep((long) 1000); } catch (InterruptedException e) { e.printStackTrace(); } } publishProgress((int) ((index / (float) count) * 1)); // scale is 1..1 } return null; } protected void onProgressUpdate(Integer... progress) { activity.getWindow().setFeatureInt(Window.FEATURE_PROGRESS, progress[0]); } protected void onPostExecute(Long result) { activity.getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_END);//go away activity.getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_OFF); mAdapter.getCursor().requery(); //
[android-developers] Settings Intent in Sense UI
I'm trying to link to the settings menu. The following code works great for stock Android but doesn't work in the 2.1 HTC Sense UI. Intent goToSettings = new Intent(Settings.ACTION_LOCALE_SETTINGS); goToSettings.setComponent(new ComponentName(com.android.settings,com.android.settings.SecuritySettings)); startActivity(goToSettings); On the HTC Legend that code gives the following Error in the LogCat E/AndroidRuntime( 626): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.settings/ com.android.settings.SecuritySettings}; have you declared this activity in your AndroidManifest.xml? I don't have a phone with the HTC Senese UI. How do I link to settings menu on the HTC Legend? Thanks David Shellabarger www.goldfishview.com twitter.com/godsmoon -- 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 To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Settings Intent in Sense UI
I was actually looking for Settings.ACTION_SECURITY_SETTINGS but your comment lead me right to it. Thanks. On Apr 10, 5:36 pm, Mark Murphy mmur...@commonsware.com wrote: GodsMoon wrote: I'm trying to link to the settings menu. The following code works great for stock Android but doesn't work in the 2.1 HTC Sense UI. Intent goToSettings = new Intent(Settings.ACTION_LOCALE_SETTINGS); goToSettings.setComponent(new ComponentName(com.android.settings,com.android.settings.SecuritySettings )); startActivity(goToSettings); On the HTC Legend that code gives the following Error in the LogCat E/AndroidRuntime( 626): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.settings/ com.android.settings.SecuritySettings}; have you declared this activity in your AndroidManifest.xml? I don't have a phone with the HTC Senese UI. How do I link to settings menu on the HTC Legend? Try getting rid of the setComponent() call. The ACTION_LOCALE_SETTINGS should be sufficient, and will cover you in case they renamed the class. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android Development Wiki:http://wiki.andmob.org -- 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 To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Reusable Android library packaging: interest?
To be honest, I would prefer to be able to specify package dependencies, much like linux distros do. That way I wouldn't have to bloat my app with source from other libs and I would make a non open source app a dependency even. However, I don't think we can do that without Google getting involved. I haven't yet tried to bundle a any libs in my APK's but I am planning on doing that soon. You make it sound like it is quite a hassle to do so. I'm always interesting in things that make my life easier. David Shellabarger http://www.goldfishview.com On Mar 29, 10:19 am, Mark Murphy mmur...@commonsware.com wrote: Creating Android JARs is fairly easy...so long as all you want to do is ship Java code. If your Java code needs resources or assets, or offers up activities or services, then you have to ship a JAR plus a whole bunch of other stuff. And the person reusing your JAR would need to know about all that other stuff, find it, download it into the right spots, etc. The only way that is somewhat convenient for the developers is to package this stuff into separate APKs...which is inconvenient for the users. IMHO, that's one of the reasons why we don't have a robust collection of third-party widgets or other libraries. There are few recipes for creating such things, no standards or conventions for how to consume them, and no home for them to live. At least, I am not aware of much in this area -- please correct me if I've missed something. I've been working on a solution for all of that, or as good of a solution as I can create given some of the peculiarities of Android's build tools. Before I invest much more time, though, I need to know if anyone really cares. Suppose you found out about...say...a calendar widget you wanted for integration in your app. You might have found it from a Web-based catalog of components, or from a search engine query, or a StackOverflow answer, or whatever. To download that calendar widget, you would run: parcel install name where name is the unique identifier for this widget. That would download the widget to your development machine, plus download any dependent libraries. To use that widget in one of your Android projects, you would run: parcel inject name from the project base directory. This would: -- copy the JAR file(s) into libs/ -- copy the resource(s) into res/ -- merge in key elements (e.g., activities) into AndroidManifest.xml -- copy documentation and other stuff into parcels/name -- do all of the above for all dependencies as well If you write a calendar widget and want to make a parcel for others to reuse, there would be: parcel package name ... where you specify the parcel to create and all the stuff that should go in it (JARs, resources, source code, documentation, etc.). You could wrap this up in an Ant task or Maven plugin or Eclipse, um, thingy, if you wished to integrate this as part of a build process. There's more to it, but this should give you the feel for what I have in mind. It is modeled loosely after RubyGems and Rails vendor plugins, two of the more successful examples of this pattern in use today. If this is something you would like to see, please reply to this message, or tweet me (@commonsguy), to let me know of your interest. If I release this, I'll be committing a fair chunk of time to helping to maintain it, and I don't want to make that commitment until I have a sense that enough people will care. I am, of course, certainly open to other ideas, suggestions, Googly input, etc. :-) Thanks in advance! -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-developers] ADC2 Results Post
Since the Android Challenge Group seems to be closed I'll post here. What results did you get from Google? -- 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: Home Screen Detection
Hong, I hope you like it. If you have any issues please email me :) On Sep 24, 4:03 pm, Hong lordh...@gmail.com wrote: My 1st ADC 2 judging app is Smart Lock ^_^ interesting! On Tue, Sep 15, 2009 at 7:57 PM, GodsMoon godsm...@gmail.com wrote: ping... On Sep 8, 4:02 pm, GodsMoon godsm...@gmail.com wrote: Dianne, I've published a video to give you a better idea of the problem I'm having with the back button protection. Hopefully my video helps show the problem I am having.http://www.youtube.com/watch?v=ipue9Yhi5VA The bug I mention in the video is NOT the bug report I filed out but ratherhttp://code.google.com/p/android/issues/detail?id=2643 Anyway, does this give any more credence to My bug report? Also, I'm not abusing the API, am I? I would guess that the KeyguardManager was not designed to be triggered with a background processes, but a lot of people are quite interested in my app and I'm excited to release it soon. Thanks for the input, David Shellabarger On Sep 3, 5:39 pm, Hong lordh...@gmail.com wrote: I found the video:http://www.youtube.com/watch?v=ipue9Yhi5VA NICE WORK! On Sat, Aug 29, 2009 at 9:23 PM, GodsMoon godsm...@gmail.com wrote: I admit that what I'm trying to do is a little unorthodox and somewhat creative. The idea I have does slightly change the way security works on the phone. However, I don't think I'm abusing the API or decreasing security. Its somewhat hard to explain my app idea. I will be releasing a video of my app in action for the ADC2 fairly soon. I'll post back here once it is released the video. I'd love to get feedback to make sure I'm not doing anything I'm not suppose to. Thanks for your help. --~--~-~--~~~---~--~~ 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: Home Screen Detection
ping... On Sep 8, 4:02 pm, GodsMoon godsm...@gmail.com wrote: Dianne, I've published a video to give you a better idea of the problem I'm having with the back button protection. Hopefully my video helps show the problem I am having.http://www.youtube.com/watch?v=ipue9Yhi5VA The bug I mention in the video is NOT the bug report I filed out but ratherhttp://code.google.com/p/android/issues/detail?id=2643 Anyway, does this give any more credence to My bug report? Also, I'm not abusing the API, am I? I would guess that the KeyguardManager was not designed to be triggered with a background processes, but a lot of people are quite interested in my app and I'm excited to release it soon. Thanks for the input, David Shellabarger On Sep 3, 5:39 pm, Hong lordh...@gmail.com wrote: I found the video:http://www.youtube.com/watch?v=ipue9Yhi5VA NICE WORK! On Sat, Aug 29, 2009 at 9:23 PM, GodsMoon godsm...@gmail.com wrote: I admit that what I'm trying to do is a little unorthodox and somewhat creative. The idea I have does slightly change the way security works on the phone. However, I don't think I'm abusing the API or decreasing security. Its somewhat hard to explain my app idea. I will be releasing a video of my app in action for the ADC2 fairly soon. I'll post back here once it is released the video. I'd love to get feedback to make sure I'm not doing anything I'm not suppose to. Thanks for your help. --~--~-~--~~~---~--~~ 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: Home Screen Detection
Dianne, I've published a video to give you a better idea of the problem I'm having with the back button protection. Hopefully my video helps show the problem I am having. http://www.youtube.com/watch?v=ipue9Yhi5VA The bug I mention in the video is NOT the bug report I filed out but rather http://code.google.com/p/android/issues/detail?id=2643 Anyway, does this give any more credence to My bug report? Also, I'm not abusing the API, am I? I would guess that the KeyguardManager was not designed to be triggered with a background processes, but a lot of people are quite interested in my app and I'm excited to release it soon. Thanks for the input, David Shellabarger On Sep 3, 5:39 pm, Hong lordh...@gmail.com wrote: I found the video:http://www.youtube.com/watch?v=ipue9Yhi5VA NICE WORK! On Sat, Aug 29, 2009 at 9:23 PM, GodsMoon godsm...@gmail.com wrote: I admit that what I'm trying to do is a little unorthodox and somewhat creative. The idea I have does slightly change the way security works on the phone. However, I don't think I'm abusing the API or decreasing security. Its somewhat hard to explain my app idea. I will be releasing a video of my app in action for the ADC2 fairly soon. I'll post back here once it is released the video. I'd love to get feedback to make sure I'm not doing anything I'm not suppose to. Thanks for your help. --~--~-~--~~~---~--~~ 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: Hmm... at last ADC2 is out of our way ... tell about your app and experience
Tools: Smart Lock Description: Smart Lock increases the usability and security of your phone. It allows you to instantly and securely use the last application you opened after your phone goes to sleep. Smart Lock is perfect for: *Listening to Music while Running *Using Google Maps on the Go *Child Locking any Application. By:David Shellabarger Published on the market: No, I'll release a fancy version and a free version sometime soon Website: http://www.youtube.com/watch?v=ipue9Yhi5VA Feedback: I wasn't going to submit anything this time around. I submitted a partially working large application last time and didn't score very good. However, I just bought my first android phone (MyTouch) and was annoyed that I could change which song I was listening to without putting in my unlock pattern (without turning it off entirely, of course). This annoyed me greatly so I wrote this app in about a week, submitted right before the deadline. Mostly bug free, it crashed in the video demo, but its been pretty stable for me since. On Sep 2, 10:03 am, Alex iiiypu...@gmail.com wrote: Now there are more replies, but I think there are some with apps descriptions that were not allowed by moderators, like it was the case with mine. So I've re-sent you the post privately using reply to author option. Writing this just to see if something will get to the group from me or will disappear like a short description of our entry I've made few hours ago. Alex On Sep 2, 12:50 pm, Lout lout.r...@googlemail.com wrote: Thanks a lot for the replies. Though many on this thread expect more (thousands of) submissions this year, only eight of you have given feedback. Would love to hear from many more out there before formally publishing anything. Of the 20 thousand developers on this group, less than 20 have replied but am sure there are hundreds if not thousands who submitted for ADC2. --~--~-~--~~~---~--~~ 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: Home Screen Detection
I have a solution for home screen detection, but its slow and horrible. I run this bit of code every 1 seconds. ActivityManager actvityManager = (ActivityManager) this.getSystemService( ACTIVITY_SERVICE ); ListRunningAppProcessInfo procInfos = actvityManager.getRunningAppProcesses(); for(int i = 0; i procInfos.size(); i++) { if(procInfos.get(i).processName.compareTo ( android.process.acore) == 0 procInfos.get(i).importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { // Home Screen Detected! Do something... } } I hate continually polling a piece of code but I don't think there is a broadcast intent that will help me out. Do anybody know of a better way of doing this? On Aug 28, 2:41 pm, Dianne Hackborn hack...@android.com wrote: They are described here:http://developer.android.com/guide/topics/fundamentals.html On Fri, Aug 28, 2009 at 10:53 AM, GodsMoon godsm...@gmail.com wrote: What's the difference between a Task and a Process for ActivityManager? On Aug 28, 1:46 pm, Hong lordh...@gmail.com wrote: ActivityManager : getRunningTasks(int) On Thu, Aug 27, 2009 at 6:24 PM, GodsMoon godsm...@gmail.com wrote: That might be enough info for my app. Which api are you looking at? -- Dianne Hackborn Android framework engineer hack...@android.com 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. --~--~-~--~~~---~--~~ 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: BroadcastReceiver on Service
Thanks for the advice. That works way better. On Aug 29, 12:19 pm, Dianne Hackborn hack...@android.com wrote: I would instead suggest the service just make a BroadcastReceiver inner class, which it explicitly registers in onCreate() with registerReceiver() (and unregisterReceiver() in onDestroy() of course). On Fri, Aug 28, 2009 at 9:06 PM, GodsMoon godsm...@gmail.com wrote: Looks like I answered my own question. There is a peekService method in BroadcastReceiver for interacting with existing Services. On Aug 28, 11:50 pm, GodsMoon godsm...@gmail.com wrote: Can I Receive a Broadcast from a Service? It seem I have to extend BroadcastReceiver to receive broadcasts but I'm already extending Service and I can't extend 2 classes. Do I set up an additional Activity to receive broadcasts and then just pass stuff to the already running Service. And if so, how to I pass additional info to an existing Service? Is there a better way? Thanks in advance. -- Dianne Hackborn Android framework engineer hack...@android.com 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. --~--~-~--~~~---~--~~ 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: Home Screen Detection
I'm writing an app that turns off the keyguard and I would like to exitKeyguardSecurely when you user goes back to the home screen. This works great when hitting the Home button, but the user can back to the home screen without prompt by using the back button (I think this is an API bug). So I'm trying to determine if the Home screen is displayed so I can force exitKeyguardSecurely. I realize homescreen replacements will break this code but until the API bug gets fixed I don't see a good way around this. On Aug 29, 2:35 pm, Dianne Hackborn hack...@android.com wrote: No there is no API to do this. What are you trying to accomplish? Note that your code will break in many many situations -- when a custom home screen is being used, on a device where the manufacturer is not using the base platform home app, in the future when we have more memory so don't need to run home in a shared process, etc. On Sat, Aug 29, 2009 at 9:59 AM, GodsMoon godsm...@gmail.com wrote: I have a solution for home screen detection, but its slow and horrible. I run this bit of code every 1 seconds. ActivityManager actvityManager = (ActivityManager) this.getSystemService( ACTIVITY_SERVICE ); ListRunningAppProcessInfo procInfos = actvityManager.getRunningAppProcesses(); for(int i = 0; i procInfos.size(); i++) { if(procInfos.get(i).processName.compareTo ( android.process.acore) == 0 procInfos.get(i).importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { // Home Screen Detected! Do something... } } I hate continually polling a piece of code but I don't think there is a broadcast intent that will help me out. Do anybody know of a better way of doing this? On Aug 28, 2:41 pm, Dianne Hackborn hack...@android.com wrote: They are described here: http://developer.android.com/guide/topics/fundamentals.html On Fri, Aug 28, 2009 at 10:53 AM, GodsMoon godsm...@gmail.com wrote: What's the difference between a Task and a Process for ActivityManager? On Aug 28, 1:46 pm, Hong lordh...@gmail.com wrote: ActivityManager : getRunningTasks(int) On Thu, Aug 27, 2009 at 6:24 PM, GodsMoon godsm...@gmail.com wrote: That might be enough info for my app. Which api are you looking at? -- Dianne Hackborn Android framework engineer hack...@android.com 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. -- Dianne Hackborn Android framework engineer hack...@android.com 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. --~--~-~--~~~---~--~~ 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: Home Screen Detection
Dianne Hackborn, Are you familiar with the KeyguardManager class? Its really cool, I haven't seen anything like it on any other platform and I'm excited to take advantage of it. http://developer.android.com/reference/android/app/KeyguardManager.html It can take over the Home screen button I've created a bug report. http://code.google.com/p/android/issues/detail?id=3715 Thanks for your help. On Aug 29, 3:41 pm, Dianne Hackborn hack...@android.com wrote: On Sat, Aug 29, 2009 at 11:52 AM, GodsMoon godsm...@gmail.com wrote: I'm writing an app that turns off the keyguard and I would like to exitKeyguardSecurely when you user goes back to the home screen. This works great when hitting the Home button, but the user can back to the home screen without prompt by using the back button (I think this is an API bug). What API bug? Of course you can press back to go to the home screen. What are you doing to determine when the user presses home? Afaik there isn't really a way to do this since the system completely consumes the home key. Unfortunately, I don't think there is any robust way to do what you want. I can't imagine an app being able to do this consistently with the current API... and that should kind-of give you a moment of pause since you are messing with the lock screen and thus fundamental security of the device. -- Dianne Hackborn Android framework engineer hack...@android.com 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. --~--~-~--~~~---~--~~ 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: Home Screen Detection
I admit that what I'm trying to do is a little unorthodox and somewhat creative. The idea I have does slightly change the way security works on the phone. However, I don't think I'm abusing the API or decreasing security. Its somewhat hard to explain my app idea. I will be releasing a video of my app in action for the ADC2 fairly soon. I'll post back here once it is released the video. I'd love to get feedback to make sure I'm not doing anything I'm not suppose to. Thanks for your help. On Aug 29, 7:39 pm, Dianne Hackborn hack...@android.com wrote: On Sat, Aug 29, 2009 at 12:54 PM, GodsMoon godsm...@gmail.com wrote: Dianne Hackborn, Are you familiar with the KeyguardManager class? Its really cool, I haven't seen anything like it on any other platform and I'm excited to take advantage of it. http://developer.android.com/reference/android/app/KeyguardManager.html Yes I am. It can take over the Home screen button I don't know what you mean. As far as I know, it has nothing to do with the home screen button, it just controls whether the lock screen is shown. I've created a bug report. http://code.google.com/p/android/issues/detail?id=3715 I've closed this as work as intended, because what you are requesting is not how it is supposed to work. You could look at the AlarmClock app to see an example if the API's use. -- Dianne Hackborn Android framework engineer hack...@android.com 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. --~--~-~--~~~---~--~~ 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: Home Screen Detection
I was looking at the Package Manager api, but it looks like the Process api might be more useful. http://developer.android.com/reference/android/os/Process.html Has anybody used this before or have an example? On Aug 27, 6:24 pm, GodsMoon godsm...@gmail.com wrote: That might be enough info for my app. Which api are you looking at? On Aug 27, 6:06 pm, Chris Stratton cs07...@gmail.com wrote: On Aug 27, 5:40 pm, GodsMoon godsm...@gmail.com wrote: I'm writing a back ground app and would like to be able to tell which app is currently running (actually has focus). I'm particularly interested in if the Home screen is being shown. Can anyone help with this? I got stumped on that too. There is a call that will get a list of what is running and tell if it has user-interactive level of priority, but that's not unique enough - a few things (in call screen for example) keep this even when their window is not visible. Another problem is that latin input method can show up in the list interactive priority, but you don't know what application it is accepting input on behalf of. --~--~-~--~~~---~--~~ 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: Home Screen Detection
What's the difference between a Task and a Process for ActivityManager? On Aug 28, 1:46 pm, Hong lordh...@gmail.com wrote: ActivityManager : getRunningTasks(int) On Thu, Aug 27, 2009 at 6:24 PM, GodsMoon godsm...@gmail.com wrote: That might be enough info for my app. Which api are you looking at? --~--~-~--~~~---~--~~ 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] BroadcastReceiver on Service
Can I Receive a Broadcast from a Service? It seem I have to extend BroadcastReceiver to receive broadcasts but I'm already extending Service and I can't extend 2 classes. Do I set up an additional Activity to receive broadcasts and then just pass stuff to the already running Service. And if so, how to I pass additional info to an existing Service? Is there a better way? Thanks in advance. --~--~-~--~~~---~--~~ 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: BroadcastReceiver on Service
Looks like I answered my own question. There is a peekService method in BroadcastReceiver for interacting with existing Services. On Aug 28, 11:50 pm, GodsMoon godsm...@gmail.com wrote: Can I Receive a Broadcast from a Service? It seem I have to extend BroadcastReceiver to receive broadcasts but I'm already extending Service and I can't extend 2 classes. Do I set up an additional Activity to receive broadcasts and then just pass stuff to the already running Service. And if so, how to I pass additional info to an existing Service? Is there a better way? Thanks in advance. --~--~-~--~~~---~--~~ 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: How to make device to sleep?
I looked at this API and it looks like it is only based on Time. Is it possible to wake the phone up based on other events. For example: Location or Device Orientation. Thanks for your help. On Aug 26, 1:07 pm, Yusuf Saib (T-Mobile USA) yusuf.s...@t- Mobile.com wrote: AlarmManager:http://d.android.com/reference/android/app/AlarmManager.html Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Aug 25, 9:07 pm, GodsMoon godsm...@gmail.com wrote: I would like to know how to put the device tosleepand how to wake it up as well. Anybody? On Jul 20, 9:45 pm, Sansiro wangjiangfeng0...@gmail.com wrote: Now I use the code follow: IPowerManager.Stub.asInterface(ServiceManager.getService (Context.POWER_SERVICE)).goToSleep(6) But it still does not work. On Jul 21, 9:07 am, Sansiro wangjiangfeng0...@gmail.com wrote: I know that there is a PowerManager class and a goToSleep method in SDK But the code follow does not work.Anybody can tell me why? PowerManager pm=(PowerManager)ServiceManager.getService (Context.POWER_SERVICE); pm.goToSleep(6); BRs! --~--~-~--~~~---~--~~ 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: get music player state
I would also like to know this? Anybody? On Aug 20, 5:41 pm, STuFF nchall...@gmail.com wrote: hi, I wonder if it's possible to getmusicplayer state, like which is the currentmusicplaying, title, author and so on ? Better, is it possible for an activity (or a service) to be notified onmusicstate changements (startplaying, pause, etc.) Someone can help me ? --~--~-~--~~~---~--~~ 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] Home Screen Detection
I'm writing a back ground app and would like to be able to tell which app is currently running (actually has focus). I'm particularly interested in if the Home screen is being shown. Can anyone help with this? --~--~-~--~~~---~--~~ 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: Home Screen Detection
That might be enough info for my app. Which api are you looking at? On Aug 27, 6:06 pm, Chris Stratton cs07...@gmail.com wrote: On Aug 27, 5:40 pm, GodsMoon godsm...@gmail.com wrote: I'm writing a back ground app and would like to be able to tell which app is currently running (actually has focus). I'm particularly interested in if the Home screen is being shown. Can anyone help with this? I got stumped on that too. There is a call that will get a list of what is running and tell if it has user-interactive level of priority, but that's not unique enough - a few things (in call screen for example) keep this even when their window is not visible. Another problem is that latin input method can show up in the list interactive priority, but you don't know what application it is accepting input on behalf of. --~--~-~--~~~---~--~~ 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: get music player state
Look's like this might do the trick. http://developer.android.com/reference/android/media/MediaPlayer.html On Aug 27, 4:19 pm, GodsMoon godsm...@gmail.com wrote: I would also like to know this? Anybody? On Aug 20, 5:41 pm, STuFF nchall...@gmail.com wrote: hi, I wonder if it's possible to getmusicplayer state, like which is the currentmusicplaying, title, author and so on ? Better, is it possible for an activity (or a service) to be notified onmusicstate changements (startplaying, pause, etc.) Someone can help me ? --~--~-~--~~~---~--~~ 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: How to make device to sleep?
I would like to know how to put the device to sleep and how to wake it up as well. Anybody? On Jul 20, 9:45 pm, Sansiro wangjiangfeng0...@gmail.com wrote: Now I use the code follow: IPowerManager.Stub.asInterface(ServiceManager.getService (Context.POWER_SERVICE)).goToSleep(6) But it still does not work. On Jul 21, 9:07 am, Sansiro wangjiangfeng0...@gmail.com wrote: I know that there is a PowerManager class and a goToSleep method in SDK But the code follow does not work.Anybody can tell me why? PowerManager pm=(PowerManager)ServiceManager.getService (Context.POWER_SERVICE); pm.goToSleep(6); BRs! --~--~-~--~~~---~--~~ 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: How would you like your app marketed?
Ideally I would like a Google run store that was loaded on all google phones so all users to browse and rate apps. Maybe even watch a video of the app in action before they made a purchase. Have a very flexible sales scheme: free, free trial, one time purchase, subscription, shareware, etc (anybody want to add to this list?) Would like to offer multiple pay schemes for the same app. Also, ideally it would allow some usage tracking so us developers would know how much people use the app in general, do they use the GPS parts, which screens are the stickiest, which phone model is the most popular. Also a system to easy notify users of app updates. Am I missing anything? David Shellabarger www.goldfishview.com On May 30, 3:09 pm, Vasanth Sridharan [EMAIL PROTECTED] wrote: Hey all, I'm working on a story about Android app marketing for Silicon Alley Insider. Yesterday at Google I/O, the Android lead alluded to an Android App store. My question -- how would you like the store to operate? Is there a better way to get apps in the hands of the consumers? And what, if any, help do you think Google can provide in accomplishing this? Thanks, Vasanth Sridharan -- Vasanth Sridharan Reporter Silicon Alley Insider C: (408) 455-2254http://www.alleyinsider.comhttp://www.vasanthsridharan.com --~--~-~--~~~---~--~~ 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] Will Google have an App Store?
script type=text/javascript src=http://www.easy-poll.com/ usluga.sonda.38109/script div style=margin : 5px; background-color : #EE; width: 160px; border : 1px solid #CC; padding : 2px;a href=http://www.easy- poll.com title=easy-poll.com: free online pollseasy-poll.com: free online polls/a/div table width=160 align=center border=0 style=font-family: Verdana; font-size: 11px; color: #66; tr td width=20 style=padding-bottom: 9px;a href=http://www.easy- poll.com/ target=_blankimg src=http://www.easy-poll.com/ sonda.gif alt=free polls border=0 //a/td td style=padding-bottom: 9px; width=140bDo you think Google will have an App Store?/b/td /tr tr td width=20input style=border-width: 0px; background: none; type=radio name=sonda_reply value=0 onclick=glosuj_na(0); checked=checek //td td width=140Yes, and it will be awesome/td /tr tr td width=20input style=border-width: 0px; background: none; type=radio name=sonda_reply value=1 onclick=glosuj_na(1); // td td width=140No, the cell cariers will do this/td /tr tr td width=20input style=border-width: 0px; background: none; type=radio name=sonda_reply value=2 onclick=glosuj_na(2); // td td width=140No, I'm going to use: itzybit, SlideME, etc /td /tr tr td width=20input style=border-width: 0px; background: none; type=radio name=sonda_reply value=3 onclick=glosuj_na(3); // td td width=140Yes, but it will suck/td /tr tr td width=20input style=border-width: 0px; background: none; type=radio name=sonda_reply value=4 onclick=glosuj_na(4); // td td width=140What do you mean App Store?/td /tr tr td align=center colspan=2 br / input type=hidden name=glosuj_na id=glosuj_na value=0 / input type=button value=Vote ! onclick=glosuj() style=font- weight: bold / /td /tr /table --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---