Re: [android-developers] AlarmManager vs BroadcastReceiver vs Service
Thanks TreKing - I get it, the Alarm Receiver is kind of a redundant step if all it does is start the Service. But it's not 'wrong' as such. To the other point, is there actually a way to lauch an app without a main activity? I had read it wasn't possible, and when I tried to do so from AndroidStudio I just got errors, and didn't look at it any further. Is there an example anywhere that you know of? On Monday, 6 June 2016 06:53:28 UTC+1, TreKing wrote: > > > On Sat, Jun 4, 2016 at 5:50 AM, Neilz <neilh...@gmail.com > > wrote: > >> Hi. I need a background task to run every minute. >> > > > https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmNetworkManager > > >> I have no need for a user interface, although I understand that I must >> still declare a launcher activity >> > > No, you don't. > > >> I'm confused between the use of AlarmManager, Receivers and Services. So >> far, I've scheduled a repeating alarm, which passes a class called >> AlarmReceiver in its Intent. AlarmReceiver extends BroadcastReceiver, and >> the onReceive() method successfully fires every minute, even if I kill the >> activity, which is exactly what I want. >> >> However, at no point am I using a class which extends Service or >> IntentService, which when I look around at other people's examples, seems >> to be what everyone does when they want a task to run as a background >> service. Am I doing something wrong? Should I be calling a Service class >> from my BroadcastReceiver instead of doing the work there? >> > > Probably. You don't really need a receiver in this case. The point of a > receiver is to get notified of specific events happening either in you app > or throughout the system. If all you're interested in is doing some work > every 1 minute, then you don't need the receiver. The alarm manager's > intent that is fired when the alarm goes off can just be an intent to > launch an a(n) (Intent)Service that does that work. > > > - > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago > transit tracking app for Android-powered devices > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/5b46c17e-b996-493f-968a-f97017068f31%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] AlarmManager vs BroadcastReceiver vs Service
Hi. I need a background task to run every minute. I have no need for a user interface, although I understand that I must still declare a launcher activity, which I can just finish() once I've set up my service. I'm confused between the use of AlarmManager, Receivers and Services. So far, I've scheduled a repeating alarm, which passes a class called AlarmReceiver in its Intent. AlarmReceiver extends BroadcastReceiver, and the onReceive() method successfully fires every minute, even if I kill the activity, which is exactly what I want. However, at no point am I using a class which extends Service or IntentService, which when I look around at other people's examples, seems to be what everyone does when they want a task to run as a background service. Am I doing something wrong? Should I be calling a Service class from my BroadcastReceiver instead of doing the work there? Many thanks for any advice. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/52213af9-f4c9-4508-bbd0-3791e8fdec92%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] ActionBar - customizing
Hi all. I'm attempting to add custom drawables to the action bar items. I want to set a drawable as the general bar background, and have a pressed state drawable for when any of the bar items are clicked. I've been following Nick Butchers guide here: http://android-developers.blogspot.co.uk/2011/04/customizing-action-bar.html Whatever I do, when I press an item, I see the generic light blue background, not my specified pressed drawable. Xoom tablet with 3.2 - here's the code basics: style name=MyTheme parent=@android:style/Theme.Holo.Light item name=android:actionBarStyle@style/MyActionBar/item /style style name=MyActionBar parent=@android:style/ Widget.Holo.Light.ActionBar item name=android:background@drawable/action_bar_bg/item item name=android:selectableItemBackground@drawable/ selector_actionbar_bg/item /style The selector refers to this: selector xmlns:android=http://schemas.android.com/apk/res/android; android:exitFadeDuration=@android:integer/ config_mediumAnimTime item android:state_pressed=true android:drawable=@drawable/ action_bar_bg_press / item android:state_focused=true android:drawable=@drawable/ action_bar_bg_press / item android:drawable=@drawable/action_bar_bg_press / /selector Help appreciated! -- 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: Fragment animation
Perhaps I'm in the wrong forum... can anyone help? On Apr 5, 9:46 pm, Neilz neilhorn...@gmail.com wrote: Hi all. I'm having difficulty getting to grips with the 'objectAnimator' element which is used forfragmentanimation, and searching around hasn't really offered much clues. Here's what I'm trying to achieve: I have a simple layout where two fragments occupy a portion of the screen each, added vertically to a LinearLayout. So the top half of the screen could be FragmentA, and the bottom half FragmentB. Upon some event, I hide the topfragment, so that FragmentB takes up the whole screen, and then upon another event, FragmentA is shown again. When FragA is hidden, I want FragB to gracefully slide up to take its place, and similarly when FragA is shown again, I want it to slide back into place pushing FragB back down. Would really appreciate some help with the objectAnimator properties. -- 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] Fragment animation
Hi all. I'm having difficulty getting to grips with the 'objectAnimator' element which is used for fragment animation, and searching around hasn't really offered much clues. Here's what I'm trying to achieve: I have a simple layout where two fragments occupy a portion of the screen each, added vertically to a LinearLayout. So the top half of the screen could be FragmentA, and the bottom half FragmentB. Upon some event, I hide the top fragment, so that FragmentB takes up the whole screen, and then upon another event, FragmentA is shown again. When FragA is hidden, I want FragB to gracefully slide up to take its place, and similarly when FragA is shown again, I want it to slide back into place pushing FragB back down. Would really appreciate some help with the objectAnimator properties. -- 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] Android build and target versions
I've seen various questions related to the different between the minSdkVersion and the targetSdkVersion, and I understand the principle here. My question is more related to how you handle new android versions, and what you should specify then. Scenario: I built my app a year ago, when 2.3.3 (level 10) was out, and wanted to support back to 1.6 (level 4). So my manifest stated: uses-sdk android:minSdkVersion=4 android:targetSdkVersion=10 / Also, in my Eclipse setup, I specified that the project should be built using 2.3.3 Now, there are several newer versions available, up to 4.0.3 (level 15). I want my app to be available to all possible devices, and as far as I can tell this seems to be the case. At this moment in time, I don't require any extra features that the newer APIs offer. Should I update my project to build with the newer version? Should I change the targetSdkVersion? If I don't change it, are there any drawbacks? 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: Android build and target versions
Thanks TreKing. I hoped this was the case, and for most of my apps this seemed to be what was happening. I've actually been meaning to ask this for some time... but what prompted me to ask now is that one app is not appearing in the market for users of ICS. There's nothing in the manifest of this app which is really any different from the others, so do you have any idea why an app wouldn't show up in the market for ICS? All my other apps, with similar manifest declerations, do show up in the market. On Mar 22, 2:59 pm, TreKing treking...@gmail.com wrote: On Thu, Mar 22, 2012 at 6:58 AM, Neilz neilhorn...@gmail.com wrote: Should I update my project to build with the newer version? No. If it ain't broke, don't fix it. Should I change the targetSdkVersion? Do you want to target a newer version? If not, no. If it ain't broke, don't fix it. If I don't change it, are there any drawbacks? There may be compatibility problems with new versions. For example, if you used the old foreground notification system that was turned into a no-op on newer devices. For the most part, though, you shouldn't have to change much, if anything. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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] Multiple apps contained within one project
Hi all, I have a situation where I am to produce applications for multiple clients, all based on the same functionality. Essentially, each app will be the same apart from content - text elements and images. It would make sense for me to keep this as one project in Eclipse. I can set a property somewhere (clientName for example) which would enable me to pull in the required content and images accordingly. I think this would be manageable. The main problem is when I want to build the apps to go live.- they are all to be separate releases. Does this mean that they will all need their own package identifier? And their own manifest file? My solution above would mean that they would all have the same structure. Has anyone come across this issue before? I'd value any thoughts on how I could maintain and build these projects. 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] Default screen orientation problem with sensor events
Hi all. I've researched various threads where people ask how you get the default screen orientation (i.e. tablets vs standard portrait devices) but the general answer seems to be that there isn't a way to do this, and that there shouldn't be - i.e. you build your app to suit the orientation you want, or you let the user decide. However, I have a problem. One of my apps uses the SensorEventListener to get an angle, from which I make some calculations and display some graphics. A Motorola Xoom users has told me that my app is 180 degrees out. So clearly this device is returning different sensor values to all the devices I've tested on. I'm making the assumption that it's because it's a tablet, and I need to adjust my calculations accordingly. But I can't find a way to get this information from the device. Or - maybe my assumption is wrong, and there's another reason why the Xoom returns different sensor values? Any thoughts on this appreciated. -- 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: hdpi drawable sizes
So basically, to simplify my question: Can two devices which both sit in the HDPI (large screen) range, use a different set of assets? On Jan 4, 12:50 pm, Neilz neilhorn...@gmail.com wrote: Hi all. I have a set of assets in my drawable-hdpi folder, which have generally been designed using an 800 * 480 template. My new device, plus many others, are now using a 960 * 540 layout, which still takes the assets from the same hdpi folder. This is generally ok, but the image sizes are reduced somewhat, with a lot more spacing between them. For android versions less then 3.x, can I specify a different set of assets for these two (and other) sizes, within the hdpi range? 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: hdpi drawable sizes
Hi Kostya - not quite sure what you're getting at. Yes, both devices are 240 density, it's just the pixel size that differs - but the larger device isn't large enough to fall into the 'xlarge' bracket. On Jan 5, 4:42 pm, Kostya Vasilyev kmans...@gmail.com wrote: What quantized density does that device report? If it's 240, that's pure HDPI. 5 января 2012 г. 20:26 пользователь Neilz neilhorn...@gmail.com написал: So basically, to simplify my question: Can two devices which both sit in the HDPI (large screen) range, use a different set of assets? On Jan 4, 12:50 pm, Neilz neilhorn...@gmail.com wrote: Hi all. I have a set of assets in my drawable-hdpi folder, which have generally been designed using an 800 * 480 template. My new device, plus many others, are now using a 960 * 540 layout, which still takes the assets from the same hdpi folder. This is generally ok, but the image sizes are reduced somewhat, with a lot more spacing between them. For android versions less then 3.x, can I specify a different set of assets for these two (and other) sizes, within the hdpi range? 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 -- 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] hdpi drawable sizes
Hi all. I have a set of assets in my drawable-hdpi folder, which have generally been designed using an 800 * 480 template. My new device, plus many others, are now using a 960 * 540 layout, which still takes the assets from the same hdpi folder. This is generally ok, but the image sizes are reduced somewhat, with a lot more spacing between them. For android versions less then 3.x, can I specify a different set of assets for these two (and other) sizes, within the hdpi range? 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] Soft keyboard issue
Yet another soft keyboard issue...! I start an activity with the following flags: android:windowSoftInputMode=stateHidden|adjustPan This means that upon startup, the soft keyboard is not displayed. Clicking into the EditText brings up the keyboard as expected. From this activity, I open up a new activity (containing a webview which loads an external site, but I think that's irrelevant), then when the transaction is complete it finishes and returns to the original activity. Once back, the soft keyboard will not display any more. The onClick function of the EditText is still working, I'm logging that, but the keyboard doesn't pop up - so what's happened to the keyboard? -- 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: Strange webview problem
Mark, thanks for looking into this. At least there is an issue, and it's not just me going bonkers. I've been looking at it further, and it seems to be somehow related to the WebView not liking list item (li) tags. I've built a temporary work around into my code, simply by doing a text replacement which, when displayed, has the correct layout effect: content = content.replaceAll(ul, ); content = content.replaceAll(/ul, ); content = content.replaceAll(/li, br/); content = content.replaceAll(li, nbsp;nbsp;nbsp;#9679;nbsp;nbsp;); Any list item bullet points are simply replaced by an alternative means of display. However, this isn't of course a solution. This is a rather ugly and expensive hack! On Dec 19, 1:39 pm, Mark Murphy mmur...@commonsware.com wrote: Well, I can certainly reproduce the problem now. In fact, it's worse than you feared -- it will not reliably display even the first time on a Nexus S with Android 4.0. (sidebar: Nexus S with Android 4.0! Who-hoo!) On a Nexus One with Android 2.3.x, I could only reproduce the problem by pressing BACK, then using recent-tasks to go back to the app. Since the symptoms are akin to what I was seeing with the rotation scenario, my guess is that the issue is somehow tied to creating a second WebView within the same process. Unfortunately, while that can be worked around for configuration changes (per my previous email), I know of no solution here. I suggest that you file an issue on b.android.com, or I can do it if you prefer. Sorry that I have not come up with a solution. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 4.1 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] Re: Strange webview problem
Mark, thanks for looking into this. Unfortunately this has nothing to do with orientation. My app is only in portrait mode - apologies I should have supplied the manifest to make that clear. So I'm not sure any of the things you've mentioned are going to alter the issue. I've used fill_parent and added the manifest line anyway, but the behaviour is still the same. The webview content just disappears. Please could you try it again in portrait mode only? On Dec 17, 6:10 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Dec 16, 2011 at 10:22 AM, Neilz neilhorn...@gmail.com wrote: I'm not sure where I can post the project file. But from a new project, all you need is these two files, which is probably just as quick to implement: Do not use wrap_content for any widget dimension in a scrollable direction. In the case of WebView, which can scroll horizontally or vertically, do not use wrap_content for either the width or height. Use other things to constrain the size. For example, after an orientation change, I wound up with a zero-height WebView. That being said, even if i set the height to fill_parent, I am definitely seeing strange behavior with the WebView with your supplied content. Adding android:configChanges=orientation|keyboardHidden to the activity seems to clear up the problem, presumably because it keeps the same WebView. Either use that or, better yet, move your WebViews into dynamic fragments and use setRetainInstance(true), as that too should keep the WebView widgets intact. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in DC:http://marakana.com/training/android/ -- 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: Strange webview problem
Of course, sorry, here you go. http://www.mediafire.com/file/zkg5f164xi7xxlh/SampleWebview.zip 1) Load up. 2) use home key, or back key, to return to home screen 3) hold down home key to get recent app list, and resume app. 4) for me this usually shows a blank webview. Sometimes, I have to repeat steps 2 3 several times for it to disappear. I've tested this on my three phones and it repeats on each of them. On Dec 18, 1:01 pm, Mark Murphy mmur...@commonsware.com wrote: Only if you supply a complete application and exact steps to reproduce the problem. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- 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: Strange webview problem
If anyone can shed any light on this I'll buy you a beer. It will have to be in London though :) -- 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: Strange webview problem
Will do. On Dec 16, 2:18 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Dec 16, 2011 at 9:11 AM, Neilz neilhorn...@gmail.com wrote: If anyone can shed any light on this I'll buy you a beer. It will have to be in London though :) Can you create a sample project that demonstrates the issue and upload it somewhere? -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 4.1 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] Re: Strange webview problem
I'm not sure where I can post the project file. But from a new project, all you need is these two files, which is probably just as quick to implement: // Main Java file package com.android.test; import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; public class SampleWebviewActivity extends Activity { WebView webview; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webview = (WebView) findViewById(R.id.webview); final String mimeType = text/html; final String encoding = utf-8; webview.loadData(ulli3/liliO2/liliOrange/ lilinbsp;T-Mobile/lilinbsp;Virgin/lili/li/ul, mimeType, encoding); } } // XML layout ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent WebView android:id=@+id/webview android:layout_width=fill_parent android:layout_height=wrap_content / /LinearLayout -- 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] Strange webview problem
I wish this was an april fool joke, but no. This is nuts. I have a certain piece of text which when I load it into a webview, it displays fine. If I pause and then resume the activity, the webview is blank. Usually it happens immediately on the first resume, sometimes it takes a few goes. Once it's happened, no webviews in my app will display anything at all. Completely unrelated activities have blank webviews. The offending text is this: webView.loadData(ulli3/liliOrange/liliT-Mobile/ liliVirgin/li/ul, mimeType, encoding); I've started with a very long page of HTML and whittled it down to that line. It breaks my webview. If I edit the line at all, it loads fine every time. I've played with all the webview settings too. Please put me out of my misery, what's happening here? -- 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: Strange webview problem
Hi Mark - nope, no difference. Very strange, this one. On Dec 15, 3:14 pm, Mark Murphy mmur...@commonsware.com wrote: Try loadDataWithBaseURL() with a null URL for the first parameter. On Thu, Dec 15, 2011 at 5:46 AM, Neilz neilhorn...@gmail.com wrote: I wish this was an april fool joke, but no. This is nuts. I have a certain piece of text which when I load it into a webview, it displays fine. If I pause and then resume the activity, the webview is blank. Usually it happens immediately on the first resume, sometimes it takes a few goes. Once it's happened, no webviews in my app will display anything at all. Completely unrelated activities have blank webviews. The offending text is this: webView.loadData(ulli3/liliOrange/liliT-Mobile/ liliVirgin/li/ul, mimeType, encoding); I've started with a very long page of HTML and whittled it down to that line. It breaks my webview. If I edit the line at all, it loads fine every time. I've played with all the webview settings too. Please put me out of my misery, what's happening here? -- 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 -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- 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] Callback/listener for View display
Hi all. I have a list, where clicking an item displays a View. The view is populated with text, and then made visible. However the text for some of the items is very long, and it's taking a couple of seconds to populate the view. I'd like to show a progress indicator until the view gets displayed, but I'm not sure if there's such as listener or callback to tell me when the view has completely displayed? Any advice appreciated. -- 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: Callback/listener for View display
I've just realised it's the method HTML.fromHTML() that's causing the delay. Removing that and just calling setText(myText) renders it instantly. Problem is, the content is marked up. So I suppose I could display it in a webview instead, I'll see if that's any quicker. On Dec 14, 1:23 pm, TreKing treking...@gmail.com wrote: On Wed, Dec 14, 2011 at 6:07 AM, Neilz neilhorn...@gmail.com wrote: However the text for some of the items is very long, and it's taking a couple of seconds to populate the view. A few seconds for text seems way long. You may want to optimize that, or post how you're doing that part. I'd like to show a progress indicator until the view gets displayed, but I'm not sure if there's such as listener or callback to tell me when the view has completely displayed? If just displaying the Text is taking that long, then a progress dialog is not going to do you much good as the displaying happens on the GUI thread, which you would be blocking, preventing the progress dialog from animating. An idea: If you can't optimize out the display, look at reducing how much you set on the TextView initially. Reduce the size of the string to start with then append more and more to it via an AsyncTask / Handler or something. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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: Android source
Ok ok, I know, and I knew it was a daft question when I asked it :) Of course I had already searched for this, and I had actually found what your link eventually led me to, but I assumed that the code was out of date because I wasn't aware of the way the android source uses private APIs. I assumed that this was deprecated code, as I couldn't get it to compile. Having done some research I now understand that this isn't the way to go about what I'm after. On Dec 2, 1:07 am, TreKing treking...@gmail.com wrote: On Thu, Dec 1, 2011 at 4:56 PM, Neilz neilhorn...@gmail.com wrote: Failing that, what are my other options please? http://bit.ly/vmcTdO - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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: Android source
It's the internal API code that led me to believe it was deprecated, such as: import com.android.internal.policy.PolicyManager; And I've read we shouldn't build the source ourselves and rely on it, as the internal APIs could change at any moment meaning our apps would be scuppered... version 2.2 is not good enough? http://grepcode.com/file/repository.grepcode.com/java/ext/com.google pskink -- 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] Android source
Hi, is there an easy way to browse the android source code? I don't want to download the whole lot... at least I tried, but I'm not a linux user really, and also the netbook I have with linux on ran out of space during the process :-/ I only want to see the source for MediaController.java, but despite searching around, I've only managed to find it for what must be the first version and is way out of date. If anyone here has the source, and can post it, you'd save me a lot of time...! Failing that, what are my other options please? -- 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: Activity animation
I've tried various combinations yes, but the departing activity always just goes 'phhh' :) On Nov 21, 10:28 pm, TreKing treking...@gmail.com wrote: On Mon, Nov 21, 2011 at 12:04 PM, Neilz neilhorn...@gmail.com wrote: The function *is* being called on the new activity. It's when the user clicks 'back' and the activity disappears, that I want to add an exit animation. Let me rephrase - did you try calling that method on *both* activities or just one? - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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: Activity animation
Kostya, would you have a brief example of what you mean here? I call overridePendingTransition() in my onCreate() method, but I don't explicitly call finish() or do anything beyond that. On Nov 22, 12:02 pm, Kostya Vasilyev kmans...@gmail.com wrote: You are supposed to set the animations once, after having called finish() on the exiting activity. 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: Activity animation
Bingo! Thanks Kostya :) On Nov 22, 12:23 pm, Kostya Vasilyev kmans...@gmail.com wrote: Ah. That's it. http://developer.android.com/reference/android/app/Activity.html#over... *Call immediately after one of the flavors of startActivity(Intent) or finish() to specify an explicit transition animation to perform next.* As a test, override onBackPressed(), call finish() yourself, and *then* overridePendingTransition. Do not call super.onBackPressed. If this works (and it should), take it from there. -- 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: Activity animation
Sorry, I only just got around to checking for replies to this question. Yes, it does, but I thought the exit animation was applied to the activity that is being replaced by the new one. In fact I tested it, and it does. So, I can control the animation of the new activity as it starts, and the animation of the previous activity it replaces... but I can't find a way to control the animation of the new activity when it pauses... i.e. ends and returns to the first activity. On Nov 18, 4:51 pm, TreKing treking...@gmail.com wrote: Doesn't that same function specify an exit animation? - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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: Activity animation
The function *is* being called on the new activity. It's when the user clicks 'back' and the activity disappears, that I want to add an exit animation. On Nov 21, 5:45 pm, TreKing treking...@gmail.com wrote: On Mon, Nov 21, 2011 at 11:18 AM, Neilz neilhorn...@gmail.com wrote: So, I can control the animation of the new activity as it starts, and the animation of the previous activity it replaces... but I can't find a way to control the animation of the new activity when it pauses... Did you try calling that same function on the new activity as well as the old activity? - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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] Activity animation
Hi all. I understand how you control the animation for a new Activity, using overridePendingTransition(). I must be missing something obvious, but what about when the Activity finishes? Can I control that too? -- 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] Android C2DM question
Hi all, I'm currently weighing up the options for push notifications in my app. 1) Polling. I could use a boot receiver / alarm manager combination to fire off a process which checks our server periodically, say every 15 minutes, and then immediately terminates. First question is, is this resource hungry? I can't believe it would make any noticeable difference... 2) Urban Airship. I'm put off using this as their site says it doesn't work if the app is mounted on the external storage. As our app is likely to contain significant (many megabytes of) assets, this probably isn't the best option. 3) C2DM. Can anyone confirm if this works when the app is stored on the SD Card? I'm just curious, as even though Urban Airship uses the C2DM protocol to send the notifications, it isn't able to in this instance. Thanks for any advice. -- 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] Manipulating an image
Hi all. I have a situation where I want to take a square image, or Bitmap, and convert it to a circular image. I specifically want the entire image to be included in the transformation, so that the original looks distorted. My 2D knowledge really is zilch, so would appreciate any pointers! -- 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: Directing user to webpage, then back to app
Ok, I have a related, but unrelated, question about this! More about managing Activities and Intents, but within the above scenario. Let's say my app has started ActivityA, ActivityB, and ActivityC. This last activity opens the browser, which does its stuff until the user clicks the link (discussed above) which returns the user to my app, but in the case a new ActivityD. The small issue I have here is that the browser activity remains in the stack. Ideally I want it finished somehow. Even if I go from ActivityD back to ActivityC (setting Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP), the browser activity is still next in line. Once I've returned to C, I want to be able to continue as if the browser had never opened, back to B and then A etc. Can this be achieved? -- 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: Directing user to webpage, then back to app
Yes I rather thought that would be the case. Unfortunately I don't think the 'intent' link works from within a WebView, so I'm stuck with the browser, which would probably be the client's preference anyway. I don't want to actually 'get rid' of the browser as such, rather just move it to the other end of the stack. I assume you can't get hold of the stack and manipulate it like a pack of cards?! On Nov 8, 1:09 pm, Mark Murphy mmur...@commonsware.com wrote: ved? Not that I am aware of. You have no right to get rid of the browser, any more than the browser has the right to get rid of you. If you need that level of control, you'll probably need to use a WebView in your own activity rather than the browser. Or consolidate your app such that there is simply one Activity ABCD where you are handling your own back stack (e.g., using dynamic fragments), with an Intent triggered by the browser that includes FLAG_ACTIVITY_REORDER_TO_FRONT, so the existing ABCD instance is reused and you get the Intent in onNewIntent(). -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 4.1 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] Directing user to webpage, then back to app
Hi all. From my app I want to send the user to a web page to complete some action, and then return to the app with some kind of code, depending upon the success or failure of their action. How can I achieve this? Will I have to use a WebView within the app, or is there a way I can use the stock browser also? Thanks for some ideas... -- 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: Directing user to webpage, then back to app
Thanks Mark. Now that I know what to be searching for, I've found several similar topics mostly on stackoverflow. Most topics have a response by Hackbod, stating not to do it that way, but I'm struggling a little to understand what it is he's suggesting instead. http://stackoverflow.com/questions/3469908/make-a-link-in-the-android-browser-start-up-my-app So far I've got an example link from a WebView to open up the 'choose application' selector, which does at least contain my app - but I want it to open my app automatically. I don't get this bit: The best way to use this, if you want to ensure it launches only your app, is with your own scoped action and using Intent.setPackage() to say the Intent will only match your app package. and also... Finally, you may want to set the package of the intent to your app with this: http://developer.android.com/reference/android/content/Intent.html#setPackage(java.lang.String) This is a newer feature in the platform, which allows you to direct link intents to only your app so that other applications can not intercept and handle them. Where exactly is he suggesting that I use this? My link is going to come from an external browser over which I have little control. On Nov 7, 1:18 pm, Mark Murphy mmur...@commonsware.com wrote: On Mon, Nov 7, 2011 at 8:14 AM, Neilz neilhorn...@gmail.com wrote: Hi all. From my app I want to send the user to a web page to complete some action, and then return to the app with some kind of code, depending upon the success or failure of their action. How can I achieve this? Will I have to use a WebView within the app, or is there a way I can use the stock browser also? In theory, if you have the browser redirect to some URL that is handled by your app (ACTION_VIEW, CATEGORY_BROWSABLE, and an appropriate data element), you could accomplish this with your code baked into the URL (e.g., /postaction/success and /postaction/failure). I haven't tried a redirect as the trigger mechanism, though. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- 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: Directing user to webpage, then back to app
On Nov 7, 3:11 pm, Mark Murphy mmur...@commonsware.com wrote: FYI, hackbod is Dianne Hackborn. Ah, thought so... Finally, you may want to set the package of the intent to your app with this:http://developer.android.com/reference/android/content/Intent.html#se...) Um, that seems straightforward enough. Call setPackage() with the package name of whatever app should contain the recipient of the Intent -- no other app's components will be considered. Where exactly is he suggesting that I use this? My link is going to come from an external browser over which I have little control. No, but you are in charge of the URL that you are redirecting to. Those passages pertain to the use of an intent: URL, generated via a call to toUri() on a properly-constructed Intent. You would redirect to that URL. Hmm, I don't get it, I'm missing something obvious :-/ At the moment I have a webview (which is mimicking what may be a stock browser) which has a link, such as: webView.loadData(a href='http://com.my.app.android.activity'..etc. Then I have this in my manifest: activity android:name=.TestActivity intent-filter action android:name=android.intent.action.VIEW / category android:name=android.intent.category.DEFAULT / category android:name=android.intent.category.BROWSABLE / data android:scheme=http android:host=com.my.app.android.activity / /intent-filter /activity There isn't anywhere for me to be creating, or setting properties on, an Intent. -- 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: Directing user to webpage, then back to app
Right, I see. No, the path option doesn't make a difference, it still offers me a choice of apps to open with. Ok, it's the other approach that I'm struggling to find an example for. Just lots of messages discussing it! The appears to be an example on the following page, but it simply doesn't work for me: http://stackoverflow.com/questions/2430045/how-to-register-some-url-namespace-myapp-app-start-for-accessing-your-progr/2430468#2430468 On Nov 7, 4:08 pm, Mark Murphy mmur...@commonsware.com wrote: Correct. You will note that in Ms. Hackborn's answer, she cites two approaches to the problem. You are taking one approach. The quotes you used are for the other approach. BTW, try putting an android:path attribute on your data element and see if it then only opens up in your app vs. giving you the chooser. I know this works for NFC and NDEF and I can never remember if it works for HTTP URLs as well. I know that this is what Barcode Scanner uses to initiate a scan fro -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 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] Re: Directing user to webpage, then back to app
Right, so if I'm looking at the correct part of the sample, you end up logging a strange 'intent' url, like this: intent:#Intent;action=com.commonsware.android.MY_ACTION;end I'm not sure what I do with this... I've tried using it in a link, as another sample suggested, but I just get a 'Web page not available' error. Here's my own example: webView.loadData(a href='intent:#Intent;action=com.commonsware.android.MY_ACTION;end'Hello World!/a, text/html, utf-8); On Nov 7, 4:45 pm, Mark Murphy mmur...@commonsware.com wrote: I have one inhttp://github.com/commonsguy/cw-advandroid/Introspection/URLHandler(though that URL is from memory, as I am sitting in a conference keynote right now...) -- 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: Directing user to webpage, then back to app
Ah... it works when I run it from your sample page, yes. It doesn't work from a WebView, hence my initial confusion. At least I have the principle working... I can't actually test it in full, as I want to pass parameters too, but don't have a webpage I can manipulate at this moment. Thanks for persevering... On Nov 7, 5:37 pm, Mark Murphy mmur...@commonsware.com wrote: I can't speak for WebView. Point a browser athttp://commonsware.com/sampletosee a page that uses links to be picked up by the sample app's activity. Mark Murphy mmur...@commonsware.com On Nov 7, 2011 9:12 AM, Neilz neilhorn...@gmail.com wrote: oup/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] Get image from Camera, which then is removed/hidden
Hi all. In my app I let the user take a picture, which is then stored in the app as a Bitmap: Intent takePicIntent = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE, null); startActivityForResult(takePicIntent, PICK_IMAGE_FROM_CAMERA_ID); In onActivityResult: Bitmap bm = (Bitmap) data.getExtras().get(data); // process bitmap as necessary After I've got the data I need, I don't want this image to be viewable in the image gallery. In effect, as if the photo was never taken. How can I achieve this please? Is there a way to stop it being saved in the first place, or do I have to delete it after I've used it? 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: Do unique app names mean nothing in the Android Market?
What on earth are you doing on this forum then? Go away. On Aug 5, 9:11 pm, Amit forum.amit.man...@gmail.com wrote: I don know why u people try with android you people go for iPhone if u want quality. Android is buggy mobile so I suggest be wise decision and try with iPhone Thanks Sent from my iPhone On Aug 6, 2011, at 12:36 AM, Arpit Mathur mathur.ar...@gmail.com wrote: @Kostya Thanks for the link to that form. Just dropped them a line. Lets see if it does anything. On Fri, Aug 5, 2011 at 2:59 PM, Kevin Duffey andjar...@gmail.com wrote: I too can't find it on my 3 devices. I have wondered how search works on the market, because many times I can't find anything close to what I type, even though what I type often has apps with the same name as what I typed, or similar. On Fri, Aug 5, 2011 at 10:12 AM, Kostya Vasilyev kmans...@gmail.com wrote: I tried searching for it and couldn't find it either. You can try and report this to Google: http://www.google.com/support/androidmarket/developer/bin/request.py?... -- Kostya 05.08.2011 21:04, Arpit Mathur пишет: I released a free app about a week ago, called TimePiece (https://market.android.com/details?id=com.arpitonline.worldclock). I picked a name pretty close to the end of the dev process since it seemed less important. Before publishing to the store I searched for a couple of non conflicting terms and picked TimePiece since no-one seemed to have used it. Its been about a week since I added my app. I can find it by searching for arpitonline which is declared in the package and also as the publisher, but not by searching for TimePiece (the EXACT name for the app). Anyone know why this is? And what is the best convention for naming apps for Market release since exact names seem to count for little. -arpit -- 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 -- Kostya Vasilyev -- 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 -- 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 -- 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 -- 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: Converting to xlarge layouts
I guess I'll need to view the app on a proper tablet to really see what it looks like. On the subject of developing for Tablets... Am I correct in assuming that if I want an app that is developed for Tablets using Fragments etc, that this has to be a separate app to one designed for standard devices? If so, how does this work for the market? If my client says, we want our new app to fit standard devices but also have a specific version for tablets, would this mean creating two apps with two market uploads? -- 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: Converting to xlarge layouts
That's what I had hoped - but I'm yet to find an example that codes for both types? On Aug 3, 9:50 am, b.ampw...@gmail.com wrote: Hello Neilz, For some reason, I will thought that you can create different main.xml's for different devices and locales, so you would have the same application logic but different UI layouts. -- 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: Converting to xlarge layouts
Nikolay - thanks for the response, though you've confused me a litle... Do you have a single APK or multiple? Or is it a choice, if so which is best practice? Are you saying that when I create the app in the market, I can provide different APKs to target different devices, which are all managed under the same app heading? On Aug 3, 12:57 pm, Nikolay Elenkov nikolay.elen...@gmail.com wrote: On Wed, Aug 3, 2011 at 5:46 PM, Neilz neilhorn...@gmail.com wrote: Am I correct in assuming that if I want an app that is developed for Tablets using Fragments etc, that this has to be a separate app to one designed for standard devices? No. You can have a single APK that works on both. Use the compatibility library to get fragment support on pre-3.0 devices. You can have different layouts based on screen size and/or Android version. If so, how does this work for the market? If my client says, we want our new app to fit standard devices but also have a specific version for tablets, would this mean creating two apps with two market uploads? You can now have multiple APKs targeted at different devices. -- 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: Converting to xlarge layouts
Great, that's a lot clearer now - many thanks. On Aug 3, 1:52 pm, Peter Stacey peterst6...@gmail.com wrote: Yes, you can have either multiple APKs, or you can have a single APK that delivers its layout based on the version of Android being used. For the multiple APK support of the market, see here: http://android-developers.blogspot.com/2011/07/multiple-apk-support-i... And for the logic behind delivering one layout for xlarge screens vs. smaller sizes, a good app source cose to look at is the Google IO app: http://code.google.com/p/iosched/source/browse/ A good activity to start with is the ActivityHelper.java file in the util directory. Regards, -- 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] Converting to xlarge layouts
Hi all. I'm altering my app so that it fits nicely into a tablet, by specifing layout-xlarge and drawable-xlarge resources. One thing I don't seem to be able to alter is the dialogs. I have a number of these in my code: AlertDialog.Builder alert = new AlertDialog.Builder(MyActivity.this); alert.setTitle(R.string.dialog_title); alert.setIcon(R.drawable.icon); alert.setMessage(R.string.dialog_desc); // add some buttons and actions alert.show(); These are appearing very small, with tiny text, and don't seem to be being re-sized according to the device type. How can I achieve this please? I'm using the standard emulator for testing this, by the way. -- 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] Different ACTION_CALL intents
Hi all. I'm looking at the intents for making calls, and there seem to be two options. 1) Using code: intent.setAction(Intent.ACTION_CALL); intent.setData(Uri.parse(tel: 0800123456)); This code actually makes the call. 2) In XML: android:text=0800123456 android:autoLink=all This code takes you to the phone call screen, with the number populated, where the user has the option of making the call. I prefer the second scenario, as the user gets the choice to call, but how can I do that from code as in example 1? 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: Different ACTION_CALL intents
Thanks Mark :-) On Jul 5, 11:47 am, Mark Murphy mmur...@commonsware.com wrote: Use ACTION_DIAL instead of ACTION_CALL. As a bonus, you don't need the CALL_PHONE permission. On Tue, Jul 5, 2011 at 3:37 AM, Neilz neilhorn...@gmail.com wrote: Hi all. I'm looking at the intents for making calls, and there seem to be two options. 1) Using code: intent.setAction(Intent.ACTION_CALL); intent.setData(Uri.parse(tel: 0800123456)); This code actually makes the call. 2) In XML: android:text=0800123456 android:autoLink=all This code takes you to the phone call screen, with the number populated, where the user has the option of making the call. I prefer the second scenario, as the user gets the choice to call, but how can I do that from code as in example 1? 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 -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 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] AlarmManager - list of alarms set?
Hi all. I'm using AlarmManager to, well, set an alarm which then calls a BroadcastReceiver at specified times. Is there a way, in my code, I can get hold of a list of the alarms that have been set, and then identify in some way if my alarm is in the list? (I want to do this because sometimes, the process dies in the onReceive() method so the next alarm never gets set, and it would be useful when the app is running to do a double check - and if it's not in the list, then set it again). 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: AlarmManager - list of alarms set?
Hi Kostya. This is basically a revival of this old thread, in which you helped me some time ago. http://groups.google.com/group/android-developers/browse_thread/thread/b2abad03be3467c0/d73f3780fbdd08f9 In my case, the onReceive method calls an ASyncTask which does some network calls, so continues on for longer than the life of onReceive(). I've implemented a Wakelock in my Receiver as you suggested, which releases the lock once the network task has done its stuff. However, the process *still* sometimes dies before it gets as far as releasing the lock. It's definitely better now, just not 100% reliable. It's fine on 'good' phones, but on those with lower memory capabilities (HTC Hero, Samsung Galaxy Europa for example) I still get this problem. There's no errors, I'm sure of that, it's just being killed before the task has completed. On Jun 30, 10:31 am, Kostya Vasilyev kmans...@gmail.com wrote: There isn't. You process should not be dying inside an receiver's onReceive, as being inside onReceive makes your process least likely to be killed by the process killer: http://developer.android.com/guide/topics/fundamentals/processes-and-... Perhaps you have a bug where the code crashes or takes too long? AFAIK, crashes or ANRs inside receivers are not reported to the user, the process is silently killed. -- Kostya 30.06.2011 13:14, Neilz пишет: Hi all. I'm using AlarmManager to, well, set an alarm which then calls a BroadcastReceiver at specified times. Is there a way, in my code, I can get hold of a list of the alarms that have been set, and then identify in some way if my alarm is in the list? (I want to do this because sometimes, the process dies in the onReceive() method so the next alarm never gets set, and it would be useful when the app is running to do a double check - and if it's not in the list, then set it again). Thanks. -- Kostya Vasilyev -- 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: AlarmManager - list of alarms set?
One of the problems with setting the alarm immediately inside onReceive(), is that the time of the next alarm depends on the outcome of the task. So I could set a default one, but what happens if I set it twice? Does the second overwrite the first, or will I end up with two alarms? On Jun 30, 11:29 am, Kostya Vasilyev kmans...@gmail.com wrote: Neil, A running AsyncTask does not make your process less likely to be killed. Two possible fixes: - Use a service with startForeground to that Android (and the user) knows that your application is doing something important and doesn't kill the process. You can leverage IntentService or Mark Murphy's WakefulIntentService to make it easier. - Set the next alarm right inside onReceive of the current one. or perhaps both fixes, if both the scheduling and the completion of each work item are important. FWIW, I have code in my current project that uses the second approach, and don't have a problem even with devices that have a very aggressive process killing scheme (one of those is the original 7 Galaxy Tab with Android 2.3). -- Kostya -- 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: Alternative to radio buttons?
I have this situation quite often, and simply stick to three ImageButtons. It means you need pressed and static states for each button, controlled by an xml selector as the drawable, and of course you have to manage the states yourself, i.e. set the pressed button as 'pressed' and the other two as static. If you go down this route, manage the states in a runnable which fires about 100millis after the press, so that the default button 'up' action doesn't undo your work. On Jun 30, 6:07 pm, nadam a...@anyro.se wrote: Is there any obvious Android alternative to iPhone toggles like this (DHCP/BootP/Static)?http://www.coderetard.com/wp-content/uploads/2008/06/iphone_ip.jpg Need it on the top of a listview to let the user choose how the list is sorted. Placing three radiobuttons side by side doesn't look good and possibly would be too wide on small screens. Have tried Android's toggle buttons too, but hope there is something better around. -- 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] Finding out how the Intent was started
Hi all. I assume there is a way of finding out how your Activity was started, for example: Intent i = new Intent(ActivtyA.this, ActivityB.class); ...when B starts, I want to find out the activity that started it, which in this case would be an instance of ActivityA. How can I get this information? Following on from that, is there a way to tell: a) That the application has just been launched from the main application launcher, from the home screen. b) If the application has just been resumed via the recent apps list, i.e. hold down home button, select app from recent list. Many 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: Soft keyboard 'Done' button
To bring this to the top again... Yes, I'm having problems with it, the DONE button never appears! Anyone else have experience with this? On May 22, 11:10 pm, Nicholas Johnson metthejohn...@gmail.com wrote: Are you having problems with the implementation? Make sure to put an OnEditorActionListener in your EditText and screen for the IME_ACTION_GO action ID. Nick -- 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: Need to create Android toggle button in Iphone style
Although the original question perhaps wasn't asked in the best way, this is actually a good point, something that I'm looking into myself. It's a sad fact that in the Android world many clients are now asking for an app that does what the existing iPhone app does. And iPhone apps that I'm basing my Android apps on all have these 'switcher' style toggle buttons. You can slide a button between two choices, like an old style analogue hifi switch between AM and FM, for example. The Android ToggleButton doesn't actually give the same behaviour - it's an On or Off state, which isn't the same as choosing between two different options. If I want to ask the user (using the same example) if they want to listen to AM or FM, it would be good to have one switch, rather than a space consuming radio group. Yes I know I could design a button which gets switched when pressed, but it still isn't the same. Anyone have any other examples or suggestions? -- 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] Soft keyboard 'Done' button
Hi all. I'm attempting to add the 'Done' button to the soft keyboard, when an EditText is activated. I use: android:imeOptions=actionDone (in the XML) and... input.setImeOptions(EditorInfo.IME_ACTION_DONE); (in the code) However, I am seeing no difference to the standard keyboard. I read somewhere that the device manufacturers (HTC in this case) are building their own implementations of the soft keyboard, which ignore these options. I'm testing on a Nexus One and a Hero. Can anyone confirm this? Am I doing something wrong? -- 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] Help creating shape drawable
Hi all. I want to create a shape drawable, in the style of a rounded rectangle. However I want the background (the section outside the rounded corners) to be white, and the main central section (within the rounded corners) to be transparent. Effectively, you can imagine this working like a picture frame. Is this possible? Many 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: Help creating shape drawable
Hi Kostya, I tried the example you gave above. Firstly it's not quite what I was after, as the outer edges are rounded - I need the drawable as a whole to be square/rectangular. Also, strangely, even though I've overlayed this over my image using a FrameLayout, the image can be seen in full beneath the green border. I'm waiting for my design friend to send me an image which I will turn into a 9patch - I'm hoping this will do what I want. My own design skills are -zero. On Apr 27, 4:24 pm, Kostya Vasilyev kmans...@gmail.com wrote: It draws the border, while leaving the interior untouched, available to draw something else, which I think is what the OP wanted? -- Kostya dpress.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] Getting bitmap to fit an ImageView
Hi. My app downloads some images over the net, and in this case they are 185 * 185, though that's probably irrelevant. I'm creating a layout where I specify the size of the frame, in this case 150dip square, and I want the image to fit the frame, regardless of whether the frame is bigger or smaller than the bitmap size. I've tried a number of options, and various flavors of android:scaleType, but I just cannot get this to work. Strangely in the above case, even though the xml frame is smaller than the image I downloaded, there is always a border between the frame and the rendered image. Here's the xml: LinearLayout android:orientation=vertical android:layout_width=150dip android:layout_height=150dip android:gravity=center android:layout_gravity=center ImageView android:id=@+id/myImage android:layout_width=fill_parent android:layout_height=fill_parent android:layout_gravity=center android:scrollbars=none android:scaleType=fitCenter / /LinearLayout -- 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] Maps - position of zoom controls
When I tap my map, the zoom controls appear in the center of the screen at the bottom. Is it possible to control where they sit? I notice on the google maps app, they are aligned into the bottom right corner of the map, which is what I'd like to do in my own map activity. 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: Maps - position of zoom controls
Oh my sides are splitting. Ok, I've done some searching, and found a half solution... but it's not without issues: I've set my own ZoomControls object, in the layout xml, and added listeners to activate the zooms (as per this link... http://stackoverflow.com/questions/920741/always-show-zoom-controls-on-a-mapview) But the only issue is that the zoom buttons don't disable themselves when fully in/out. It says you can use the following line to rectify this: mapView.getZoomButtonsController().setAutoDismissed(false); ...but because I'm not using the built-in-zoom-controls, this doesn't work. There doesn't seem to be a way of accessing and controlling the buttons from my own ZoomControls object... On Apr 25, 11:18 am, Filip Havlicek havlicek.fi...@gmail.com wrote: Here you go http://tinyurl.com/3fha8xl 2011/4/25 Neilz neilhorn...@gmail.com When I tap my map, the zoom controls appear in the center of the screen at the bottom. Is it possible to control where they sit? I notice on the google maps app, they are aligned into the bottom right corner of the map, which is what I'd like to do in my own map activity. 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 -- 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: Maps - position of zoom controls
Yes, this solution does work, thanks. Actually it was the first solution I looked at - problem was it uses a deprecated method, and there doesn't seem to be a way of doing it without using the method - so for some reason I decided against trying it out. But hey if it works, that's good enough. On Apr 25, 12:37 pm, Filip Havlicek havlicek.fi...@gmail.com wrote: Why didn't you try the Reto Meier solution? Third link from the Google search. http://stackoverflow.com/questions/263507/placing-zoom-controls-in-a-... And if you want help, post your XMLs and code samples. 2011/4/25 Neilz neilhorn...@gmail.com Oh my sides are splitting. Ok, I've done some searching, and found a half solution... but it's not without issues: I've set my own ZoomControls object, in the layout xml, and added listeners to activate the zooms (as per this link... http://stackoverflow.com/questions/920741/always-show-zoom-controls-o... ) But the only issue is that the zoom buttons don't disable themselves when fully in/out. It says you can use the following line to rectify this: mapView.getZoomButtonsController().setAutoDismissed(false); ...but because I'm not using the built-in-zoom-controls, this doesn't work. There doesn't seem to be a way of accessing and controlling the buttons from my own ZoomControls object... On Apr 25, 11:18 am, Filip Havlicek havlicek.fi...@gmail.com wrote: Here you go http://tinyurl.com/3fha8xl 2011/4/25 Neilz neilhorn...@gmail.com When I tap my map, the zoom controls appear in the center of the screen at the bottom. Is it possible to control where they sit? I notice on the google maps app, they are aligned into the bottom right corner of the map, which is what I'd like to do in my own map activity. 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 -- 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 -- 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] Memory managing my list adapter
Hi all. I have a list adapter, code given below. I'm trying to clean up the app, recycle bitmaps etc, to lower the memory usage as I've been experiencing out of memory issues when creating bitmaps. I'm concerned that my list adapter is not as efficient as it could be, and just wanted some advice. 1) As I scroll up and down the list, I notice that getView() gets called each time the item appears. Thus, it creates another ImageView which gets assigned another bitmap. Is there not a way to have this only called the once, so that the next time the list row is called, it's already instantiated and doesn't need to re-inflate the layout? 2) Once my activity finishes, is there a way I can access the ImageView items created by the list adapter, and clean them all up? By this I mean, set the image resource to null, so no bitmaps are still being referenced. Thanks for any advice here. -- 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: Memory managing my list adapter
Sorry, forgot the code - here it is. Does this affect your answer at all? public class SearchResultsListAdapter extends ArrayAdapterMyObject { private ListMyObject items; private Context mContext; private int layoutResource; LayoutInflater vi; public SearchResultsListAdapter(Context context, int textViewResourceId, ListMyObject items) { super(context, textViewResourceId, items); this.items = items; this.mContext = context; this.layoutResource = textViewResourceId; vi = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; MyObject obj = items.get(position); if (v == null) { v = vi.inflate(layoutResource, null); } if (obj != null) { ((TextView) v.findViewById(R.id.item_title_text)).setText(Html.fromHtml(obj.getName())); ImageView imageView = (ImageView) v.findViewById(R.id.obj_image); if(obj.getImage() != null){ // code to get image } } return v; } } -- 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: Memory managing my list adapter
Eventually it does run out of memory yes, if I force it... for example if I switch activities back and forward, so the list view keeps getting created, eventually I get the awful BM exceeds virtual memory or suchlike error. It's probably not likely to happen under normal use, but obviously I'd like to stop it ever happening if possible. And the people testing the app will certainly encounter it... I'll try what you suggest, thanks. On Apr 6, 10:41 am, Kostya Vasilyev kmans...@gmail.com wrote: It does - your code already reuses convertView, so it does not create a new ImageView every time: if (v == null) { v = vi.inflate(layoutResource, null); } The only issue then is that this can end up with lots of image objects in memory, which are somewhat slow to recycle. You could keep track of them yourself (preferably with WeakReference) and call recycle() at some point. Does your code actually run out of memory? If not, I'd just let it be. -- Kostya 06.04.2011 13:32, Neilz пишет: Sorry, forgot the code - here it is. Does this affect your answer at all? public class SearchResultsListAdapter extends ArrayAdapterMyObject { private ListMyObject items; private Context mContext; private int layoutResource; LayoutInflater vi; public SearchResultsListAdapter(Context context, int textViewResourceId, ListMyObject items) { super(context, textViewResourceId, items); this.items = items; this.mContext = context; this.layoutResource = textViewResourceId; vi = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; MyObject obj = items.get(position); if (v == null) { v = vi.inflate(layoutResource, null); } if (obj != null) { ((TextView) v.findViewById(R.id.item_title_text)).setText(Html.fromHtml(obj.getName())); ImageView imageView = (ImageView) v.findViewById(R.id.obj_image); if(obj.getImage() != null){ // code to get image } } return v; } } -- Kostya Vasilyev --http://kmansoft.wordpress.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: Memory managing my list adapter
Yes I think you're right. What's happening here is that activities are starting up over existing instances of the same activity. So for example, this app has four menu options, each of which start a new activity. If the user clicks menu option A, activity A starts. Then, if option B is clicked, activity B starts. Then, on selecting option A again, a new activity A starts. So when you click 'back', rather than the app finishing after one or two presses, you end up retracing your route back through A, B, A, B, A etc. Clearly there's something wrong with my design here, but I'm not sure how I handle this. I can prevent it from opening Activity A if this is the one that's already displayed - but how can I resume an existing version of the activity, if it exists, after another activity has come to the fore? All I can think of is keeping some kind of record of the activities created, and 'controlling' them by finishing all the subsequent activities until I get back to the one requested. Surely that would be bad - that's what Android is supposed to do for me? On Apr 6, 2:32 pm, Dianne Hackborn hack...@android.com wrote: I doubt that has anything to do with recycling views in the list view, and is more just a normal memory leak where activities are being leaked. After switching back and forth a bit, use a memory debugging tool like hat to look at what is on your heap and why those objects are stick sitting around. -- 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: Memory managing my list adapter
Dianne - I know exactly where you're coming from - it just seemed very complex to do it that way... i.e. giving one Activity so much responsibility goes against everything you read about Java! The onCreate() method would have been endless... Kostya - I love the saying You learn a new thing every day because it's true. 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: Layout help
Ok, I'll try again - it was a Sunday after all :-) Basically all I'm after is a LinearLayout sitting in the center of the screen, that I can scroll horizontally from one item to the next, using a finger scroll, rather than just buttons. Any help with this really appreciated. -- 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] Custom map overlays
Hi all. I'm fairly familiar with ItemizedOverlay and OverlayItem classes, where you pass a drawable to the Overlay which gets added to the MapOverlays and displayed on the map. However I want to create a view, using an XML layout, and add this to the map in the same way as an overlay. So instead of displaying a simple image, I want to add a view which has more useful info to show - but is still in a fixed position on the map and moves with it accordingly. Any pointers appreciated... 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: Custom map overlays
Super, thanks TreKing! On Mar 21, 2:59 pm, TreKing treking...@gmail.com wrote: On Mon, Mar 21, 2011 at 9:53 AM, Neilz neilhorn...@gmail.com wrote: Any pointers appreciated... thanks. http://code.google.com/android/add-ons/google-apis/reference/com/goog... - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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: Custom map overlays
Ok, same thread, another Map question. I've been using 'MyLocationOverlay' to display current location. It shows that nice blue pulsating image to mark the spot. Am I able to add a pointer (arrow image) which indicates current direction, as I would see on the standard GoogleMap? 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: Custom map overlays
Interesting, thanks for the tip. On Mar 21, 6:11 pm, lbendlin l...@bendlin.us wrote: And you'll want to lose the pulsating/fix circle. It's eye candy for sure but it impacts performance heavily without really giving much back. You can replace it with a view placeholder that contains an arrow image that you can rotate according to your direction. -- 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] Layout help
Hi all. I'm struggling with a layout... would appreciate any suggestions on how to handle this. Basically, I have a list of objects. Each has attributes (like Name) and an image. I want to display the objects in a gallery style, allowing the user to scroll / fling from one item to the next. The tricky bits I'm facing are: - I want the gallery overall to sit within a static outer frame (i.e. my main.xml), so that the gallery itself is not full screen. - I want each item within the gallery to be controlled via its own xml layout (i.e. the same layout applied to each item). - I want only one item to be displayed at a time. I've been playing around with various Gallery examples, but the items merge into a row rather than being filling the enclosing parent. I've also been trying the FlingGallery which has been posted here before, but can't get that to work within an enclosing layout via xml file. I'm sure this is simpler than I'm making it out to be - any ideas? -- 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] Maps - difference between satellite and hybrid modes?
Hi all. I can see the difference on Google Maps, but on an Android MapActivity I'm struggling to find the difference. For 'map' I call: mapView.setSatellite(false); For 'satellite' I call: mapView.setSatellite(true); But for hybrid view... I tried playing with mapView.setStreetView(true); but this doesn't seem to affect anything either way. Any ideas? -- 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: Maps - difference between satellite and hybrid modes?
Yeah, I'd read this somewhere else, but it isn't on my phones! On Mar 11, 3:19 pm, Mark Murphy mmur...@commonsware.com wrote: setStreetView(true) should turn on a layer that draws blue lines down streets where Street View information is available, IIRC. On Fri, Mar 11, 2011 at 10:14 AM, Neilz neilhorn...@gmail.com wrote: Hi all. I can see the difference on Google Maps, but on an Android MapActivity I'm struggling to find the difference. For 'map' I call: mapView.setSatellite(false); For 'satellite' I call: mapView.setSatellite(true); But for hybrid view... I tried playing with mapView.setStreetView(true); but this doesn't seem to affect anything either way. Any ideas? -- 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 -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.5 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] Re: Scheduling ideas
Like this: public class AlarmReceiver extends BroadcastReceiver { On Feb 23, 10:11 pm, Kostya Vasilyev kmans...@gmail.com wrote: 24.02.2011 1:06,Neilzпишет: I'm using an Activity that extends a BroadcastReceiver... An Activity that extends a Broadcast receiver? Sorry, I'm not sure I understand what this means. Do you mean something else - like a BroadcastReceiver subclass that starts an Activity subclass? -- Kostya Vasilyev --http://kmansoft.wordpress.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: Scheduling ideas
Yes sorry, bad wording, not an activity as such. My AlarmReceiver has one method, onReceive(), which starts an ASyncTask - that in turn does a server call, then schedules the next alarm. On Feb 24, 8:50 pm, Kostya Vasilyev kmans...@gmail.com wrote: Ok, that's a receiver. I am guessing that your receiver uses startActivity. If you do that, beware of sleep/wake states, it's documented here: http://developer.android.com/reference/android/app/AlarmManager.html Android guarantees that for Wakeup-type alarms delivered to a broadcast receiver, it will keep the device from falling back to sleep only for the duration of the receiver's onReceive. If that's too short, and your code needs to do more, especially an asynchronous operation (such as starting an Activity or a Service), then it's up to your code to acquire a WakeLock to keep the device awake as long as needed for that. There is an example at the top of this page: http://developer.android.com/reference/android/os/PowerManager.html Basically, the structure should be - onReceive() Call startService or startActivity Acquire a WakeLock [return] --- lock is held, device is still awake --- Android processes startActivity call Your activity is created and started onResume releases the wake lock so it's not held forever Somewhere in there should be some kind of error handling, so that if something goes wrong, the device is not held awake indefinitely (or rather, until the battery runs out - which won't be long). -- Kostya 24.02.2011 23:27, Neilz пишет: Like this: public class AlarmReceiver extends BroadcastReceiver { On Feb 23, 10:11 pm, Kostya Vasilyevkmans...@gmail.com wrote: 24.02.2011 1:06,Neilzпишет: I'm using an Activity that extends a BroadcastReceiver... An Activity that extends a Broadcast receiver? Sorry, I'm not sure I understand what this means. Do you mean something else - like a BroadcastReceiver subclass that starts an Activity subclass? -- Kostya Vasilyev --http://kmansoft.wordpress.com -- Kostya Vasilyev --http://kmansoft.wordpress.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: Scheduling ideas
Hi Kostya. Regarding this info you suggested... the examples seem to demonstrate this for starting and stopping a Service. I'm using an Activity that extends a BroadcastReceiver... can it still be used in the same way? I'm a little confused about how to implement this. Thanks for the help, Neil. On Feb 20, 1:57 pm, Kostya Vasilyev kmans...@gmail.com wrote: This means Android decided to get rid your process, thinking it wasn't important. http://android-developers.blogspot.com/2010/02/service-api-changes-st... Add a call to startForeground while updating data, and stopForeground when done. And btw, you are using AlarmService to schedule updates, correct? -- Kostya 20.02.2011 16:35,Neilzпишет: Yep, added a Throwable block, still nothing. The only output I get is this: 02-20 13:33:26.067: INFO/ActivityManager(83): Process com.my.app.android.activity:remote (pid 4610) has died. -- Kostya Vasilyev --http://kmansoft.wordpress.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: Scheduling ideas
Reviving this thread yet again... There does seem to be some kind of bug in the code. Strange thing is though, it does get caught. The code always works fine within normal circumstances, but when it's run as an Alarm Service, the process dies at a particular line, and it isn't caught in the catch block. try{ URL updateURL = new URL(sUrl); conn = updateURL.openConnection(); ins = conn.getInputStream(); // this line causes the process to die }catch(IOException ioe){ Log.e(TAG, Error making URL request + ioe.getMessage()); // this is never shown throw ioe; } Any ideas why this would happen? On Feb 7, 9:41 am, Kostya Vasilyev kmans...@gmail.com wrote: Having said that, there may be a bug in your code. Since your code, AFAIK, schedules one alarm at a time, there may be a situation where the old alarm already fired (and forgotten), and the new one isn't scheduled. You should schedule the new alarm as soon as you receive the old one. Ideally, right inside onReceive for the old alarm's broadcast action, because onReceive is guaranteed to not be interrupted. -- Kostya -- 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: Scheduling ideas
Thanks Kostya. I did the network test... Active network info: NetworkInfo: type: WIFI[], state: CONNECTED/ CONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true And added a general Exception block, which still didn't catch anything! -- 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: Scheduling ideas
Yep, added a Throwable block, still nothing. The only output I get is this: 02-20 13:33:26.067: INFO/ActivityManager(83): Process com.my.app.android.activity:remote (pid 4610) has died. -- 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: Scheduling ideas
I'm using the service to connect to a server and get dynamic info for the app, which I want to happen each morning. Not updates, just up to date data that the app uses, in this case sporting info. I'll look into that info, thanks. On Feb 20, 1:57 pm, Kostya Vasilyev kmans...@gmail.com wrote: This means Android decided to get rid your process, thinking it wasn't important. http://android-developers.blogspot.com/2010/02/service-api-changes-st... Add a call to startForeground while updating data, and stopForeground when done. And btw, you are using AlarmService to schedule updates, correct? -- Kostya 20.02.2011 16:35, Neilz пишет: Yep, added a Throwable block, still nothing. The only output I get is this: 02-20 13:33:26.067: INFO/ActivityManager(83): Process com.my.app.android.activity:remote (pid 4610) has died. -- Kostya Vasilyev --http://kmansoft.wordpress.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: Scheduling ideas
Ok. I think I may have found one factor influencing this. I'm using ASyncTask to handle the thread. I've just been reading some blogs on this, and it seems it is hard coded to use the lowest priority, which means it may well be killed off when used on a device with low memory (like my Hero in this case). I think I'll try to implement my task using a different thread management, and set its priority higher. -- 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] Problem with WebView
Hi. I have a WebView which loads a webpage that uses a form, for the user to complete. I set this method: webSettings.setUseWideViewPort(true); ...which helps the webpage display properly. However, for some reason, when you click in the text fields on the webpage, the soft keyboard fails to popup - but only on my HTC HERO! On all other emulators and devices I've tested, it's fine. It works if you 'long press' in the field, but new users would never know that. Any suggestions? -- 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 with WebView
Hi Mark, thanks for response. I like your last comment, you're thinking on the same lines as me :-) Your step1 - are you thinking of code in the HTML that's loaded into the webview, or Android code which can catch these events? Another thing I've thought of: The problem can be solved by 'pinching' the screen to resize it slightly. As soon as it's been resized, the keyboard works. I wondered if it's possible to programmatically resize the screen as if the user 'pinched' it? On Feb 19, 1:19 pm, Mark Murphy mmur...@commonsware.com wrote: Sounds like a device bug. The following solution is extremely theoretical: Step #1: Add Javascript event handling to your code to find out when a field gets focus. I'm no Javascript expert, but I seem to recall there are some events for this. Step #2: Have the Javascript notify your activity via a Java object you inject via addJavascriptInterface(). Step #3: For known problematic devices, have your Java object manually pop up the input method editor via InputMethodManager. Be careful about problematic devices with side-slider keyboards -- you only want to display the soft keyboard when the physical keyboard is unavailable. Other solutions would involve not using setUseWideViewPort(), or threatening your Hero with a sledgehammer until it starts to behave. On Sat, Feb 19, 2011 at 6:47 AM, Neilz neilhorn...@gmail.com wrote: Hi. I have a WebView which loads a webpage that uses a form, for the user to complete. I set this method: webSettings.setUseWideViewPort(true); ...which helps the webpage display properly. However, for some reason, when you click in the text fields on the webpage, the soft keyboard fails to popup - but only on my HTC HERO! On all other emulators and devices I've tested, it's fine. It works if you 'long press' in the field, but new users would never know that. Any suggestions? -- 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 -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in London:http://bit.ly/smand1andhttp://bit.ly/smand2 -- 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] WebView issue
Hi all - I have a problem with my WebView... I'm using the method setUseWideViewPort(true). Within the view I load a webpage which includes a form. I'm testing on two devices: When I test on the Nexus, I can fill in the form fields as usual. With my Hero, I click into the form fields, and the soft keyboard fails to pop up. This only happens when I set the method as above. I'm wondering why the two devices are acting differently, and also what is stopping the keyboard from appearing? 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] Change package name after market deployment
Hi all. We put an app on the market, and now the client wants to change the package names to something completely different. Will the market let you do this, if I upload an update? Or must the package structure remain the same once uploaded? 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: Scheduling ideas
More issues with this. I'm testing on a Nexus and Hero. It all runs fine on the Nexus, but on the Hero after I schedule the alarm, sometimes the process seems to die: 02-07 09:00:36.664: INFO/ActivityManager(98): Process com.my.app.activity:remote (pid 1813) has died. And that's it, no other log messages. So my alarm fails, and I never know about it until I find it didn't run the next morning. Any ideas why this would happen, or ways to stop 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: Scheduling ideas
Really, BOOT_COMPLETED can be disabled? That poses me a bit of a problem. So there's no way for me to know whether my alarm service has been restarted. On Feb 5, 4:01 pm, Kostya Vasilyev kmans...@gmail.com wrote: Well, some devices have really weird settings, like the HTC fast boot optimization for the Desire HD, which disables BOOT_COMPLETED. So at least you can be aware of it. ger + pretty widget --http://kmansoft.wordpress.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: Scheduling ideas
Ok, one problem with this alarm service. I schedule it for some time in the morning, and when I get up and check the phone, the alarm didn't get called, because it thinks there's no network connection. This is a call I make deliberately (I always check there's a connection before making the server request)... but why does it think there's no network when the phone is 'sleeping'? The connection is still there... -- 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: Scheduling ideas
Hi Kostya. Yes, the alarm gets called... it's just my own call which stops it doing it's task. For example: if(isNetworkAvailable(mContext)){ // do stuff... } public static boolean isNetworkAvailable(Context context) { ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connMgr.getActiveNetworkInfo(); return(info != null info.isConnected()); } So this call tells me the network isn't available when the phone's asleep. I guess I'll have to try another way of testing for the network? On Feb 5, 1:07 pm, Kostya Vasilyev kmans...@gmail.com wrote: 05.02.2011 15:40, Neilz пишет: Ok, one problem with this alarm service. I schedule it for some time in the morning, and when I get up and check the phone, the alarm didn't get called, because it thinks there's no network connection. I'm sure the alarm did get called, as the AlarmManager service has nothing to do with networking. This is a call I make deliberately (I always check there's a connection before making the server request)... but why does it think there's no network when the phone is 'sleeping'? The connection is still there... Depends on what kind of network connectivity you expect. In my tests (Moto Milestone), WiFi doesn't get enabled when the phone is woken by an alarm, but the cellular data connection is available immediately. -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.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: Scheduling ideas
Yes, looking at the log output, it seems the device disables the wireless connection after a few minutes while the phone's sleeping, to save resources I suppose. So I'll just have to code around that, and reset the alarm to try again until the connection is back. On Feb 5, 1:29 pm, Kostya Vasilyev kmans...@gmail.com wrote: Neil, That's pretty much how I test too, except my code lacks a check for isConnected, only for null. This is what I get in my app's log: NetworkInfo: type: MOBILE[EDGE], state: CONNECTED/CONNECTED, reason: apnSwitched, extra: internet.mts.ru, roaming: false, failover: false, isAvailable: true Two ideas: - Check your phone settings, perhaps yours has some kind of sleep policy for mobile data; - Log the value you get by calling getActiveNetworkInfo into a file, and examine later. -- Kostya 05.02.2011 16:20, Neilz пишет: Hi Kostya. Yes, the alarm gets called... it's just my own call which stops it doing it's task. For example: if(isNetworkAvailable(mContext)){ // do stuff... } public static boolean isNetworkAvailable(Context context) { ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connMgr.getActiveNetworkInfo(); return(info != null info.isConnected()); } So this call tells me the network isn't available when the phone's asleep. I guess I'll have to try another way of testing for the network? On Feb 5, 1:07 pm, Kostya Vasilyevkmans...@gmail.com wrote: 05.02.2011 15:40, Neilz пишет: Ok, one problem with this alarm service. I schedule it for some time in the morning, and when I get up and check the phone, the alarm didn't get called, because it thinks there's no network connection. I'm sure the alarm did get called, as the AlarmManager service has nothing to do with networking. This is a call I make deliberately (I always check there's a connection before making the server request)... but why does it think there's no network when the phone is 'sleeping'? The connection is still there... Depends on what kind of network connectivity you expect. In my tests (Moto Milestone), WiFi doesn't get enabled when the phone is woken by an alarm, but the cellular data connection is available immediately. -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.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: Scheduling ideas
No I'm testing on a Nexus... But I can't be responsible for user's individual settings, so I'll just have to assume that in some cases the network will not be available during the night. Unless there's a command to explicitly wake up the connection? On Feb 5, 3:42 pm, Kostya Vasilyev kmans...@gmail.com wrote: Interesting. I take it by wireless you mean cellular? My HTC Hero has an option for always on cellular data connection - I guess it's specific to HTC phones, as neither my Samsung Galaxy S or Motorola Milestone have that. Is your phone made by HTC by any chance? If so, perhaps you could check that setting. -- Kostya 05.02.2011 18:22, Neilz пишет: Yes, looking at the log output, it seems the device disables the wireless connection after a few minutes while the phone's sleeping, to save resources I suppose. So I'll just have to code around that, and reset the alarm to try again until the connection is back. On Feb 5, 1:29 pm, Kostya Vasilyevkmans...@gmail.com wrote: Neil, That's pretty much how I test too, except my code lacks a check for isConnected, only for null. This is what I get in my app's log: NetworkInfo: type: MOBILE[EDGE], state: CONNECTED/CONNECTED, reason: apnSwitched, extra: internet.mts.ru, roaming: false, failover: false, isAvailable: true Two ideas: - Check your phone settings, perhaps yours has some kind of sleep policy for mobile data; - Log the value you get by calling getActiveNetworkInfo into a file, and examine later. -- Kostya 05.02.2011 16:20, Neilz пишет: Hi Kostya. Yes, the alarm gets called... it's just my own call which stops it doing it's task. For example: if(isNetworkAvailable(mContext)){ // do stuff... } public static boolean isNetworkAvailable(Context context) { ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connMgr.getActiveNetworkInfo(); return(info != null info.isConnected()); } So this call tells me the network isn't available when the phone's asleep. I guess I'll have to try another way of testing for the network? On Feb 5, 1:07 pm, Kostya Vasilyevkmans...@gmail.com wrote: 05.02.2011 15:40, Neilz пишет: Ok, one problem with this alarm service. I schedule it for some time in the morning, and when I get up and check the phone, the alarm didn't get called, because it thinks there's no network connection. I'm sure the alarm did get called, as the AlarmManager service has nothing to do with networking. This is a call I make deliberately (I always check there's a connection before making the server request)... but why does it think there's no network when the phone is 'sleeping'? The connection is still there... Depends on what kind of network connectivity you expect. In my tests (Moto Milestone), WiFi doesn't get enabled when the phone is woken by an alarm, but the cellular data connection is available immediately. -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.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] Using Android C2DM
Hi everyone. I'm attempting to use C2DM in my app, but I admit I'm finding the docs very confusing. The official guide http://code.google.com/android/c2dm/ makes the process seem relatively simple, showing code which implements various methods, onReceive(), handleRegistration(), performs registration, along with some manifest entries. It also points to two examples, JumpNote and ChrometoPhone. However the implementation of C2DM in these two apps are not like the suggestions in the overview docs: - the docs declare a receiver: receiver android:name=.C2DMReceiver android:permission=com.google.android.c2dm.permission.SEND - while the sample apps do this: service android:name=.C2DMReceiver / receiver android:name=com.google.android.c2dm.C2DMBroadcastReceiver android:permission=com.google.android.c2dm.permission.SEND The samples also have a class called C2DMReceiver, but again the docs have no mention of this. Furthermore, I can find no implementation of the methods mentioned above (onReceive, handleRegistration) within the sample apps. Anyway, I've so far attempted to implement the code as per the docs, and so far the only output I get is this: DEBUG/C2DMRegistrar(184): [C2DMRegistrar.61] register: http error 400 Confused... any advice please? -- 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] Scheduling ideas
Hi all. I want to build certain functionality into my app, but I'm not sure if it's possible. The main parts of the app (and server calls) are built, it's just the scheduling I'm considering. 1) I want the app to check against a server at a set time each morning. If there are updates available (in this case it's just some data from a database) I want to either create a notification, or resume the app, loading up the new data. 2) I suppose if the device isn't turned on at the specified time, then it should check the next time it starts up to see if an update check is due. 3) I want this to be done in a way where the app isn't running, i.e. no drain on resources. So, can this be done, and what should I be looking at? 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: Scheduling ideas
Thanks... this seems to be what I'm after. However I just put together a simple repeat alarm, outputting a Toast every minute, which was fine. But it didn't work again after a phone restart... how can this be implemented? -- 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: Scheduling ideas
Right, thanks. And will that stay on the device as long as the app is still installed? (And, I suppose, will it get removed if the app is uninstalled?) On Feb 1, 5:25 pm, Kostya Vasilyev kmans...@gmail.com wrote: Right, alarms are not persistent. Implement a receiver for android.intent.action.BOOT_COMPLETED, and set the alarm again after the device reboots. -- Kostya 01.02.2011 20:22, Neilz пишет: Thanks... this seems to be what I'm after. However I just put together a simple repeat alarm, outputting a Toast every minute, which was fine. But it didn't work again after a phone restart... how can this be implemented? -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.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