Re: [android-developers] Re: uploading to the google cloud service
You may be thinking about Google App Engine. https://appengine.google.com There is a free option with a set quota that you can pay to increase. Steven Studio LFP http://www.studio-lfp.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: graphical layout problem
If you are talking about not being able to open the XML in Eclipse in the WYSIWYG editor, try right clicking on the Project, select Android Tools and click on Fix Project Properties. You may need to close and reopen the project for the settings to apply. Steven Studio LFP http://www.studio-lfp.com On Thursday, November 3, 2011 11:22:24 AM UTC-5, ANKUR1486 wrote: Hi all, i am not able to get graphical layout for my xml can anybody help me with this. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Overhead of creating many activities
You might want to check into Fragments. http://developer.android.com/guide/topics/fundamentals/fragments.html They are similar to Activities (very little work to swap an Activity to a Fragment) and you can manage the backstack. Steven Studio LFP http://www.studio-lfp.com On Thursday, November 3, 2011 4:35:35 AM UTC-5, Mat Jones wrote: Hello, I am working on a security app which involves users storing passcodes, docs etc My app has around 10 activities representing screens (every screen is a activity) I have set android:noHistory=true on all the activity's as I want to manage what happens when they press the back key and also when the app goes into the background I want the app to restart As a result I am constructing alot of activity's e,g Activity A goes to B B wants to go to A, I create a new instance of A Is there a major overhead of doing this? 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: ADT r15 reliabiility on Windows?
Every time you update software, there is more than a good chance that it probably didn't clean up after itself and has left old and/or orphaned files and entries. Not to mention the settings in different layers of software that you may know nothing about. There is a good chance Eclipse, ADT and Java keeps all the old settings around update after update. Then you have overall project settings and then specific project settings. The odds of one of those five having a rogue setting that could cause issues is pretty good. The longer you go without cleaning house, the more likely you are to end up with internal problems. That's not even mentioning the fact that each component of Eclipse, and any other plugin you have in Eclipse, also has settings. Just look in your Workspace .metadata directory. Each plugin can carry its own settings in those folders. There are probably hundreds, if not thousands, of settings that can affect how well your environment behaves. Steven Studio LFP http://www.studio-lfp.com On Monday, October 31, 2011 3:08:26 AM UTC-5, Zsolt Vasvari wrote: The freezing and running out of heap seems like you might have an issue somewhere else. Have you tried cleaning out Eclipse/ADT/SDK and reinstalling fresh? I know it's not the optimal thing, but might be worth a try. I've done it a time or two on my main workstation and laptop and it seems to help keep things in order. Where are you getting these suggestions from? Why would reinstall help? The files are either there or not -- we are not talking about corrupted registries 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: Google+ App consumes phone memory
The application and the data that the application stores/caches are two different things. If you move the application to the SD card, it does move and frees up most of whatever memory the application itself was taking up. The data that the application produces may still use the internal memory as the preferred location. If so, than it will continue to take up internal memory like you are seeing. You may want to check the settings for it, and other applications, to see if you can set them to use another storage location for files/cache so they won't fill up your internal memory. Steven Studio LFP http://www.studio-lfp.com On Monday, October 31, 2011 10:09:11 AM UTC-5, Neil wrote: Hi All, I installed Google + app for android in my Samsung Galaxy ACE. It got installed in SD card according to the Application Manager However when I check back the phone memory usage , it shows me that 17 mb less. For this reason I am getting low phone memory warning and unable to use the app. Since it is installed in SD card it should have been consuming memory in SD card not in phone memory. When I uninstall the app I got the phone memory back. Thanks Neil http://neilghosh.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
Re: [android-developers] Google+ App consumes phone memory
In the market there is a developer web site link if you scroll down. It leads you to here: http://www.google.com/support/mobile/bin/topic.py?hl=entopic=1248781parent=1364494 There are support options near the bottom in the Solve a problem section. You'll probably want to use one of those. Steven Studio LFP http://www.studio-lfp.com On Monday, October 31, 2011 10:32:45 AM UTC-5, Neil wrote: Thanks Daniel and Steven for the explanation ! My phone has only 181 Mb of phone memory, so I am not able to install more than 10 apps or so.And because above reason moving the apps to SD card also does not help. I understand this is a Developers' forum, Can anybody suggest me android user's forum or any way I can contact the developer of the apps ? -- 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: ADT r15 reliabiility on Windows?
I have noticed that I have to clean my projects a lot more to get them to function. This started more with 13 and has continued to where I have to clean almost any time I want to pick up resource changes regardless of what settings I have/have not checked. It seems to like to ignore my changes to layout files and I end up with invalid or wrong resource values. The freezing and running out of heap seems like you might have an issue somewhere else. Have you tried cleaning out Eclipse/ADT/SDK and reinstalling fresh? I know it's not the optimal thing, but might be worth a try. I've done it a time or two on my main workstation and laptop and it seems to help keep things in order. If you do refresh your tools, just remember to do the Android Tools Fix Project Properties on any projects you import if you start with a clean workspace. Note: I am on Windows 7 and not Vista, so it might be something Vista specific. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 30, 2011 6:00:58 PM UTC-5, Zsolt Vasvari wrote: Is it only me, but the latest version of the ADT seems very unreliable on Windows (Vista)? I get frequent freezes and running out of Java heap space errors where I need to kill Eclipse and the adb -- even only after just making changes to the Java code. The compilation itself seems even slower, if that's even possible. I certainly see no improvements to the resource building times, if anything it's worse. I know this is a rant, but every time I change a resource, I am sitting and wait for it to compile for, no kidding, 3-5 minutes and then hope that it hadn't crashed. The only change I made to my system is the laest ADT and SDK -- I didn't touch anything else in the tool chain, such as Eclipse, ANT or the JDK. -- 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
Re: [android-developers] How to get updated c2dm registration Id.
What type of response code are you getting from the C2DM server when you try to send a message to that specific device ID? It will let you know if there is any issues with your current device ID. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 29, 2011 5:37:58 AM UTC-5, Manikandan M wrote: Hi Steven, Thanks for the reply. I am using droid x and i am unable to get c2dm messages, registration is fine even i also have response id from the c2dm server but message is not delivered to the device. It works for all other devices. Thanks Manikandan On Fri, Oct 28, 2011 at 8:20 PM, Studio LFP studi...@gmail.com wrote: I don't think the ID you get for the device expires. If you give the user the option of unregistering, then you would use the same register routine again to get a new ID. If the user uninstalls the application, it also unregisters and you would need to get a new ID if they reinstalled. If neither of these two happen, I believe you don't ever have to refresh the ID of the device. Are you running into a problem? Steven Studio LFP http://www.studio-lfp.com On Friday, October 28, 2011 9:33:05 AM UTC-5, Manikandan M wrote: Hi All, Any ideas. Thanks Manikandan On Fri, Oct 28, 2011 at 3:50 PM, Manikandan M c2dm...@gmail.com wrote: Hi All, Is that any other way to do this without registering at particular interval. Thanks Manikandan On Fri, Oct 28, 2011 at 2:52 PM, Manikandan M c2dm...@gmail.comwrote: Hi All, As i know c2dm registration id periodically refreshed, how do i get the refreshed c2dm registration id. Is i want to register again at particular interval? Thanks in Advance Manikandan. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to androi...@googlegroups.com To unsubscribe from this group, send email to android-develop...@**googlegroups.com For more options, visit this group at http://groups.google.com/**group/android-developers?hl=enhttp://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-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@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
Re: [android-developers] How to get updated c2dm registration Id.
That should be a correct response. You may want to refresh your C2DM key on the device and then refresh the server with the updated one. You may want to call the unregister intent on device first with the following: http://code.google.com/android/c2dm/index.html#unregistering I would figure that unregistering a device would remove all previous entries if there is more than one entry. I'm not sure that there can be more than one ID for a device for the same app, but it is worth trying the unregister intent to see if it might help clear up your issue. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 29, 2011 11:46:21 AM UTC-5, Manikandan M wrote: Hi Steven, This is the response i am getting from the c2dm server. id=0:1319892812710374%3421e3b10030 Thanks Manikandan On Sat, Oct 29, 2011 at 8:35 PM, Studio LFP studi...@gmail.com wrote: What type of response code are you getting from the C2DM server when you try to send a message to that specific device ID? It will let you know if there is any issues with your current device ID. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 29, 2011 5:37:58 AM UTC-5, Manikandan M wrote: Hi Steven, Thanks for the reply. I am using droid x and i am unable to get c2dm messages, registration is fine even i also have response id from the c2dm server but message is not delivered to the device. It works for all other devices. Thanks Manikandan On Fri, Oct 28, 2011 at 8:20 PM, Studio LFP stud...@gmail.com wrote: I don't think the ID you get for the device expires. If you give the user the option of unregistering, then you would use the same register routine again to get a new ID. If the user uninstalls the application, it also unregisters and you would need to get a new ID if they reinstalled. If neither of these two happen, I believe you don't ever have to refresh the ID of the device. Are you running into a problem? Steven Studio LFP http://www.studio-lfp.com On Friday, October 28, 2011 9:33:05 AM UTC-5, Manikandan M wrote: Hi All, Any ideas. Thanks Manikandan On Fri, Oct 28, 2011 at 3:50 PM, Manikandan M c2d...@gmail.comwrote: Hi All, Is that any other way to do this without registering at particular interval. Thanks Manikandan On Fri, Oct 28, 2011 at 2:52 PM, Manikandan M c2d...@gmail.comwrote: Hi All, As i know c2dm registration id periodically refreshed, how do i get the refreshed c2dm registration id. Is i want to register again at particular interval? Thanks in Advance Manikandan. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to andr...@googlegroups.com To unsubscribe from this group, send email to android-develop...@**googlegroup**s.com For more options, visit this group at http://groups.google.com/**group**/android-developers?hl=enhttp://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 androi...@googlegroups.com To unsubscribe from this group, send email to android-develop...@**googlegroups.com For more options, visit this group at http://groups.google.com/**group/android-developers?hl=enhttp://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-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@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
Re: [android-developers] How do you use and debug your apps in your main phone?
You can always change the package name to add beta or something in it somewhere. The same application can live on your device twice if the package names aren't the same. I've done it before and as long as you are using storage that is specific to the app instead of a common directory on the SD card, you should be fine. You can run into issues if they try to control the same hardware, but it is an option you can work with. Just name the working version com.yourcompany.app and the beta com.yourcompany.app.beta and you can use them both. Once you get a solid working copy in beta, you can just copy and/or rename the package and overwrite your standard version with it and keep working on the beta. It's certainly not the most elegant solution, but it does work. I've used it for testing new features or different feature sets while still keeping the original around to compare. Steven Studio LFP http://www.studio-lfp.com On Friday, October 28, 2011 8:56:01 AM UTC-5, Ricardo Amaral wrote: I think I'll have to add that to my todo list... Too bad there are no better alternatives. :/ -- 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: Newb Learning to Debug
Check out the log functions here: http://developer.android.com/reference/android/util/Log.html You drop them in and around the functions you want to debug to output variables and status. Doing this helps you confirm in real-time that things are going well. There are times where you will not be able to debug the standard way and these will help a ton. To use them, just pick which category you want the message to show up in LogCat and use that Log.x function. Put them before functions to validate you are sending in the correct arguments and you'll also know which file/string/object it is working on when it fails. These are also great to put at the start of built-in functions like onCreate, onStart, onResume, etc. to watch the actual flow of your program. You can put them at the start of methods to let it tell you which methods it is calling and when to get a better understanding of how Android works. Add them to your most important functions (or all functions) and you'll have a beautiful picture of how exactly your code gets executed. It's great for optimizing. Steven Studio LFP http://www.studio-lfp.com On Friday, October 28, 2011 8:10:09 AM UTC-5, nester wrote: So I'm making progress on my first real android app (not hello world). So far everything is going pretty smooth... except for debugging. I just can't figure it out for the life of me! I've been able to insert breakpoints and inspect, but when stepping through code... it just seems to break. Other times when I've made an error, I'll get a message on crash like File not found. Messages like this are completely useless... because I can't tells WHICH FILE isn't found. So far I can't tell where the hell it's breaking when it crashes. I've used trace-cat a bit; but that seems better at high level system processes, not granular line-by-line step through processes. Trial Error have gotten the job done so far... but as a native .Net programmer, I know debug tools could be a LOT more useful. I'm new to Eclipse; so I'm pretty sure this is just a learning curve. Can anybody point me to a good debugging tutorial, or video? Do you have any good tips on what I could be missing? Thanks for the help. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to get updated c2dm registration Id.
I don't think the ID you get for the device expires. If you give the user the option of unregistering, then you would use the same register routine again to get a new ID. If the user uninstalls the application, it also unregisters and you would need to get a new ID if they reinstalled. If neither of these two happen, I believe you don't ever have to refresh the ID of the device. Are you running into a problem? Steven Studio LFP http://www.studio-lfp.com On Friday, October 28, 2011 9:33:05 AM UTC-5, Manikandan M wrote: Hi All, Any ideas. Thanks Manikandan On Fri, Oct 28, 2011 at 3:50 PM, Manikandan M c2dmde...@gmail.com wrote: Hi All, Is that any other way to do this without registering at particular interval. Thanks Manikandan On Fri, Oct 28, 2011 at 2:52 PM, Manikandan M c2dmde...@gmail.comwrote: Hi All, As i know c2dm registration id periodically refreshed, how do i get the refreshed c2dm registration id. Is i want to register again at particular interval? Thanks in Advance Manikandan. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@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: get first row from cursor
Remove the cursor.moveToFirst(). The moveToNext() will move the pointer to the first row the first time through the while statement. If you need to reset the cursor before the while loop, try using cursor.moveToPosition( -1 ). Steven Studio LFP http://www.studio-lfp.com On Friday, October 28, 2011 10:12:01 AM UTC-5, André wrote: cursor.moveToFirst(); while (cursor.moveToNext()) { ...} When I use this code the first row in my cursor seems to be skipped. It feels wrong to make the cursor jump back one step in while every time. How would I get the first row ? //André -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to call native (JNI) code from test application
The static initializer of your Java wrapper should be loading the library. Do you have a System.loadLibrary() call in there? If you do, make sure you have copied the .so file into the proper location in the libs directory of your project. Steven Studio LFP http://www.studio-lfp.com On Friday, October 28, 2011 12:46:58 PM UTC-5, mellery451 wrote: I'm building an app and I have a corresponding test application for it. One of the first items I have added is some native code for a well- encapsulated computation (hashing). I now want to test this native code from my test application. I've imported the JNI wrapper class into my InstrumentationTestCase based test class - and with that, I'm able to compile the application. However, at runtime (running the tests) I get an UnsatisfiedLinkError thrown when the test tries to invoke the native method. Does anyone know to call native code from a test app? Do I need to somehow force the native library to be part of the test application so that it can be loaded? -- 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: Contact Prediction
You may want to check out the AutoCompleteTextView here: http://developer.android.com/reference/android/widget/AutoCompleteTextView.html You can put a cursor adapter behind it that connects to the contacts in the device. Steven Studio LFP http://www.studio-lfp.com On Friday, October 28, 2011 1:23:24 PM UTC-5, DAVIDT wrote: Hi All Exist some way for make Contact Prediction, I've saw that some apps dialer or contact list, (Go Dialer, Youlu Address Book). Appears in your contact list, contact from gmail or skype, these infomation is saves in some provider Best Regards David -- 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: Stack overflow error
Put a log output in your onFocusChange and run it again. I think you may find you are causing an infinite loop. Notice in your error log that they are all on the same millisecond and you have multiple onFocusChange hits. Without more code, I can't validate this for sure, but I've seen this before. You have to be careful when using onFocusChange when you are changing the view structure because of the focus change. Changing the view structure can cause additional focus changes, which in turn, can cause an infinite loop. It might be what is happening to you there. Steven Studio LFP http://www.studio-lfp.com On Friday, October 28, 2011 2:05:33 PM UTC-5, vani wrote: 10-29 00:32:31.026: ERROR/AndroidRuntime(312): java.lang.StackOverflowError 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.requestChildFocus(ViewGroup.java:431) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.addViewInner(ViewGroup.java:1998) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.addView(ViewGroup.java:1865) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.addView(ViewGroup.java:1822) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.addView(ViewGroup.java:1802) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at com.tli.meetcha.SearchClass$1.onFocusChange(SearchClass.java:116) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.View.onFocusChanged(View.java:2666) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.widget.TextView.onFocusChanged(TextView.java:6469) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.View.handleFocusGainInternal(View.java:2489) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.View.requestFocus(View.java:3605) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1073) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.requestFocus(ViewGroup.java:1029) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1073) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.requestFocus(ViewGroup.java:1029) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1073) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.requestFocus(ViewGroup.java:1029) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1073) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.requestFocus(ViewGroup.java:1032) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.View.requestFocus(View.java:3556) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewRoot.clearChildFocus(ViewRoot.java:1586) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.clearChildFocus(ViewGroup.java:508) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.clearChildFocus(ViewGroup.java:508) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.clearChildFocus(ViewGroup.java:508) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.clearChildFocus(ViewGroup.java:508) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.removeViewInternal(ViewGroup.java:2207) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.removeViewInternal(ViewGroup.java:2181) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.removeView(ViewGroup.java:2129) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at com.tli.meetcha.SearchClass$1.onFocusChange(SearchClass.java:120) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.View.onFocusChanged(View.java:2666) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.widget.TextView.onFocusChanged(TextView.java:6469) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.View.unFocus(View.java:2594) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.unFocus(ViewGroup.java:536) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.requestChildFocus(ViewGroup.java:425) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.requestChildFocus(ViewGroup.java:431) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.addViewInner(ViewGroup.java:1998) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.addView(ViewGroup.java:1865) 10-29 00:32:31.026: ERROR/AndroidRuntime(312): at android.view.ViewGroup.addView
[android-developers] Re: \n Does NOT work ?
\n works if you are on a Unix based system. If you are using a Windows (DOS) based system, you'll want to use \r\n. Are you looking at your file in an text editor like notepad on a Windows system? Steven Studio LFP http://www.studio-lfp.com On Friday, October 28, 2011 4:43:17 PM UTC-5, melis wrote: Hello, i'm using \n but it does not create a new line? Is there anyone knows why? mCurrentFile.write(z: +String.valueOf(value[a * 4 + 3])+ \n); -- 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 fragmentation study
Eh, it's not that bad. If you look at the history of developers, we're already use to having to deal with a lot worse fragmentation issues than Android. Anyone that's ever developed a website correctly knows that supporting the available web browsers is a lot more of a challenge than with Android versions. Windows, Mac OSX, a ton of server technologies, databases, etc., they all have tons of different versions available to support. Most companies stick with older versions because it is what they have and it is working. When it comes to Android, I've been pleasantly surprised at the efforts Google has gone through to help manufacturers upgrade. Even though 2.1, 2.2 and 2.3 are different, they aren't so much different that in most cases you can't treat them as 2.x. It seems to me that Android is more broken up in 1.x, 2.x, 3.x and now 4.x instead of the individual versions themselves. I'd rather a little fragmentation in Android than for them to pull an Apple and everyone is the exact same, right down to the hardware level. Variety is something we need in the mobile market, not a one device fits all concept. Steven Studio LFP http://www.studio-lfp.com On Thursday, October 27, 2011 10:36:24 AM UTC-5, Greg Donald wrote: http://theunderstatement.com/post/11982112928/android-orphans-visualizing-a-sad-history-of-support Wow.. I knew it was bad, but man. most app developers will end up targeting an ancient version of the OS in order to maximize market reach. I totally agree.. It will literally be years before I will begin to care about the new 4.0. I'm still supporting devices running 2.1 and will be for some time to come. -- Greg Donald -- 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: The current state of C2DM
I don't have any battled tested apps using it at the moment, but I have been testing it on some internal applications for a company. The whole process was fairly simple and seems to be reliable so far. Again, I'm in the testing phase so I'm not sending a large amount of requests a day. It took about 30-60 minutes from start to finish for both the Android and server side to get working with no previous knowledge of it. I'd recommend you test it out for yourself. Just remember that it requires the Android Market to function properly, so it will restrict you from some hardware. Steven Studio LFP http://www.studio-lfp.com On Monday, October 24, 2011 7:43:20 PM UTC-5, Chris Stewart wrote: It's been quite awhile since I last looked into C2DM and at that time I remember a lot of developers were not recommending it for various reasons, although I don't remember those reasons today. I'm very much in need of push notification support for an app I'm building, so I've started looking into C2DM again. I'm curious if the general attitude toward it has changed with the developers here and if anyone has trench-level battle stories they'd care to share. -- Chris Stewart http://chriswstewart.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: Data values not populating in the gridview on screen orientation using onConfigurationChanged
Regardless of which way you choose to go, configChanges or not, you'll want to cache any response you receive via HTTP. There are a lot of ways to cache these items. You could use static variables, save them temporarily to files on the internal or external (SD Card), add them to a database, etc.. Just remember to use disk storage if you need/want longer term cache copies as static variables are volatile. When the view changes, just pull from the cached copies for the new layout. This could also be valuable for having something to display when a users runs your app again. You can keep the cached copy to display to them while you check for updated resources, then just replace anything that has been updated. This will make sure your users won't just be looking at a blank screen while you retrieve whatever info you need. Caching information is your friend and coming up with a good cache/update scheme that works for your environment will give your users a better overall experience. Steven Studio LFP http://www.studio-lfp.com On Tuesday, October 25, 2011 2:29:21 AM UTC-5, Shajahan wrote: Hi Steven, Thanks for the response. I wanted to know, whether is there any approach to handle this situation. I don't want to invoke the HTTP connection every time on the onCreate() method for screen orientation(intentionally or unintentionally by the user)because then that's beats the user response. I am trying out various approach like onConfigurationChanged() etc for handling screen orientation. Though its reflect the xml(landscape) from the res folder but values are not populated in the gridview On Oct 24, 8:58 pm, Studio LFP studi...@gmail.com wrote: Are you repopulating the information into the new layout you are switching to? Regardless of if you use configChanges or not, you need to repopulate your view. This is automatically invoked without configChanges since your app interface is removed and remade (calling onCreate again for you). If you are using configChanges, you will need to repopulate your views if you change it on one of the onConfigurationChanged events. Steven Studio LFPhttp://www.studio-lfp.com On Monday, October 24, 2011 7:58:52 AM UTC-5, Shajahan wrote: In the onCreate() method of an activity -- done all the initialization part and also invoked the server using the HTTP connection, to get the images -- am using the onConfigurationChanged() of an activity to get the handle of the Screen Orientation -- but when it is rotated from horizontal to Vertical (vice-versa) new xml for landscape view getting reflected but the not values in the gridview -- 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
Re: [android-developers] Re: Cache issue
The way you cache and access that cache can change depending on how you display the items. If you have that many images, you may want to make thumbnails of them and display those first. This would speed up load times. You could load and hold onto the reference to the full image as the user selected them. Remember you are working in an environment that there will be no way the user can look at all 200 of your full size images at the same time, so plan accordingly. Without knowing what you are trying to accomplish, there's not a lot more we can help you with. Steven Studio LFP http://www.studio-lfp.com On Tuesday, October 25, 2011 11:43:36 AM UTC-5, NAVI NEW wrote: I have already implemented this one, that's running but not gatting way for all http://www.flexjockey.com/2011/03/create-a-pretty-simple-cache-for-android/ On Tue, Oct 25, 2011 at 9:29 PM, skink psk...@gmail.com wrote: On Oct 25, 5:41 pm, NAVI NEW navi...@gmail.com wrote: Please some one give me best idea for this issue. On Tue, Oct 25, 2011 at 8:04 PM, NAVI NEW navi...@gmail.com wrote: Hello Sir, I am downloading 200 images and saving sdcard form server but now facing time issue taking more time. i want to store permanently image in cache and handle them always please help me. i am not getting perfect solution how to store image in cache for handle . -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en best idea is just to write it to the sdcard and read it again to speed things out. what did you try so far? 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-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@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: Help needed to troubleshoot code
Couple of things here... 1. You are calling run() on the thread, not the one you have defined in your activity. 2. You don't want to call run() on the thread, you want to call start(). 3. You either need to create a Runnable to post to the thread or you need to extend Thread and insert your own code. Try this: private void doLogin() { LoginThread ltNew = new LoginThread(); ltNew.start(); } private class LoginThread extends Thread { @Override public void run() { // Your login code here } } That is one option. Give it a try and see if it does what you need it to. Steven Studio LFP http://www.studio-lfp.com On Wednesday, October 26, 2011 11:07:46 AM UTC-5, nk wrote: Can someone help me out please ... I have tried everything but am unable to run the thread in the code posted at this question... Thanks On Mon, Oct 24, 2011 at 1:48 AM, naman naman...@gmail.com wrote: Hello all, I am trying to build an app for android and am having issues with HTTP authentication I have asked the same question at stackoverflow but unfortunately have not recieved any responses to it... The question is here stackoverflow queshttp://stackoverflow.com/q/7860268 . Can someone help me with this regard... Please note that I have checked the basic errors that could be there by setting the permissions in the manifest file etc but I have observed that neither the thread nor the code for sending the data runs. Thanks -- Naman -- Naman -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to publish an app requiring mp3 files on sd card
You could pack the MP3's in the APK and then copy them from the APK to the SD card. They will still be in the APK, but you will have them on the SD card also. You can also publish the APK without them then check for them when you run, and if they aren't there, download them from a server. Is there a reason you don't want to use them from the APK? Steven Studio LFP http://www.studio-lfp.com On Wednesday, October 26, 2011 3:47:40 PM UTC-5, GIMMESHELTER wrote: I have not been successful locating a doc telling me how to publish an app requiring mp3 files on sd card... My app needs to publish with 7-8 mp3 files. How do I do 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: help me
I think you may have wandered into the wrong group. This is for Android development mainly dealing with the Java side of things. There is an NDK group if you are looking for the C/C++ side of things. You may also want to check out other groups that have to do with modifying the Android base if you are looking for something really low level. Steven Studio LFP http://www.studio-lfp.com On Monday, October 24, 2011 9:20:18 AM UTC-5, RAJU wrote: how to run c,c++ program in terminal... ~~RAJU~~ ~~www.itdoall.co.cc~~ -- 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
Re: [android-developers] Re: alarm type application: alarm manager not waking up application
Have you considered using a MediaPlayer instead of just a straight Ringtone object? You can pass the URI of the Ringtone to the MediaPlayer and have better functionality. I use the MediaPlayer and create a MediaPlayer.OnCompletionListener to watch for the end of the playing. This doesn't always fire, so I also use a postDelayed to make sure I check for the end also. You can use MediaPlayer.getDuration() and use it to set the time for your postDelayed. Here are some of the APIs I make use of: http://developer.android.com/reference/android/media/MediaPlayer.html http://developer.android.com/reference/android/media/MediaPlayer.OnCompletionListener.html http://developer.android.com/reference/android/media/MediaPlayer.html#getDuration%28%29 It's worth upgrading to a more full featured audio player if you want better control. *Note:* I've experienced times where the audio just stops playing without posting back a callback like MediaPlayer.OnCompletionListenerhttp://developer.android.com/reference/android/media/MediaPlayer.OnCompletionListener.html, MediaPlayer.OnErrorListenerhttp://developer.android.com/reference/android/media/MediaPlayer.OnErrorListener.htmlor MediaPlayer.OnInfoListenerhttp://developer.android.com/reference/android/media/MediaPlayer.OnInfoListener.html. Not sure if it was a hardware thing, but I tried everything and there would be times where I'd not get any notification of it stopping. Because of that fact, I do recommend the postDelayed with the duration (plus a slight time padding) of the audio to finish any clean-up after the audio. Steven Studio LFP http://www.studio-lfp.com On Monday, October 24, 2011 7:48:07 AM UTC-5, John Goche wrote: On Mon, Oct 24, 2011 at 1:57 AM, John Goche johng...@googlemail.comwrote: Well, here is what I am doing now: I acquire a wakelock inside the broadcast receiver and release it from my activity. The only problem I have is that the play() method is asynchronous. I would like to be notified when the sound stops playing via a callback but I see no method for doing so here: http://developer.android.com/reference/android/media/Ringtone.html#play%28%29 I wonder whether there is a way to detect this without having to poll calling isPlaying() every second or so. Well, here is the solution to turning off the wakelock when the sound stops playing: Regards, John Goche this.ringtone = RingtoneManager.getRingtone(this, uri); if (this.ringtone != null) this.ringtone.play(); // check every five minutes if ringtone is done // and release wake lock when done playing alarm sound final int checkInterval = 5000; final Runnable runnable = new Runnable() { public void run() { System.out.println(I'm running!!!); System.out.println(!AlarmExpiredActivity.this.ringtone.isPlaying()); System.out.println(OK.); if (AlarmExpiredActivity.this.ringtone != null !AlarmExpiredActivity.this.ringtone.isPlaying()) WakeLockManager.putWakeLock(); else AlarmExpiredActivity.this.view.postDelayed(this, checkInterval); } }; this.view.postDelayed(runnable, checkInterval); -- 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: Storing database of information?
Have you considered just making the application come without data and then pull the data from a server? It would be much easier on you to not have to republish the application every time you wanted to change some of that data. The basic steps would be something like this: 1. Publish app without data 2. App checks for the last time it got data against the last update on the server 3. Download updated data if needed You could have it check in the background each time the user used the application and notify them that they needed an update or use C2DM for push notifications. Steven Studio LFP http://www.studio-lfp.com On Monday, October 24, 2011 8:32:48 AM UTC-5, Todilo wrote: Hi, sorry for a bad subject name, just couldn't name it in a good way. I have an application which is basicly like a wiki which presents information and images. This information will change frequently (and images) as well so I was wondering the best way to set it up. It basically is a list of units and their statistics for a game. Since unit information and statistics will change after each patch I need to send that information out with an updated version of the app. What is a good way of storing this information? Can I have a database which I recreate upon every update(user will not change the data himself) or is it better to just have .txt/xml files describing unit information? Ideas? Been away from android programming for some time. -- 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: Check whether media player is playing media or not
You can't use MediaPlayer.isPlaying() as a static method as it is an instanced method. You can have the MediaPlayer instance you create/use be in a static variable and work with it from there. Steven Studio LFP http://www.studio-lfp.com On Monday, October 24, 2011 9:38:39 AM UTC-5, Sunil Mishra wrote: Can i use MediaPlayer as a static object? On Oct 24, 6:57 pm, Jeremy Dagorn jeremy...@gmail.com wrote: Hi, http://developer.android.com/reference/android/media/MediaPlayer.html... MediaPlayer.isPlaying()? On Oct 24, 9:23 am, Sunil Mishra sunilj...@gmail.com wrote: Hi, Is there any api through which we can figure out whether media player is currently playing any media or not? -- 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: Data values not populating in the gridview on screen orientation using onConfigurationChanged
Are you repopulating the information into the new layout you are switching to? Regardless of if you use configChanges or not, you need to repopulate your view. This is automatically invoked without configChanges since your app interface is removed and remade (calling onCreate again for you). If you are using configChanges, you will need to repopulate your views if you change it on one of the onConfigurationChanged events. Steven Studio LFP http://www.studio-lfp.com On Monday, October 24, 2011 7:58:52 AM UTC-5, Shajahan wrote: In the onCreate() method of an activity -- done all the initialization part and also invoked the server using the HTTP connection, to get the images -- am using the onConfigurationChanged() of an activity to get the handle of the Screen Orientation -- but when it is rotated from horizontal to Vertical (vice-versa) new xml for landscape view getting reflected but the not values in the gridview -- 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
Re: [android-developers] Re: Handling asynchronous events and blocking
Nice, I'll have to play with that too. I never ran into any exceptions because I use touches very little in the game I am playing around with. Steven Studio LFP http://www.studio-lfp.com On Monday, October 24, 2011 7:16:47 AM UTC-5, TreKing wrote: On Mon, Oct 24, 2011 at 1:20 AM, Peter Webb r.pete...@gmail.com wrote: This must be a very common problem, and I would expect a simple standard solution. As I mentioned, on other platforms I have used a guaranteed atomic process (file creation)as a semaphore for synchronisation, but I doubt that is the recommended solution for Android ... http://developer.android.com/reference/java/util/concurrent/package-summary.html - 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: Network related
Try this out. I don't recommend using this as is. You'll want to register a receiver for this intent while your app is being used and then unregister it when you are done. This is just so you can see how it works. public class TestService extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if( intent.getAction().equals( android.net.conn.CONNECTIVITY_CHANGE ) ) { Log.i( TestService, android.net.conn.CONNECTIVITY_CHANGE ); NetworkInfo niCommon = intent.getParcelableExtra( ConnectivityManager.EXTRA_NETWORK_INFO ); if( niCommon != null ) { Log.i( TestService, Network Type: + niCommon.getTypeName() ); Log.i( TestService, Network Type: + niCommon.getDetailedState().toString() ); } } } } And I believe you need this in your manifest: receiver android:name=.services.TestService intent-filter action android:name=android.net.conn.CONNECTIVITY_CHANGE/ /intent-filter /receiver uses-permission android:name=android.permission.ACCESS_NETWORK_STATE/ See how that works out for you as a test. Steven Studio LFP http://www.studio-lfp.com On Monday, October 24, 2011 1:01:56 AM UTC-5, sourabh wrote: I have a TextView, what I want is whenever my Network comes online/offline.It should get reflected to TextView. How Can I do this. Please suggest. Thanks, Sourabh -- 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: about layout sizes
I think when you assign it programmatically it defaults to standard pixels. You would need to get the DisplayMetrics and multiply your pixels by the DisplayMetrics.density to get the same thing as dip/dp in the XML. Steven Studio LFP http://www.studio-lfp.com On Monday, October 24, 2011 1:29:22 PM UTC-5, hecto...@yahoo.com wrote: hi guys, I am finding out that a layout (or button) size is different when doing the definition as folows: ((RelativeLayout) (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).setVisibility(VISIBLE); ((RelativeLayout) (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).getLayoutParams().width=100; ((RelativeLayout) (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).getLayoutParams().height=90; ((RelativeLayout) (app.main_gui.get(RoulleteGlobals.WHEEL_1_3_IDX))).requestLayout(); etc than when defining the xml resource: RelativeLayout android:id=@+id/wheel1_3 xmlns:android=http://schemas.android.com/apk/res/android; android:layout_centerInParent=true android:layout_width=100dip android:layout_height=90dip android:textSize=14dip android:gravity=clip_vertical RelativeLayout android:id=@+id/wheel1_2 xmlns:android=http://schemas.android.com/apk/res/android; android:layout_centerHorizontal=true android:layout_centerVertical=true android:layout_width=70dip android:layout_height=60dip android:textSize=14dip android:gravity=clip_vertical Button android:id=@+id/wheel1_1 android:layout_centerInParent=true android:layout_width=65dip android:layout_height=55dip android:textStyle=bold|italic android:textSize=14dip android:textColor=# / /RelativeLayout /RelativeLayout I mean, the screen looks with different sizes for each situation, and i am looking for same sizes in both cases. I wonder in isn related with another parameter, like density or so on ... -- 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
Re: [android-developers] Re: Eclipse, ADT and opening XML files
You keep referring to Eclipse 3.7.1 Classic, have you tried Eclipse IDE for Java Developers to see if you get the same results? The Classic package is definitely larger and may come with something that is fighting for default privileges for the XML files. I've done multiple clean installs of Eclipse IDE for Java Developers + ADT and haven't run into this issue. I also have a tendency to have multiple Eclipse installs and specialize them as a lot of the plugins don't like to play nice with each other. Might be worth a shot to get that resolved. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 11:40:54 AM UTC-5, Kostya Vasilyev wrote: That's interesting. While trying to resolve this, I did a clean install (unzip) of Eclipse 3.7.1 and a new install of ADT. Filed a bug here: http://code.google.com/p/android/issues/detail?id=21124 -- Kostya 23.10.2011 9:58, Walt Armour пишет: I'm seeing this behaviour as well. I just had a disk crash and had to reinstall all of Eclipse and the Android SDK. Previously I was running Eclipse Helios with the latest Android SDK and latest ADT (r14). All XML files opened automatically with the appropriate Android XML helper/editor. This morning I reinstalled (not the OS, just the dev bits) and put on Eclipse Indigo along with the same SDK and ADT versions (new installs, but same versions). Now the XML files only open with the default Eclipse XML editor. The right-click, open with.. part will open them with the ADT helpers. This is also on Windows 7 x64. The new (broken?) behaviour has persisted across reimporting the project and reinstalling the ADT. Does anyone know of a switch that can be set or preferences to tweak or anything that will provide the correct behaviour? I'm wondering if the behaviour will return if I reinstall Helios but I'm not quite ready to do that. On Oct 19, 9:34 am, Kostya Vasilyevkman...@gmail.com wrote: With the two recent releases of ADT (it seems), my XML files by default don't open with the appropriate Android editor. The editor they open with is not the plain text editor, but rather some kind structured editor with XML tag highlighting, and a Design tab that lists the XML file structure. Earlier, Android layout XML files would open with the ADT layout editor, and other Android-specific XML files would open with Android specific editors as well. It seems like this broke with ADT 13, or maybe after I switched to Eclipse 3.7, I'm not sure. I tried using Eclipse preferences to associate *.xml files with the Android Layout editor, but that affects values/*.xml, menu/*.xml, etc., with very interesting effects. It is possible to right click on a file and select Open With, but I also like to use Ctrl+Shift+R to navigate among my XMLs more quickly. Is anyone else seeing this? Is there a fix? Oh, and I just reinstalled Eclipse 3.7.1 Classic from scratch, as well as ADT r14. Made no difference. I'm on Windows 7 / 64 bit, which has not changed either. -- Kostya Vasilyev -- 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
Re: [android-developers] Re: alarm type application: alarm manager not waking up application
Not sure this is it, but I noticed on this line of your code: pendingIntent = PendingIntent.getBroadcast(ctx, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); You are sending a 0 as the second argument, try sending something other than 0 there. I've noticed in my own experience that this doesn't like to be zero. Also, try changing the flags to: PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT I've used this combination with my RingLock application and it has never failed me. I had issues when sending a 0 as the request code and the flags that don't cancel previous timer events. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 3:24:36 PM UTC-5, John Goche wrote: Kostya, Thank you for your reply. However left me give an update on the testing I have carried out. I have reinstalled the app from scratch and set alarms to expire every five minutes (each time an alarm goes off it sets up the next one for the next five minutes). Here is what I have observed: - The first alarm goes off just fine and I see the popup window and hear the sound. - If I keep fiddling with the device the next alarm goes off and I see the popup window and hear the sound so long as I keep fiddling with the device. - As soon as I have not fiddled with the device for five minutes (the screen goes blank after one minute) the alarm goes off and the popup window exists behind the darkness and I hear the sound, but at the next alarm time the popup window is not displayed, and neither the next one nor the next one and so on - Then when I press a hardware button and the screen lights up the next alarm that goes off has the popup window pop up and the sound play. - Again, if I do not touch the phone, the five minute later alarm sounds but not the next one nor the next one. In adb logcat the only suspicious line I can suspect is the following after I try to launch my activity: D/KeyguardViewMediator( 1563): !com.android.internal.policy.impl.KeyguardViewMediator 643! wakeWhenReadyLocked(4) In dumpsys alarm I see all of my 11 wakeups and 11 alarms. % So now I must learn how to keep the CPU running or when the alarm goes off I will not be able to pop up the window and play the sound. When I leave the phone for a while the CPU hybernates or something it seems, so my RTC_WAKEUP calls the broadcast receiver but does not pop up the intent it seems. Can someone please teach me how to use wakelocks and exactly what they are so that I may fix this problem either by keeping the CPU running all the time, or in some more efficient way if possible? Thanks a lot, John Goche On Sun, Oct 23, 2011 at 6:35 PM, Kostya Vasilyev kman...@gmail.comwrote: Hi, No need to keep a PendingIntent reference - they are compared by Android like Strings (one could say), based on their content, not just by reference. In fact, setting an alarm automatically cancels all alarms that may have been set with the same pending intent. The problem is that in my function sometimes based on what the user does in the user interface I sometimes need to cancel the alarm without setting a new one, so that is why I keep the static pending intent around, otherwise how do I go about cancelling the alarm without setting a new one? As far as the sound goes. Wake-up alarms only hold the wake lock long enough to call onReceive. What kind of wake lock? Because I see there are four kinds and am still struggling to understand what I'm supposed to do with the wake lock. Does your code hold a wake lock while playing the sound? No, only when launching the intent. You could also use a Notification with sound (perhaps as a test), I believe they take care of holding the device awake for themselves. Just make sure to post the notification from onReceive, while the system is holding a wake lock for you. That means I have to learn all about notifications as I have never used them before. So notifications hold the wake lock... I could use a notification and a pop up at the same time??? -- 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
Re: [android-developers] Re: Eclipse, ADT and opening XML files
What's recommended and what works are not always the same thing. Have you and Michael A. both been opening an existing Workspace even after a fresh install of Eclipse? A lot of settings for Eclipse are stored in the metadata directory of the Workspace and it might be hanging on to some of the settings you don't want. Have either of you tried using a new clean Workspace and see if the problems still exist? Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 3:07:46 PM UTC-5, Kostya Vasilyev wrote: The install doc says that Classic is the recommended edition for Android: http://developer.android.com/sdk/installing.html#Preparing I used to use the Java edition, the issue originally started occurring there. -- Kostya 24.10.2011 0:00, Studio LFP пишет: You keep referring to Eclipse 3.7.1 Classic, have you tried Eclipse IDE for Java Developers to see if you get the same results? The Classic package is definitely larger and may come with something that is fighting for default privileges for the XML files. I've done multiple clean installs of Eclipse IDE for Java Developers + ADT and haven't run into this issue. I also have a tendency to have multiple Eclipse installs and specialize them as a lot of the plugins don't like to play nice with each other. Might be worth a shot to get that resolved. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 11:40:54 AM UTC-5, Kostya Vasilyev wrote: That's interesting. While trying to resolve this, I did a clean install (unzip) of Eclipse 3.7.1 and a new install of ADT. Filed a bug here: http://code.google.com/p/android/issues/detail?id=21124 -- Kostya 23.10.2011 9:58, Walt Armour пишет: I'm seeing this behaviour as well. I just had a disk crash and had to reinstall all of Eclipse and the Android SDK. Previously I was running Eclipse Helios with the latest Android SDK and latest ADT (r14). All XML files opened automatically with the appropriate Android XML helper/editor. This morning I reinstalled (not the OS, just the dev bits) and put on Eclipse Indigo along with the same SDK and ADT versions (new installs, but same versions). Now the XML files only open with the default Eclipse XML editor. The right-click, open with.. part will open them with the ADT helpers. This is also on Windows 7 x64. The new (broken?) behaviour has persisted across reimporting the project and reinstalling the ADT. Does anyone know of a switch that can be set or preferences to tweak or anything that will provide the correct behaviour? I'm wondering if the behaviour will return if I reinstall Helios but I'm not quite ready to do that. On Oct 19, 9:34 am, Kostya Vasilyevkma...@gmail.com wrote: With the two recent releases of ADT (it seems), my XML files by default don't open with the appropriate Android editor. The editor they open with is not the plain text editor, but rather some kind structured editor with XML tag highlighting, and a Design tab that lists the XML file structure. Earlier, Android layout XML files would open with the ADT layout editor, and other Android-specific XML files would open with Android specific editors as well. It seems like this broke with ADT 13, or maybe after I switched to Eclipse 3.7, I'm not sure. I tried using Eclipse preferences to associate *.xml files with the Android Layout editor, but that affects values/*.xml, menu/*.xml, etc., with very interesting effects. It is possible to right click on a file and select Open With, but I also like to use Ctrl+Shift+R to navigate among my XMLs more quickly. Is anyone else seeing this? Is there a fix? Oh, and I just reinstalled Eclipse 3.7.1 Classic from scratch, as well as ADT r14. Made no difference. I'm on Windows 7 / 64 bit, which has not changed either. -- Kostya Vasilyev -- 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-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@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
Re: [android-developers] Re: Eclipse, ADT and opening XML files
Ok found something really strange. I reproduced your error and I noticed that my XML files were doing the same things yours was in a fresh install except one named main.xml. Well, I noticed that all the others I had had underscores in them, i.e. main_view.xml. I removed the underscore from them and they worked... !? Check your XML file names and see if the same thing is happening to you. Every one of the files that I removed the underscore from started working right. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 4:40:01 PM UTC-5, Kostya Vasilyev wrote: Yes. After reinstalling Eclipse, I did a fresh clone of the sources from my Mercurial repository and did a fresh import into a new Eclipse workspace. My .metadata directory is not checked in, so Eclipse created a new one. Oh, and the issue occasionally occurs for me under Ubuntu 11 (.04, I believe - don't use it much). -- Kostya 24.10.2011 1:14, Studio LFP пишет: What's recommended and what works are not always the same thing. Have you and Michael A. both been opening an existing Workspace even after a fresh install of Eclipse? A lot of settings for Eclipse are stored in the metadata directory of the Workspace and it might be hanging on to some of the settings you don't want. Have either of you tried using a new clean Workspace and see if the problems still exist? Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 3:07:46 PM UTC-5, Kostya Vasilyev wrote: The install doc says that Classic is the recommended edition for Android: http://developer.android.com/sdk/installing.html#Preparing I used to use the Java edition, the issue originally started occurring there. -- Kostya 24.10.2011 0:00, Studio LFP пишет: You keep referring to Eclipse 3.7.1 Classic, have you tried Eclipse IDE for Java Developers to see if you get the same results? The Classic package is definitely larger and may come with something that is fighting for default privileges for the XML files. I've done multiple clean installs of Eclipse IDE for Java Developers + ADT and haven't run into this issue. I also have a tendency to have multiple Eclipse installs and specialize them as a lot of the plugins don't like to play nice with each other. Might be worth a shot to get that resolved. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 11:40:54 AM UTC-5, Kostya Vasilyev wrote: That's interesting. While trying to resolve this, I did a clean install (unzip) of Eclipse 3.7.1 and a new install of ADT. Filed a bug here: http://code.google.com/p/android/issues/detail?id=21124 -- Kostya 23.10.2011 9:58, Walt Armour пишет: I'm seeing this behaviour as well. I just had a disk crash and had to reinstall all of Eclipse and the Android SDK. Previously I was running Eclipse Helios with the latest Android SDK and latest ADT (r14). All XML files opened automatically with the appropriate Android XML helper/editor. This morning I reinstalled (not the OS, just the dev bits) and put on Eclipse Indigo along with the same SDK and ADT versions (new installs, but same versions). Now the XML files only open with the default Eclipse XML editor. The right-click, open with.. part will open them with the ADT helpers. This is also on Windows 7 x64. The new (broken?) behaviour has persisted across reimporting the project and reinstalling the ADT. Does anyone know of a switch that can be set or preferences to tweak or anything that will provide the correct behaviour? I'm wondering if the behaviour will return if I reinstall Helios but I'm not quite ready to do that. On Oct 19, 9:34 am, Kostya Vasilyevkma...@gmail.com wrote: With the two recent releases of ADT (it seems), my XML files by default don't open with the appropriate Android editor. The editor they open with is not the plain text editor, but rather some kind structured editor with XML tag highlighting, and a Design tab that lists the XML file structure. Earlier, Android layout XML files would open with the ADT layout editor, and other Android-specific XML files would open with Android specific editors as well. It seems like this broke with ADT 13, or maybe after I switched to Eclipse 3.7, I'm not sure. I tried using Eclipse preferences to associate *.xml files with the Android Layout editor, but that affects values/*.xml, menu/*.xml, etc., with very interesting effects. It is possible to right click on a file and select Open With, but I also like to use Ctrl+Shift+R to navigate among my XMLs more quickly. Is anyone else seeing this? Is there a fix? Oh, and I just reinstalled Eclipse 3.7.1 Classic from scratch, as well as ADT r14. Made no difference. I'm on Windows 7 / 64 bit, which has not changed either. -- Kostya Vasilyev -- Kostya Vasilyev -- You received this message
Re: [android-developers] Re: Eclipse, ADT and opening XML files
Ok, scratch that... got it working with underscores in it also. Not sure exactly how I got it to work, but I did get the layout files to work correctly in 3.7.1 Classic that wasn't working by default. I used the Android Tools Fix Project Properties first, then I forced the default XML handler to Android Binary XML. I also removed the XML category all together in the File Association section in there somewhere. Closed the project, reopened the project and it started to work. Not sure what exactly fixed it, but now everything I open in those projects work right. Steven Studio LFP http://www.studio-lfp.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: Eclipse, ADT and opening XML files
Ok, tested another imported project and it didn't work correctly. I ran the Android Tools Fix Project Properties, closed and reopened the project. All the layouts seem to load correctly once I did this. This seems to be the minimum steps to correct the issue unless there is something else I did previously that also helped. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 5:26:56 PM UTC-5, Michael A. wrote: Hmm... I don't use underscores in any of my layouts, although I do use them in image file names, strings, etc. Editing the image file names didn't seem to do anything for me, unfortunately. Regards, Michael A. On Oct 24, 12:14 am, Studio LFP studi...@gmail.com wrote: Ok found something really strange. I reproduced your error and I noticed that my XML files were doing the same things yours was in a fresh install except one named main.xml. Well, I noticed that all the others I had had underscores in them, i.e. main_view.xml. I removed the underscore from them and they worked... !? Check your XML file names and see if the same thing is happening to you. Every one of the files that I removed the underscore from started working right. Steven Studio LFPhttp://www.studio-lfp.com On Sunday, October 23, 2011 4:40:01 PM UTC-5, Kostya Vasilyev wrote: Yes. After reinstalling Eclipse, I did a fresh clone of the sources from my Mercurial repository and did a fresh import into a new Eclipse workspace. My .metadata directory is not checked in, so Eclipse created a new one. Oh, and the issue occasionally occurs for me under Ubuntu 11 (.04, I believe - don't use it much). -- Kostya 24.10.2011 1:14, Studio LFP пишет: What's recommended and what works are not always the same thing. Have you and Michael A. both been opening an existing Workspace even after a fresh install of Eclipse? A lot of settings for Eclipse are stored in the metadata directory of the Workspace and it might be hanging on to some of the settings you don't want. Have either of you tried using a new clean Workspace and see if the problems still exist? Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 3:07:46 PM UTC-5, Kostya Vasilyev wrote: The install doc says that Classic is the recommended edition for Android: http://developer.android.com/sdk/installing.html#Preparing I used to use the Java edition, the issue originally started occurring there. -- Kostya 24.10.2011 0:00, Studio LFP пишет: You keep referring to Eclipse 3.7.1 Classic, have you tried Eclipse IDE for Java Developers to see if you get the same results? The Classic package is definitely larger and may come with something that is fighting for default privileges for the XML files. I've done multiple clean installs of Eclipse IDE for Java Developers + ADT and haven't run into this issue. I also have a tendency to have multiple Eclipse installs and specialize them as a lot of the plugins don't like to play nice with each other. Might be worth a shot to get that resolved. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 11:40:54 AM UTC-5, Kostya Vasilyev wrote: That's interesting. While trying to resolve this, I did a clean install (unzip) of Eclipse 3.7.1 and a new install of ADT. Filed a bug here: http://code.google.com/p/android/issues/detail?id=21124 -- Kostya 23.10.2011 9:58, Walt Armour пишет: I'm seeing this behaviour as well. I just had a disk crash and had to reinstall all of Eclipse and the Android SDK. Previously I was running Eclipse Helios with the latest Android SDK and latest ADT (r14). All XML files opened automatically with the appropriate Android XML helper/editor. This morning I reinstalled (not the OS, just the dev bits) and put on Eclipse Indigo along with the same SDK and ADT versions (new installs, but same versions). Now the XML files only open with the default Eclipse XML editor. The right-click, open with.. part will open them with the ADT helpers. This is also on Windows 7 x64. The new (broken?) behaviour has persisted across reimporting the project and reinstalling the ADT. Does anyone know of a switch that can be set or preferences to tweak or anything that will provide the correct behaviour? I'm wondering if the behaviour will return if I reinstall Helios but I'm not quite ready to do that. On Oct 19, 9:34 am, Kostya Vasilyevkma...@gmail.com wrote: With the two recent releases of ADT (it seems), my XML files by default don't open with the appropriate Android editor. The editor they open
[android-developers] Re: Eclipse, ADT and opening XML files
See my other post: https://groups.google.com/d/msg/android-developers/DdE5Ql_OZsY/Qb4zkr6z-mkJ I think it has something to do with projects being imported. It must not carry some information about it being an Android project and this needs to be corrected via the Android Tools Fix Project Properties. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 5:24:35 PM UTC-5, Michael A. wrote: So this actually gave me the idea to try the exact opposite - I took my dirty .metadata from my old workspace and copied it over the new clean workspace. Hooray - suddenly opening an Android XML layout file actually opens in the layout editor as it used to. Of course, pretty much nothing else works (the parsing of drawables, layout references are now joined by strings in not being interpreted correctly in the layout editor), so it's doesn't really help all that much. :-) Regards, Michael A. On Oct 23, 11:14 pm, Studio LFP studi...@gmail.com wrote: Have either of you tried using a new clean Workspace and see if the problems still exist? -- 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: Possible to get AppWidget Height?
Last I checked, there is no way to get the actual height and width that your widget will be rendered at. I'm hoping this changes one day as it is a major pain to get your widget to look right on different devices. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 5:04:01 PM UTC-5, Ash McConnell wrote: Hi Folks, I've found that for some Launchers my AppWidgethttps://market.android.com/details?id=sirocco.widgets doesn't format quite correctly as they squash the AppWidgets by 10 or so pixels (to add a page indicator) - e.g. Samsung Galaxy 2 and Sony Experia Arc. They must not provide the same amount of space (even if you consider device independent pixels) as all units use dp. Therefore I need a way to determine the height of an AppWidget. Is there a way? Thanks for your help All the best, Ash -- 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: Impossible to Create Write to or Read From Files in the SD Card
You're on the right track, but it's best not to hardcode the path to a file on the SD Card. Check out this API: http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory%28%29 This will help you get the directory to the SD card. It usually isn't /sdcard, it's usually /mnt/sdcard, but it may move or may be renamed on devices, so it's best to use that or a similar API to help you find it. Check out these APIs also: http://developer.android.com/reference/android/os/Environment.html#getDataDirectory%28%29 http://developer.android.com/reference/android/content/Context.html#getDir%28java.lang.String,%20int%29 http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir%28java.lang.String%29 http://developer.android.com/reference/android/content/Context.html#getFilesDir%28%29 There are a lot of functions in the API to help you find a good spot to put your data files depending on what you are doing. There are even more than this, but this should get you started. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 6:08:22 PM UTC-5, melis wrote: Hi all, i really tried hard but couldn't achieve to create or any other file operations in Android. First thing i did was tp check the availabilty of the SD card media, with the sample code here: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal. I have the media and works properly. Then i tried to create a .txt file with this code snippet: File myFile = new File(/sdcard/mysdfile.txt); myFile.createNewFile(); FileOutputStream fOut = new FileOutputStream(myFile); OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut); myOutWriter.append(txtData.getText()); myOutWriter.close(); fOut.close(); also tried this one, which works in the Java project but not in android: String path = /sdcard/data.txt; File dosya = new File(path); dosya.createNewFile(); last thing i tried is another sample code from android developers; private void createExternalStoragePrivateFile() { // TODO Auto-generated method stub File file = new File(getExternalFilesDir(null),DemoFile.jpg); InputStream is = getResources().openRawResource(R.drawable.icon); try { OutputStream os = new FileOutputStream(file); byte[] data = new byte [is.available()]; is.read(data); os.write(data); os.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); Log.w( External Storage , Error writing + file, e); } } I'm getting no errors but also no files in the sd card. And i don't forget to add uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE/ permission line into the manifest. I'm checking the F driver after executing the program to see if any txt file created, but nothing happened so far. I read SD card is not available when the android device is hooked up to the computer via USB in somewhere. To check this possibility, i also looked at the sd card's context with an laptop sd card adapter but again, i have nothing. Please someone help me. I'm out of 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: Handling asynchronous events and blocking
I figure you are running a thread that does all the processing as not to block the UI thread. If so, one of the ways I've been doing it is to add something like... public static LinkedListMotionEvent uiEvents; ... to a helper object and then check the length of it every time through the processing loop. You can either call length() on this or you can keep up with the count yourself which might be a bit faster. In whatever view you are catching touches, just insert the MotionEvent into this list. This should leave the UI thread clear and let the processing thread get the touches as time allows. Once I process the first event, I remove the event from the list and continue. I tend to only process one per frame so I don't cause hitching in the movement. If you are running about 30 fps, most people won't be able to touch faster than the ~33ms they have between frames anyways. I use a LinkedList so it keeps the touches in the order I insert them so I don't have to worry about out of order touches. Just one idea, someone else may have a more effective one, but hope that helps. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 23, 2011 11:42:50 PM UTC-5, Peter Webb wrote: I don't even know if this is an Android question or a Java question. I am developing a simple game using Lunarlander as a starting point. Input is through OnTouch events. This changes the game's state - eg a touch event may cause some gameplay object to be instantiated. Obviously I don't want this to occur in the middle of processing. How do I best synchronise the OnTouch events with the main game loop? In other environments I have used an atomic event (such as creating a dummy file) as a semaphore to work out when game objects can be safely read and written. What should I do in 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: Facebook SDK error
It looks like you are starting Activity B with startActivityForResult. Are you trying to receive some information back into Activity A from Activity B? If not, you just want to use startActivity instead. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 22, 2011 9:36:10 AM UTC-5, ndiiie90 wrote: Hi guys, i implement facebook sdk in my app and just follow the tutorial. When i call other activity, let's say: the activity that i implement facebook sdk is activity A, from there i can call other activity which is B. From B, i press back button, then it goes back to A. But it returns error: --- 10-22 21:33:23.445: ERROR/AndroidRuntime(538): FATAL EXCEPTION: main 10-22 21:33:23.445: ERROR/AndroidRuntime(538): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=0, data=null} to activity {pt.bm.vv/test.test.Test}: java.lang.NullPointerException 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread.deliverResults(ActivityThread.java:3515) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3557) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread.access$2800(ActivityThread.java:125) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.os.Handler.dispatchMessage(Handler.java:99) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.os.Looper.loop(Looper.java:123) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread.main(ActivityThread.java:4627) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at java.lang.reflect.Method.invokeNative(Native Method) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at java.lang.reflect.Method.invoke(Method.java:521) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at dalvik.system.NativeStart.main(Native Method) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): Caused by: java.lang.NullPointerException 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at test.test.Test.onActivityResult(Test.java:507) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.Activity.dispatchActivityResult(Activity.java:3890) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread.deliverResults(ActivityThread.java:3511) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): ... 11 more --- Anyone has idea to solve this problem? 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: Facebook SDK error
If you are not wanting to return info to Activity A from Activity B, just use startActivity() in Activity A instead of startActivityForResult(). If you use startActivityForResult() to launch Activity B from Activity A, Activity A expects Activity B to send information back when it closes. You'd use something like this if you wanted to send information back from Activity B to Activity A after calling startActivityForResult() from Activity A. Intent iReturn = new Intent(); iReturn.putExtra( someKey, someValue ); setResult( RESULT_OK, iReturn ); finish(); But again, if you aren't wanting a return, use startActivity() to start Activity B. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 22, 2011 10:35:43 AM UTC-5, ndiiie90 wrote: hmm not really.. actually the error is only about when i press back button from activity B, it returns to activity A (where i implement the facebook sdk) but the facebook sdk returns error about nullPointerException since the startActivityForResult has no data for it parameters. how can i solve this? On Oct 22, 10:01 pm, Studio LFP studi...@gmail.com wrote: It looks like you are starting Activity B with startActivityForResult. Are you trying to receive some information back into Activity A from Activity B? If not, you just want to use startActivity instead. Steven Studio LFPhttp://www.studio-lfp.com On Saturday, October 22, 2011 9:36:10 AM UTC-5, ndiiie90 wrote: Hi guys, i implement facebook sdk in my app and just follow the tutorial. When i call other activity, let's say: the activity that i implement facebook sdk is activity A, from there i can call other activity which is B. From B, i press back button, then it goes back to A. But it returns error: --- 10-22 21:33:23.445: ERROR/AndroidRuntime(538): FATAL EXCEPTION: main 10-22 21:33:23.445: ERROR/AndroidRuntime(538): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=0, data=null} to activity {pt.bm.vv/test.test.Test}: java.lang.NullPointerException 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread.deliverResults(ActivityThread.java:3515) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3557) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread.access$2800(ActivityThread.java:125) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.os.Handler.dispatchMessage(Handler.java:99) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.os.Looper.loop(Looper.java:123) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread.main(ActivityThread.java:4627) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at java.lang.reflect.Method.invokeNative(Native Method) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at java.lang.reflect.Method.invoke(Method.java:521) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at dalvik.system.NativeStart.main(Native Method) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): Caused by: java.lang.NullPointerException 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at test.test.Test.onActivityResult(Test.java:507) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.Activity.dispatchActivityResult(Activity.java:3890) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): at android.app.ActivityThread.deliverResults(ActivityThread.java:3511) 10-22 21:33:23.445: ERROR/AndroidRuntime(538): ... 11 more --- Anyone has idea to solve this problem? 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
[android-developers] Re: obtain rectangle on touch
You'll need to keep up with where you draw the squares, do some simple math to decide which one was touched and then draw that square a different color. You might be better served with... http://developer.android.com/reference/android/graphics/Canvas.html#drawRect%28float,%20float,%20float,%20float,%20android.graphics.Paint%29 ...instead of constantly using a Rect if you draw a ton of squares that can be done with a simple formula like that. When you grab the click, divide the touch X by the square width and the touch Y by the square height to get the quadrant the click landed in. Draw that area a different color and there you go. If you do decide to use a Rect, would be better to create it outside the loop and just set the top, left, bottom and right via the fields or use the offset() and offsetTo() functions. Making a new Rect constantly inside the loop is super inefficient. Steven Studio LFP http://www.studio-lfp.com On Wednesday, October 19, 2011 7:35:30 PM UTC-5, JCC wrote: Hello, I don't know much about Android and I would like to know if you people could help. I draw a board using this: private Rect selRect = new Rect(); for (int x = 0; x 20; x++) { if( x%2!=0 ) paint.setColor(Color.CYAN); else paint.setColor(Color.GREEN); for ( int y = 0; y 20; y++) { if ((x%2==0 y%2==0) || (x%2!=0 y%2 !=0)) paint.setColor(Color.GREEN); else paint.setColor(Color.CYAN); selRect = new Rect(x*squareSize, y*squareSize, (x +1)*squareSize, (y+1)*squareSize); canvas.drawRect(selRect, paint); } } so I wanted that using the event onTouch wherever I touch it selects (paints it in a diferent color) that square that I touched. so far I only reached the event.getX() and event.getY() but I don't know how those can be usefull to get the whole square that was touched. Thanks in advance, any help would be much 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: Connection refused - rest web service
A connection refused error seems like there is just something off on your connection path. Have you confirmed that you are aiming the device at the correct IP and port? Are you testing on a development server inside your own network environment or a production server on the internet? What type of data connection are you using on the device and is there any chance of a firewall or carrier blocking that specific port? It would probably be helpful to get a bit more explanation. It doesn't sound like it is an issue with Android since you aren't showing any crashes. If you don't have the right permissions in Android, you'd get a force close and the error in logcat would tell you which ones you were missing. Any information you can give about the setup would help us help you. Steven Studio LFP http://www.studio-lfp.com On Wednesday, October 19, 2011 6:47:26 PM UTC-5, Dalton Cézane wrote: Hello everyone... I have a rest web service (already tested) and I am trying to access it from my android app, but I am getting Connection refused. I already added the tag uses-permission in the AndroidManifest.xml, but the problem still occurs. My url is: LOGIN_URL = http://myIpHere:8000/rest; Can anyone help me? Thanks in advance. -- === Dalton Cézane - Smarteju Tecnologia Especialista em Ciência da Computação (UFCG) Bacharel em Ciência da Computação (UFCG) Técnico em Informática (ETER) -- 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: Display Video view in a curved shape
You may want to try layering windows on top of each other to create the effect you are looking for. For example, place a video window under a ImageView window. Once you have that, populate the ImageView with a solid color PNG that has a transparent shape in it. You can use a FrameLayout or RelativeLayout to hold the two views as they allow views to overlap each other easily. Steven Studio LFP http://www.studio-lfp.com On Monday, October 17, 2011 7:47:45 PM UTC-5, Chenna wrote: Hi I am doing a live video stream and displaying in video view. But this video view is in rectangle. But i want to display video in a curved shape. How to draw a video view into a required shape. thanks Chenna -- 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.text.format.DateFormat.format performance
Actually, the format functions use the StringBuilder and doing a straight concat is currently faster than the format functions. It may not be the StringBuilder slowing down the format functions, but whatever it is doing seem to take a bit longer than it should. No worries though, they give us method to work around it, that's what's important. Steven Studio LFP http://www.studio-lfp.com . On Tuesday, October 18, 2011 7:43:46 AM UTC-5, lbendlin wrote: http://code.google.com/p/android/issues/detail?id=1476 I read somewhere that String.Format works like StringA+StringB in that it creates an entirely new string at each step of the process and dumps the old string. That's why you're supposed to use StringBuilder. -- 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: RFID card reader
Unless there is a Bluetooth version, you would probably need to use a tablet (until ICS) and use the USB functionality in API Version 12 and above: If the RFID reader acts as an input device (like a barcode scanner), you can just plug it in and it should work. I've used USB barcode scanners on my Xoom without any problems. You will need a Bluetooth keyboard if you want to be able to put other text in. If it works like the barcode scanner, it will act as the input device (replace the on-screen keyboard), so the on-screen keyboard won't pop up and that's where the Bluetooth keyboard comes into play. If it doesn't act like a standard input device, you will probably have to talk to it directly via the USB API: http://developer.android.com/reference/android/hardware/usb/package-summary.html You would need developer documentation for the RFID, so that may be a problem. If you have the protocols needed to talk to the RFID reader via USB, then you should be able to do it. Steven Studio LFP http://www.studio-lfp.com On Monday, October 17, 2011 4:08:16 AM UTC-5, nageswara rao rajana wrote: Hi, I want to develop application which need to read data from external RFID card reader. So, my doubt is it possible to connect external RFID card reader to android mobile. If so please provide links related to it. Thanking you, Nagu. -- 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
Re: [android-developers] Re: android.text.format.DateFormat.format performance
Thanks for the update! I just sat down and put together a JNI routine that uses strftime in C and I took my formatting from 50%+ of the routine that was populating my view down to 0.2%. I would call that a significant improvement! Here is the code I used: Java Class public class JNIUtils { private static native String dateFormatJNI( String sFormat, long millis ); static { System.loadLibrary( jniutils ); } public static String dateFormat( String sFormat, long lTime ) { return dateFormatJNI( sFormat, lTime ); } } C File #include jni.h #include time.h JNIEXPORT jstring JNICALL Java_com_company_project_jni_JNIUtils_dateFormatJNI( JNIEnv *env, jclass cls, jstring format, jlong millis ) { time_t javaTime = millis/1000; struct tm * timeInfo; char buffer[32]; const jbyte *str; str = (*env)-GetStringUTFChars( env, format, NULL ); timeInfo = localtime( javaTime ); strftime( buffer, 32, str, timeInfo ); (*env)-ReleaseStringUTFChars( env, format, str ); return (*env)-NewStringUTF( env, buffer ); } I am new to JNI, so I'm not sure how clean this code is. I know C/C++, but I'm getting use to how you have to deal with the Java-to-C layers properly. Regardless, this runs about 250x (or more) faster than the built-in Java version. You may want to check this out if you feel like getting the NDK installed and configured to where you can build the libraries. Steven Studio LFP http://www.studio-lfp.com On Monday, October 17, 2011 5:35:52 PM UTC-5, tlegras wrote: I do confirm using Date is about 2x faster. But I tryed using Calendar as Date.getHours/Minutes etc. is deprecated. The good news is that is even faster: Almost 6x faster than my original which was using DateFormat.format Here is my code: private static Calendar sTmpCalendar = Calendar.getInstance(); // convert timemilli to HH:mm string public static CharSequence Time2DisplayString(long timemilli) { sTmpCalendar.setTimeInMillis(time); int hours = sTmpCalendar.get(Calendar.HOUR_OF_DAY); int minutes = sTmpCalendar.get(Calendar.MINUTE); return ((hours10)?0:)+hours+:+((minutes10)?0:)+ minutes; } 2011/10/14 Thierry Legras tle...@gmail.com Thanks Steven! I will try that. As Date.getHours() etc. methods are mentioned as deprecated. I will check with Calendar class as well if it is still faster than DateFormat. Thierry. 2011/10/14 Studio LFP studi...@gmail.com It is slow and so is String.format(). I've been messing around with it a bit and here is a *rough *sample I tested: private static final String DATE_AM_PM[] = { am, pm }; private static Date dFormat = new Date(); private static int iHour, iAMPM; public static String formatDate( long lTimestamp ) { dFormat.setTime( lTimestamp ); iHour = dFormat.getHours(); if( iHour == 0 ) { iHour = 12; iAMPM = 0; } if( iHour == 12 ) { iAMPM = 1; } else if( iHour 0 iHour 11 ) { iAMPM = 0; } else if( iHour 12 iHour 24 ) { iHour -= 12; iAMPM = 1; } return dFormat.getMonth() + / + dFormat.getDay() + / + (dFormat.getYear() + 1900) + + iHour + : + dFormat.getMinutes() + DATE_AM_PM[ iAMPM ]; } As I said, it is rough and doesn't even format the output fully. I tossed this in my application and used it a bit for a speed test and this takes up half the time as the formatting routines do. Funny thing is, it has nothing to do with the date part. It seems the formatters are using a StringBuffer and some replace functions in the StringBuffer and that is what is slowing it down. I may try to work up a JNI replacement and see if some sprintf or fprintf action fix the issue but it may not because of the extra layer. Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 4:26:32 PM UTC-5, tlegras wrote: Hi, I am optimizing the critical parts of my code, and I coming to some ResourceCursorAdapter bindView method. Though the method is quite long, I saw on traceview that only 2 lines are taking 40% of the time in traceview; those are call to DateFormat: ((TextView)view.findViewById(**R.id.EPG_list_item_hour)).**setText( android.text.format.**DateFormat.format(kk:mm,**beginTimeMilli) + - + android.text.format.**DateFormat.format(kk:mm,**endTimeMilli)); So just curious: Is there any more efficient way to transform a timeMillisecond time to a date string (in my case hour/minute)? Thierry. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Thierry. -- Thierry. -- You received this message because you are subscribed to the Google Groups Android
[android-developers] Re: listview adapter. Recycle bitmap
Based on the code there, you wouldn't have the chance to recycle the bitmap as you don't keep a handle to it anywhere. Then again, if the ListView discards that particular row and you aren't retaining any handles to the bitmap, then the bitmap should be scheduled for collection by the GC. If you did try to retrieve the view that was holding the image from the ListView and it did return it to you, there is a good chance the ListView still wants to use it and you would not want to release the bitmap. Is there a reason you are wanting to try to recycle the bitmap? Also, we are talking about the recycle() function on bitmap and not reusing the same bitmap, correct? Steven Studio LFP http://www.studio-lfp.com On Sunday, October 16, 2011 4:14:48 AM UTC-5, emanuele wrote: Hello guys.. that s my baseAdapter getview implmentation: @Override public View getView(int position, View convertView, ViewGroup parent) { int type = getItemViewType(position); if (convertView == null) { switch (type) { case TYPE_BIG_NEWS: convertView = mInflater.inflate(R.layout.big_news, null); break; case TYPE_NORMAL_NEWS: convertView = mInflater.inflate(R.layout.normal_news, null); break; default: break; } } ImageView thumb = (ImageView) convertView.findViewById(R.id.thumbId); File f = null; if (filename != null) f = mFileCache.getFile(i.newsKey, filename); if (f == null) { if (mGetThumbsThread != null filename != null) { Log.i(TAG, cache miss); thumbLinks.offer(new ThumbRequest(i.newsKey, i.thumbLink, i.thumbName)); mGetThumbsThread.signal(); } thumb.setImageResource(placeHolder); } else { Log.i(TAG, file bitmap cached: + f.getName() + size: + f.length() / 1024); bitmap = BitmapFactory.decodeFile(f.getAbsolutePath()); thumb.setImageBitmap(bitmap); } return convertView; } Every row is compound of text and an ImageView. Is there any chance to recycle the bitmap I use in the getView? -- 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: Time/CountDownTimer: Wrong millis returned for date/time - HELP PLEASE!!
Simple, they caught us all looking. Check out the API docs: http://developer.android.com/reference/android/text/format/Time.html#set%28int,%20int,%20int%29 And notice this part: *month the zero-based month number (in the range [0,11])* Took me a second to find this, but December is 11, not 12 like we think about it. Tricky Android dev team! Steven Studio LFP http://www.studio-lfp.com On Sunday, October 16, 2011 4:38:17 PM UTC-5, Larry/MavrickProductions wrote: Found part of the problem: My time set line: TimerSet.set(12, 25, 2011); // set the date to Dec 25, 2011, 12AM was backwards - it should have been (25, 12, 2011). Once fixed, the numbers are a lot closer, but still off by 36 days. Still looking for help on where I've made a stupid math/code error. Appreciate the replies! Best, -Larry -- 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: List View Focus Problem!
This might be helpful: http://developer.android.com/reference/android/view/View.html#setOnFocusChangeListener%28android.view.View.OnFocusChangeListener%29 You can create one or implement it on your activity and link as many views to it as you want. You should receive an event for focus gained and lost. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 16, 2011 11:27:16 PM UTC-5, abi wrote: Hi, I have a list view and a bottom bar in a layout. I can't focus the bottom bar after focusing the list view. How to find focus lost from list view. At that time I need to focus that bottom bar. Please Suggest... Regards, Abi -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: how to connect using HttpClent
Here is the code I use and I have never had any issue out of it. HttpURLConnection hucConnection = null; try { URL uInfo = new URL( YOUR_URL_HERE ); hucConnection = (HttpURLConnection)uInfo.openConnection(); hucConnection.setRequestMethod( POST ); hucConnection.setRequestProperty( Accept-Encoding, identity ); hucConnection.setDoOutput( true ); String sPost = URLEncoder.encode( key1, UTF-8) + = + URLEncoder.encode( value1, UTF-8); sPost += + URLEncoder.encode( key2, UTF-8) + = + URLEncoder.encode( value1, UTF-8); sPost += + URLEncoder.encode( key3, UTF-8) + = + URLEncoder.encode( value1, UTF-8); OutputStreamWriter out = new OutputStreamWriter( hucConnection.getOutputStream() ); out.write( sPost ); out.flush(); int iSize = hucConnection.getContentLength(); byte[] bReturn = new byte[ iSize ]; InputStream in = new BufferedInputStream( hucConnection.getInputStream() ); in.read( bReturn, 0, iSize ); String sReturn = new String( bReturn ); Log.i( URL Return, Return: + sReturn ); } catch( Exception e ) { e.printStackTrace(); } finally { hucConnection.disconnect(); } I use the accept-encoding line to disable compression because I don't send large amounts of data via the connection and it simply (and speeds up) processing the return. See the note in the following link for more information. Depending on what platform version you are aiming for, you may want to check out the following link: http://android-developers.blogspot.com/2011/09/androids-http-clients.html It will give you more detail about what they recommend. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 15, 2011 6:44:34 AM UTC-5, aparna rani wrote: hii all. i am trying to connect to my database using url connection is working fine.but i am using httpclient its not working. my URL is *http://122.166.229.173:8080/indela/ServletDataBase* in server side i wrote program in servelets. this code is corking fine. getting results also. *URL url = new URL(FETCH_FRIEND_UPDATES_URI);* *URLConnection connection = url.openConnection();* *connection.setDoInput(true);* *connection.setDoOutput(true);* *connection.setUseCaches(false);* *connection.setRequestProperty(Content-Type, application/x-www-form-urlencoded);* *DataInputStream dataIn = new DataInputStream(connection.getInputStream());* *String inputLine;* *String result=;* *while ((inputLine = dataIn.readLine()) != null) {* *result += inputLine;* *}* *dataIn.close();* ** this code is not getting results. * * * HttpEntity entity = null; entity = new UrlEncodedFormEntity(params); final HttpPost post = new HttpPost(FETCH_FRIEND_UPDATES_URI); post.addHeader(entity.getContentType()); post.setEntity(entity); maybeCreateHttpClient(); final HttpResponse resp = mHttpClient.execute(post); final String response = EntityUtils.toString(resp.getEntity()); public static void maybeCreateHttpClient() { if (mHttpClient == null) { mHttpClient = new DefaultHttpClient(); final HttpParams params = mHttpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, REGISTRATION_TIMEOUT); HttpConnectionParams.setSoTimeout(params, REGISTRATION_TIMEOUT); ConnManagerParams.setTimeout(params, REGISTRATION_TIMEOUT); } } actually i my application i need to pass some parameters to the server side table because whereClause . please give me some code to connect to my url. thanks in advance. * -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Code to enable my app to be set as default for sms
I think he's looking for the XML tags to allow his application to show up in the default picker screen. Try adding this on the activity you want to start for SMS: intent-filter action android:name=android.intent.action.SENDTO / category android:name=android.intent.category.DEFAULT / data android:scheme=sms / data android:scheme=smsto / /intent-filter That should put your application is the default picker. You'll need to catch the intent ACTION_SENDTO in your application to get the address and other data. Steven Studio LFP http://www.studio-lfp.com On Friday, October 14, 2011 12:21:25 AM UTC-5, Sreen wrote: Hi, Can anyone pls suggest me a link or URL resource which will share the code snippet used to make my application the default application for sms or rather any other feature like calling etc Thanks. Urgent! Sree -- 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 implement socket transmission in Android
If you are looking for close range communication, check out the Bluetooth documentation. If you are looking for communication anywhere on any network, you would probably want to set up a client/server type thing like MComputing Lab explained. Then use C2DM to let devices know when messages are waiting for them on the server. Grab the new message from the server and done. http://code.google.com/android/c2dm/ Steven Studio LFP http://www.studio-lfp.com On Friday, October 14, 2011 5:35:04 AM UTC-5, krishna kumar wrote: I need to transfer data(generally text) between two android devices using socket implementation, i.e, the device have to receive the data also send the data to the other device. Can anyone suggest me some regarding this also please tell me that, is there any examples regarding this Socket Transmission in Android. Thanks Regards Krishnakumar p -- 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: No longer want meaning when implementing an app widget
A widget on the home screen is just a cached view that is shown there. Since the widget is a BroadcastReceiver with disconnected UI, it only runs when an action happens. Once it deals with the action, and updates a RemoteView object which it sends to the system, it dies. A widget is not actively running and needs a service as a support method if you want to do long operations. To support a widget for long process, you might want to start up a service and do whatever you need to do there. Once you have the new data or whatever you were trying to get, you can send an intent broadcast to tell your widget to update itself. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 15, 2011 11:49:13 AM UTC-5, Efi Merdler-Kravitz wrote: but the widget is still on screen and it's working, so it's not fully terminated, what part of it is being terminated ? On Oct 15, 6:40 pm, Kostya Vasilyev kman...@gmail.com wrote: What this means is... Android decides that your process isn't important enough to keep around, so it gets terminated. Consider using a service (perhaps IntentService) that would fetch your data, update the widgets, then terminate. -- Kostya 15.10.2011 20:28, Efi Merdler-Kravitz ?: Hello, I have a widget that on its onEnabled I am using a singleton that behind the scenes starts fetching information from the web using a background thread. After a while a see that everything stops working and on LogCat I can see No longer want message. What happens when I see this message? does the memory gets cleaned ? (I'm quite sure not because the widget continues to work correctly), are threads stop working ? (I can see Handler deferred tasks are not working anymore). Can anyone explain what exactly is not needed ? 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
Re: [android-developers] Re: No longer want meaning when implementing an app widget
True, I just usually have all the display update code in the widget itself, so instead of duplicating it, I just send an update intent to the widget. Either way, to maintain only one set of display update code, you'd either have to have the widget start the service (even when not needed) or have the service issue an update intent to the widget (when needed). If you use the service on every action on the widget, I'd go with what Mr. Murphy said. If you update the display of the widget a decent amount where you don't need to fire off the service, I'd go with the code in the widget. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 15, 2011 12:11:28 PM UTC-5, Mark Murphy (a Commons Guy) wrote: On Sat, Oct 15, 2011 at 1:05 PM, Studio LFP studi...@gmail.com wrote: To support a widget for long process, you might want to start up a service and do whatever you need to do there. Once you have the new data or whatever you were trying to get, you can send an intent broadcast to tell your widget to update itself. Or, just have the service update the RemoteViews via AppWidgetManager directly. No sense in starting up some other component to do something the service can do directly. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0 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
Re: [android-developers] How to retrieve images and other files on external memory from our app searching by name
This group is mainly to help point you in the right diection and then let you figure the code out. You could start the process with the Java I/O like Mr. Murphy said here: http://developer.android.com/reference/java/io/File.html Steven Studio LFP http://www.studio-lfp.com On Saturday, October 15, 2011 1:47:08 PM UTC-5, Gaurav wrote: can u help me out how to do that... can u tell me its coding?? On Wed, Oct 12, 2011 at 4:40 PM, Mark Murphy mmu...@commonsware.comwrote: If you are limiting your search to media, use the MediaStore content provider. Otherwise, you will need to scan external storage yourself using standard Java I/O. On Tue, Oct 11, 2011 at 2:50 PM, Gaurav kumbhat...@gmail.com wrote: Hi, I am making an application in which i want to search files on external memory by name. In that application user will enter the name and the app will list all the files (including images,songs,videos etc) having that name from external memory. I want to know how can i implement this thing in my application. please help. Hoping to see your reply soon. Gaurav -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@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/commonsguy http://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-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@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
Re: [android-developers] Re: Multiple Display suport
There are products that have a transmitter/receiver combo that you can send video/audio wirelessly. I don't think there is any reason you wouldn't be able to hook an Android device with an HDMI connector to these units. I don't think there is any built-in code to handle transmitting video/audio that would go out the HDMI to a wireless receiver via the wireless on the phone. You would need the external devices to do that. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 15, 2011 4:50:12 AM UTC-5, David_lavi wrote: Hi thanks for the reply, an addition to my question would it be possible to transmit HDMI over wireless via device On Fri, Oct 14, 2011 at 6:24 PM, Studio LFP studi...@gmail.com wrote: If you download the add-ons for other devices through the Android SDK Manager, you can usually find samples that come with them. If you look in the directory where you have the Android SDK, you'll find an add-ons directory. That should be where things like the LG 3D, KYOCERA multi-screen, Sony EDK, etc. are found. They may or may not have documentation or samples in there. Most manufacturers have a developers site you should check out to see if there is more documentation/help. Steven Studio LFP http://www.studio-lfp.com On Friday, October 14, 2011 6:30:32 AM UTC-5, David_lavi wrote: Hi Is there a tutorial regradig Multi screen support in Android, Is there a tutorial regarding HDMI support, Any information will be 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-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@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: How to add buttons on the top in relative layout
If that is the code you are using to fill in each row in a ListView, then that's the wrong place to put the buttons. You want to go to the layout that your ListView is in and add the buttons there. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 15, 2011 1:03:18 AM UTC-5, Windy wrote: Hi, I am using relative layout to show a list with checkboxes in each row. Now I want to add 3 buttons on the top of this list. how can I do so? when I tried to add a button in this layout,the button appeared in all the rows of the list. here is my .xml file : ?xml version=1.0 encoding=utf-8? RelativeLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=wrap_content TextView android:text=@+id/label android:layout_width=wrap_content android:layout_height=wrap_content android:id=@+id/label android:textSize=30px/TextView CheckBox android:id=@+id/check android:layout_width=wrap_content android:layout_height=wrap_content android:layout_marginLeft=4px android:layout_marginRight=10px android:layout_alignParentRight=true /CheckBox /RelativeLayout Please help me quickly. -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: Best approach for onConfiguratinChange()
There has been a decent amount of conversation on this subject and there's no right answer. Regardless of which way you pick, make sure you understand the pros and cons. If you let Android do the work for you, make sure you understand that your application can be killed off and restarted at any time just by the user rotating the phone, docking, pulling out a hardware keyboard or game pag, etc.. There are quite a few times this can happen, so it would be best to know when it is going to happen and make sure your application is prepared to deal with it at any time. If you decide to handle the changes yourself with configChanges, you only need to handle the changes that impact your application. If you use the same layout for both portrait and landscape, you don't need to handle rotation changes or hardware keyboard/game pad events. Only catch the ones that will impact your application. Check out the configChanges documentation: http://developer.android.com/guide/topics/manifest/activity-element.html#config Each of the events listed there is a time where Android will stop and restart your application if you let it handle the changes. There may be more that aren't documented there, but those are the major ones. If you decide to handle them yourself, those are also the events you have the option of handling if they impact your application. Again, you will only need to handle the ones that would cause a change in your application, the others can be ignored. Based on an application I wrote that checks all the activities in the system (including the built-in apps), about 50% use configChanges and about 50% let Android handle it (on both tablets and phones), so the choice is up to you. Regardless of which way you pick, make sure to do the necessary testing. Steven Studio LFP http://www.studio-lfp.com On Friday, October 14, 2011 4:40:43 AM UTC-5, nikki wrote: Thanks Flo for quick reply. In my case the landscape layout files have no changes they are as same as portrait, that's why i haven't created a separate landscape folder for layout(layout_land). So on change of orientation the android will pick the file from layout folder only. My confusion shall I handle onConfigurationChange for orientation which will stop android to create a new activity or i should not handle onConfigurationChange and let android do the life cycle process complete. Thanks On Oct 14, 2:27 pm, Flo florian@gmail.com wrote: Let Android handle it. Just create a second layout folder called layout-land and put all your landscape layouts in. The layouts must have the same file name like the layouts in the normal layout folder for portrait mode. Android will pick the right folder to get the layout from. On landscape mode it will take the layouts from the layout-land folder and in portrait mode it will take the layouts from the layout folder. On Oct 14, 11:11 am, nikki nikhiles...@gmail.com wrote: Hi all, I am a bit confused on setting up my screen UI. The point of confusion is I am having similar UI layout file for landscape and portrait. On screen orientation change shall i handle onConfigurationChange or i should let android do the complete activity life cycle and recreating the UI by setContentView(). Please suggest which one is the best optimized approach. Thanks in adavance -- 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: Multiple Display suport
If you download the add-ons for other devices through the Android SDK Manager, you can usually find samples that come with them. If you look in the directory where you have the Android SDK, you'll find an add-ons directory. That should be where things like the LG 3D, KYOCERA multi-screen, Sony EDK, etc. are found. They may or may not have documentation or samples in there. Most manufacturers have a developers site you should check out to see if there is more documentation/help. Steven Studio LFP http://www.studio-lfp.com On Friday, October 14, 2011 6:30:32 AM UTC-5, David_lavi wrote: Hi Is there a tutorial regradig Multi screen support in Android, Is there a tutorial regarding HDMI support, Any information will be 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: EAAccessory Class in Android
Based on the documentation for the EAAccessory Class on Apple's site, there is not a single object like that in Android. Android gives you different classes based on the type of device you are wanting to connect to. Built-in things like Bluetooth, GPS, sensors and the likes are in packages that relate specifically to them. As of 3.1 you can also access USB connected devices (and even make your own with Open Accessory). See this link for more information: http://developer.android.com/guide/topics/usb/index.html You can pretty much get access to anything you want, just look for the right way to talk to them in the development site: http://developer.android.com/index.html Steven Studio LFP http://www.studio-lfp.com On Friday, October 14, 2011 6:52:25 AM UTC-5, riz wrote: Hi , I am an iphone developer and curious to know is there any equivalent to Iphone EAAccessory Class in Android ? please advise . 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
Re: [android-developers] SQLite slow
Glad to hear you got at least a little speed out of the transactions. On making sure your objects are in sync, I can understand the reasoning behind this. What I tend to do is drop database modifications in a thread and also updates my objects at the end of that thread and then trigger a refresh on the UI when the thread is finished. Are you updating a ton of data each time, or just a few rows here and there? In the response, you said you were reading every row of every table, is there a reason you are doing this? The right SQL statement should prevent you from having to do this. If you are using a ListView, a CursorAdapter helps for dealing with delayed reading automatically. I also write web applications, so if you need a hand with SQL or how to speed up querys, don't hesitate to ask in this thread. I deal with databases that have millions of entries that are join across a ton of tables (and cross database), so I may be able to help speed up your SQL statements. Steven Studio LFP http://www.studio-lfp.com On Friday, October 14, 2011 3:54:37 PM UTC-5, John Goche wrote: On Thu, Oct 13, 2011 at 1:47 AM, Studio LFP studi...@gmail.com wrote: If you aren't, try using transactions: dbHandle.beginTransaction(); lReturn = dbHandle.insert( sTable, null, cvEntry ); // Update and delete here also dbHandle.setTransactionSuccessful(); dbHandle.endTransaction(); If you do multiple inserts/updates/deletes where you target specific rows for a reason you can't include them all in one query, add more statements between the beginTransaction and the setTransactionSuccessful. Thanks Steven, I have implemented transactions and it runs about twice as fast but still have to wait a somewhat smaller fraction of a second. As to the connection it's only opened once and shared across intents. The queries are based on primary keys so I do not see the need to have separate indices. I think what is slowing things down could be the fact that I am reading every single row of every single table just to be on the safe side although things could be done more efficiently but at the risk of complicating the code and introducing bugs in the code. As to implementing the database calls in a separate thread, the reason I didn't do it is that the calling activity needs to display the data from the popped activity retrieving it from the database to make sure it's data remains consistent with the database. But it's true, I could store the data in the database in a separate thread and only read it when the application starts, and just write to it asynchronously. This would really make my app faster. Or I could display a progress bar in between operations. I just want to ensure my objects are always in sync with my database so I have a soreAndRetrieve() data method to make sure this happens at the expense of speed, so maybe it's my own problem. Thank you for all your replies, Regards, John Goche -- 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
Re: [android-developers] Get Application Context After Force closed
Try using the context that is passed to the receiver instead of the application context. The application context is different and I believe they recommend not using it unless it is for very specific purposes. Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 1:33:46 PM UTC-5, Manikandan M wrote: Hi Please help me, I am struggling with this problem almost a day. On Thu, Oct 13, 2011 at 5:57 PM, Manikandan M c2dmde...@gmail.com wrote: Hi I integrated c2dm in my application its working fine. once c2dm notification came i do some database operation so i need the context to create OrmLiteSqliteOpenHelper object. OrmLiteSqliteOpenHelper lDatabaseHelper = OpenHelperManager.getHelper(context.getApplicationContext()); This is fine in normal cases. Suppose if i force stop my application manually from settings- application-manageapplication. if any c2dm message came after i am unable to create OrmLiteSqliteOpenHelper object. it seems application context getting null. Exception : java.lang.IllegalStateException: Could not find OpenHelperClass because none of its generic parameters extends OrmLiteSqliteOpenHelper: null How do i get the application context after force stopping the application. Please help me . -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@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: An application that hosts a set of other applications
You might want to check out the in-app purchase option if you are trying to sell each one separately but also as a group. One option is to have the main package that would include all the applications as sections. Each section could be a limited free version and then use in-app purchase to activate the full version. You could then continue to add sections that started out as free test version and give people the option to activate the new sections they would like to use. The end result would be a single application with a collection of sections that could be purchased (or upgraded). Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 4:17:00 PM UTC-5, droid-stricken wrote: Hi All, I have posted this question on StackOverFlow. So apologies for those that find this redundant - but i could not get any ideas (yet) from that forum. So, i repeat here: - I have half a dozen apps that i want to put on Google Market. One of them are ready and the other are in progress. All these apps are kinda related - like a suite of apps, you could assume. So, i was wondering if it would be better to have a separate app (in addition from the half a dozen apps i wish to develop) and have it serve as a LIBRARY- app where users can find, purchase and launch the half a dozen apps. This is conceptually similar to the Google Books free app where the app serves as a library and users can browse for other books from within this app and purchase it. The only difference is in my case, it would be other fully functional independent app instead of a book. Is there a better way to approach what i am trying to do? Basically, i need an app that can host a set of mutually independent apps. If yes, how do i host one app inside an app? Thanks in advance. - 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.text.format.DateFormat.format performance
It is slow and so is String.format(). I've been messing around with it a bit and here is a *rough *sample I tested: private static final String DATE_AM_PM[] = { am, pm }; private static Date dFormat = new Date(); private static int iHour, iAMPM; public static String formatDate( long lTimestamp ) { dFormat.setTime( lTimestamp ); iHour = dFormat.getHours(); if( iHour == 0 ) { iHour = 12; iAMPM = 0; } if( iHour == 12 ) { iAMPM = 1; } else if( iHour 0 iHour 11 ) { iAMPM = 0; } else if( iHour 12 iHour 24 ) { iHour -= 12; iAMPM = 1; } return dFormat.getMonth() + / + dFormat.getDay() + / + (dFormat.getYear() + 1900) + + iHour + : + dFormat.getMinutes() + DATE_AM_PM[ iAMPM ]; } As I said, it is rough and doesn't even format the output fully. I tossed this in my application and used it a bit for a speed test and this takes up half the time as the formatting routines do. Funny thing is, it has nothing to do with the date part. It seems the formatters are using a StringBuffer and some replace functions in the StringBuffer and that is what is slowing it down. I may try to work up a JNI replacement and see if some sprintf or fprintf action fix the issue but it may not because of the extra layer. Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 4:26:32 PM UTC-5, tlegras wrote: Hi, I am optimizing the critical parts of my code, and I coming to some ResourceCursorAdapter bindView method. Though the method is quite long, I saw on traceview that only 2 lines are taking 40% of the time in traceview; those are call to DateFormat: ((TextView)view.findViewById(R.id.EPG_list_item_hour)).setText( android.text.format.DateFormat.format(kk:mm,beginTimeMilli) + - + android.text.format.DateFormat.format(kk:mm,endTimeMilli)); So just curious: Is there any more efficient way to transform a timeMillisecond time to a date string (in my case hour/minute)? Thierry. -- 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: An application that hosts a set of other applications
Check out this link: http://developer.android.com/guide/market/billing/index.html That's the overview and there are more links at the bottom of that page to help get you up and running. Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 10:14:54 PM UTC-5, droid-stricken wrote: Thanks for all the inputs. I like the in-app purchase solution the best since that fits my needs the best. Any pointers on how to realize this solution is greatly appreciated. I am not looking for code per-say but any more information on this methodology would help greatly. Thanks. On Oct 13, 6:00 pm, Studio LFP studi...@gmail.com wrote: You might want to check out the in-app purchase option if you are trying to sell each one separately but also as a group. One option is to have the main package that would include all the applications as sections. Each section could be a limited free version and then use in-app purchase to activate the full version. You could then continue to add sections that started out as free test version and give people the option to activate the new sections they would like to use. The end result would be a single application with a collection of sections that could be purchased (or upgraded). Steven Studio LFPhttp://www.studio-lfp.com On Thursday, October 13, 2011 4:17:00 PM UTC-5, droid-stricken wrote: Hi All, I have posted this question on StackOverFlow. So apologies for those that find this redundant - but i could not get any ideas (yet) from that forum. So, i repeat here: - I have half a dozen apps that i want to put on Google Market. One of them are ready and the other are in progress. All these apps are kinda related - like a suite of apps, you could assume. So, i was wondering if it would be better to have a separate app (in addition from the half a dozen apps i wish to develop) and have it serve as a LIBRARY- app where users can find, purchase and launch the half a dozen apps. This is conceptually similar to the Google Books free app where the app serves as a library and users can browse for other books from within this app and purchase it. The only difference is in my case, it would be other fully functional independent app instead of a book. Is there a better way to approach what i am trying to do? Basically, i need an app that can host a set of mutually independent apps. If yes, how do i host one app inside an app? Thanks in advance. - 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: Graphical anomaly with hints disappearing. Can anyone explain?
Thanks for the heads up. You might want to see if this bug has been filed at: http://code.google.com/p/android/issues/list If it hasn't, you may want to drop it in there so others can find the workaround easier and the development team has a better spot to keep track of it. Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 12:39:19 PM UTC-5, darrinps wrote: It did for me as well. If you remove top though, it goes away. This is a bug, albeit a lesser one than I thought at first as long as someone knows the work around. On Oct 8, 11:00 am, Studio LFP studi...@gmail.com wrote: I tested the following code: EditText android:id=@+id/etMessage android:layout_width=fill_parent android:layout_height=fill_parent android:layout_weight=1 android:hint=Compose text message... android:maxLines=3 android:capitalize=sentences android:autoText=true android:inputType=textShortMessage|textAutoCorrect|textCapSentences|textMultiLine android:imeOptions=flagNoExtractUi android:gravity=top|right / On the following devices: Motorola Droid (2.2.2) HTC Hero (2.1-update 1) Samsung Galaxy Tab (2.2) Sony Xperia Play (2.3.2) They all worked fine. Maybe adding the top to it corrected it. Steven Studio LFPhttp://www.studio-lfp.com On Saturday, October 8, 2011 10:42:59 AM UTC-5, Kostya Vasilyev wrote: FWIW: I just tried it on an HTC Incredible S (official firmware, 2.3.3) and got the same result as the OP: Setting android:gravity=right made android:hint disappear. Previews as rendered by a special library, which, AFAIK, does not use the same exact code as a real runtime (device or emulator) does. -- Kostya 08.10.2011 19:20, Studio LFP пишет: There is definitely something wrong in the code. The first time I tested was on a Samsung Galaxy Tab (2.2) and I just tested it again on the Xperia Play (2.3.2) and it worked just fine. If you want to post the XML that contains the layout, that would be helpful. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 10:11:33 AM UTC-5, darrinps wrote: I have tried it out on a 2.2 device (Samsung Galaxy) and using the 2.3 emulator. Same thing on both. What is odd though is that is shows up in the preview just fine! I know, you would think that there is something shifting it in the code but the just isn't. This is very frustrating. On Oct 7, 4:04 pm, Studio LFP stu...@gmail.com wrote: I just tested this on an application I had in front of me and it worked well. Which version of Android are you testing on (and what hardware)? Are there any other settings on the view that might be causing a conflict? Or maybe there is another view overlapping that is causing an issue? Steven Studio LFPhttp://www.studio-lfp.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to androi...@googlegroups.com To unsubscribe from this group, send email to android-d...@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
[android-developers] Re: Service BroadcastReceiver and Activity
On the line that says: showScreen( getApplicationContext() ); Try changing it to: showScreen( context ); That might not be it, but it's best to use the context that is being passed to you in the onReceive. If that doesn't work, please post the error so we can help you more. Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 12:14:35 PM UTC-5, Diego Fernandez wrote: Hello to all, I have read something about how to launch a Activity from BroadcastReceiver, hence now I am reached the point where I really cant not find the answer to... why is closing my application?. I will explain the idea of the application: It consists of a main screen main that has only one ToggleButton, when it changes state to On begins my service, when go to Off does the same and stops it. This all works fine, I can close the application and service continue running smoothly. I can stop this service when I want, reopening the application and changing the button to OFF. Now the service MyService is waiting any change of your phone, for each change It send a message like a Toast, it helps me to know and check if my service is active, it works perfectly except when you add the code lines to run an Activity that contains simply an image that is where the application is closed, if I leave only the Toast, it is going great, tells me that the phone are ringing and informs the incoming phone number. I create a class that receives the context and try to launch the Activity in question NewScreen Here I leave the application code, Any idea? It took me several days and I dont reach any breakthrough. Thanks for advance -- ?xml version=1.0 encoding=utf-8? manifest xmlns:android=http://schemas.android.com/apk/res/android; package=xx.com.x.myservice android:versionCode=1 android:versionName=1.0 uses-sdk android:minSdkVersion=4 / uses-permission android:name=android.permission.VIBRATE/uses- permission uses-permission android:name=android.permission.READ_PHONE_STATE/uses-permission application android:icon=@drawable/icon android:label=@string/app_name activity android:label=@string/app_name android:screenOrientation=portrait android:name=Main intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity activity android:screenOrientation=portrait android:name=NewScreen /activity service android:label=My Service android:enabled=true android:name=MyService /service /application /manifest -- public class Main extends Activity{ ToggleButton buttonStatus; ActivityManager ActivityMan; ListRunningServiceInfo RunningServices; boolean isMyServiceRunning = false; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ActivityMan = (ActivityManager) this.getSystemService (ACTIVITY_SERVICE); RunningServices = ActivityMan.getRunningServices(Integer.MAX_VALUE); buttonStatus = (ToggleButton) findViewById(R.id.buttonStatus); buttonStatus.setOnCheckedChangeListener(listener); checkServiceRuning(); showStatusService(); } OnCheckedChangeListener listener = new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { showStatusService(); MyService(isChecked); } }; public void checkServiceRuning(){ for (RunningServiceInfo runningServiceInfo : RunningServices) { if (runningServiceInfo.service.getClassName().equals(MyService.class.getName())) { isMyServiceRunning = true; buttonStatus.setChecked(true); } } } public void MyService(boolean status){ if (status) startService(new Intent(getApplicationContext(), MyService.class)); else stopService(new Intent(getApplicationContext(), MyService.class)); } public void showStatusService(){ if(buttonStatus.isChecked()) { Toast.makeText(Main.this, Service ON, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(Main.this, Service OFF, Toast.LENGTH_SHORT).show(); } } } -- public class MyService extends Service { BroadcastReceiver phoneStateChangeReceiver; Bundle extras; String phoneNumber; @Override public void onCreate() { phoneStateChangeReceiver = new PhoneStateChangeReceiver(); registerReceiver(phoneStateChangeReceiver, new IntentFilter(android.telephony.TelephonyManager.ACTION_PHONE_STATE_CHANGED)); } public void onDestroy() { unregisterReceiver(phoneStateChangeReceiver
[android-developers] Re: please help: broadcast receiver does not execute code
So it seems like it is skipping that step? Or is it just stopping before that step? Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 11:29:40 AM UTC-5, John Goche wrote: Hello, I am having the following problem and was wondering whether anyone here could be so kind so as to help me. I am having a broadcast receiver in my code that opens a database and sets an alarm. However the code that sets the alarm is never called as shown in the adb logcat output. What is interesting is that the application does not crash but the intent that is called after the alarm setter was supposed to be called is run. So the intent that is launched after the alarm was supposed to be set is called even though I see no debug output telling me that the alarm setter function is called. Any ideas as to what is going on? (please see code below) Thanks, John Goche public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d(AlarmReceiver, received); // retrieve database handle DB db = DB.db(context); // retrieve data from database Globals.data = db.getData(); // reset alarms (seems like this does not get called) Log.d(AlarmReceiver, Calling alarm setter...); AlarmSetter.doSetupAlarm(context); Log.d(AlarmReceiver, Done.); // start new intent (this actually starts up for real) Intent i = new Intent(context, AlarmExpiredActivity.class); i.putExtra(alarmMessages, intent.getBundleExtra(alarmMessages)); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } } class AlarmSetter { public static void doSetupAlarm(Context ctx) { Log.d(AlarmSetter, doSetupAlarm called.); // ... } D/AlarmReceiver( 3805): received I/ActivityManager( 61): Starting: Intent { flg=0x1000 cmp=com.bar.foo/.AlarmExpiredActivity (has extras) } from pid 3805 -- 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 visibility after transaction
You should be able to do this in the fragment itself when it shows itself. Check out the flow-chart on the right hand side of this page: http://developer.android.com/guide/topics/fundamentals/fragments.html#Creating Whenever any fragment gets shown and has already been created, it goes back to onCreateView() and then down the chain. Just make sure to put some sort of refresh in one of the steps that makes the most sense for your application. Steven Studio LFP http://www.studio-lfp.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: Android Tablet Internal Storage
See if this helps out: StatFs sfStats = new StatFs( this.getFilesDir().toString() ); Log.i( SpaceCheck, Free (bytes): + ( sfStats.getAvailableBlocks() * sfStats.getBlockSize() ) ); That should get you the directory to the applications internal storage (hidden from the user unless rooted) and tell you how much available room there is in that location. Here's links to the API documents for those: http://developer.android.com/reference/android/os/StatFs.html http://developer.android.com/reference/android/content/Context.html#getFilesDir%28%29 Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 8:19:04 AM UTC-5, ramya wrote: Hi, 1)I am converting an ipad project to android.In doing so,in ipad version ,I can save the internal files in bundle (called Bundle directory) and all the files are stored under documents which is internal to app. In android we have /data/data/{package name}/files My Question is I should be able to store large data inside the internal storage.Does tablet have large internal space ?I dont want to save the files in sdcard either because it can be replaced or something. Is the device RAM used for internal storage of files?I am facing a memory problem where as in ios we can have sufficient data stored in sandbox...I need to copy files from assets to in internal storage during run time(by files I mean large files). Can somebody throw light on 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: Vibrate Trigger on Android Device
Have you tried this out? http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface%28java.lang.Object,%20java.lang.String%29 I haven't used it yet, but might be what you are looking for. Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 8:00:54 AM UTC-5, cipher_neo wrote: Is it at all possible to trigger the phones vibration from a web app in android? I know it is a long shot, and I am looking for any solution, however lengthy! 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: terminating the application in android issue
Have you tried android:clearTaskOnLaunch on your base activity in the AndroidManifest.xml? http://developer.android.com/guide/topics/manifest/activity-element.html#clear Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 7:37:52 AM UTC-5, P B Lal wrote: Dear All Experts, I have developed my own application but I am unable to close it through coding. I have tried following ways (a) System.exit(0) (b) android.os.Process.killProcess(android.os.Process.myPid()); (c) super.destroy() (d) this.finish(); (e) Mycurrentactivityclassname.this.getParent().finish(); but these all code restarts my application. Anybody's help will be appreciated. If I press the back button it seems that it has closed but again it is started after a fraction of seconds. If I press home key , it got the android deskop screen but when I see it is in task manager list, but it does not appear in the running process setting menu of mobile. But whenever I run the application again it appears in the same state when I had pressed home button. Thanks Regards Prashant B Lal -- 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: major problem with network location fixes and their timestamps
Can't say that I've seen that before. I've only used the GPS a small to medium amount, but seems a little weird. Is the GPS hardware not able to get a fix and causing your logic to drop back to the network GPS? If so, it might be that. Is it happening on multiple different devices and how many devices have you tested it on? You might want to check out the GPS Status app on the market and see if it gets a fix. If it does, it will tell you the time it got it and other information about the fix. Good way of testing the hardware and see if you have an issue there. Steven Studio LFP http://www.studio-lfp.com On Wednesday, October 12, 2011 9:44:54 AM UTC-5, Mathias wrote: Hi, if someone could bear with me on this one i'd be most happy since i'm really disillusioned right now. BOTTOM LINE (to be detailed further down): It seems as though the Location.getTime() sometimes isn't accurate, in that the system under certain circumstances just updates the time of an old fix and passes it on as though it was new. For us, this is very unfortunate. I think it has something to do with this logline (again in more detail below): 10-12 16:34:47.186: DEBUG/LocationMasfClient(1188): getNetworkLocation(): Returning cache location with accuracy 1072.0 From what i can see, the same location is returned over and over again, just with its timestamp overwritten... EXPLANATION: Have an app that queries location. I register both network and gps, wait for a certain time and takes what comes back from either one and unregister both. Before i register i check the latestknown location and use that if it's not too old. All works fine, process wise, but there's one major issue. I *need* recent fixes, and for that i need to know how old the fix is. I therefore utilize location.getTime() against the system.currenttimillis to see how old it is. However, we see in certain scenarios, that the fix coming back, with a recent timestamp (often under a second!) is for a location where we know that the phone hasn't been at for over 30 minutes! LOCATION PROCESS EXPLANATION WITH LOG DETAILS: One VERY interesting thing can be seen by examining the debug log of a typical positioning process in my app: 1. first we check the latest known location: 10-12 16:34:47.166: DEBUG/nubaLocationService(6774): getLastKnownLocationForProviderWithinTimeSpan;now;1318430087165;time; 1318429486221;nowDate;Wed Oct 12 16:34:47 Europe/Stockholm 2011;timeDate;Wed Oct 12 16:24:46 Europe/Stockholm 2011;age; 600944;TooOld;true;tooBadAccuracy;true;lat;59.3267657;lon; 18.0428283;accuracy;1072.0 here you can see that the age about 60 seconds, my upper limit is 30 seconds, so i will discard it and register for live updates: 2. register for location listening: 10-12 16:34:47.166: DEBUG/nubaLocationService(6774): requesting network updates 10-12 16:34:47.166: DEBUG/NetworkLocationProvider(1188): addListener(): com.karpet.nuba.android 10-12 16:34:47.166: DEBUG/NetworkLocationProvider(1188): setMinTime: 0 3 NetworkLocationProvider log entries and onLocationChanged callbacks: Now HERE is something very interesting: 10-12 16:34:47.186: DEBUG/LocationMasfClient(1188): getNetworkLocation(): Returning cache location with accuracy 1072.0 10-12 16:34:47.196: DEBUG/NetworkLocationProvider(1188): onCellLocationChanged [142,9307015] 10-12 16:34:47.216: DEBUG/nubaLocationService(6774): onLocationChanged();new bestLocation! now;1318430087220;time; 1318430087178;nowDate;Wed Oct 12 16:34:47 Europe/Stockholm 2011;timeDate;Wed Oct 12 16:34:47 Europe/Stockholm 2011;age;42;lat; 59.3267657;lon;18.0428283;accuracy;1072.0;oldnull?;true It says returning cache location, with the exact same accuracy, lon, lat, but CHANGED time! 4. We listen for 25-30 secs, but nothing more comes back, so eventually we unregister: 10-12 16:35:14.216: DEBUG/LocationManager(6774): removeUpdates: listener = com.karpet.nuba.android.service.LocationService $NubaLocationListener@4582cb78 I have no idea why this happens, but sometimes we can start and stop our listening for quite a while, 20-30 times when we've travelled quite far, to another cell tower, but still get old fixes as new callbacks! Help/Pointers would be extremely 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: An application that hosts a set of other applications
You're welcome, glad to be able to help. Good luck on your app! Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 11:41:14 PM UTC-5, droid-stricken wrote: Excellent. Thanks all. Thanks @Studio LFP. On Oct 13, 10:53 pm, Studio LFP studi...@gmail.com wrote: Check out this link: http://developer.android.com/guide/market/billing/index.html That's the overview and there are more links at the bottom of that page to help get you up and running. Steven Studio LFPhttp://www.studio-lfp.com On Thursday, October 13, 2011 10:14:54 PM UTC-5, droid-stricken wrote: Thanks for all the inputs. I like the in-app purchase solution the best since that fits my needs the best. Any pointers on how to realize this solution is greatly appreciated. I am not looking for code per-say but any more information on this methodology would help greatly. Thanks. On Oct 13, 6:00 pm, Studio LFP stud...@gmail.com wrote: You might want to check out the in-app purchase option if you are trying to sell each one separately but also as a group. One option is to have the main package that would include all the applications as sections. Each section could be a limited free version and then use in-app purchase to activate the full version. You could then continue to add sections that started out as free test version and give people the option to activate the new sections they would like to use. The end result would be a single application with a collection of sections that could be purchased (or upgraded). Steven Studio LFPhttp://www.studio-lfp.com On Thursday, October 13, 2011 4:17:00 PM UTC-5, droid-stricken wrote: Hi All, I have posted this question on StackOverFlow. So apologies for those that find this redundant - but i could not get any ideas (yet) from that forum. So, i repeat here: - I have half a dozen apps that i want to put on Google Market. One of them are ready and the other are in progress. All these apps are kinda related - like a suite of apps, you could assume. So, i was wondering if it would be better to have a separate app (in addition from the half a dozen apps i wish to develop) and have it serve as a LIBRARY- app where users can find, purchase and launch the half a dozen apps. This is conceptually similar to the Google Books free app where the app serves as a library and users can browse for other books from within this app and purchase it. The only difference is in my case, it would be other fully functional independent app instead of a book. Is there a better way to approach what i am trying to do? Basically, i need an app that can host a set of mutually independent apps. If yes, how do i host one app inside an app? Thanks in advance. - 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: integrate the youtube player in android app
You normally don't add the YouTube player into your application, you call an ACTION_VIEW intent on a YouTube URL. Intent iVisitSite = new Intent( Intent.ACTION_VIEW, Uri.parse( YOUTUBE_URL_HERE ) ); startActivity( iVisitSite ); I think some people have tried to get it to work in a WebView, but you'd have to Google search that. Steven Studio LFP http://www.studio-lfp.com On Thursday, October 13, 2011 5:28:19 AM UTC-5, Muthu S wrote: Hi all If anybody knows how to integrate the youtube player in android app. -- 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
Re: [android-developers] SQLite slow
If you aren't, try using transactions: dbHandle.beginTransaction(); lReturn = dbHandle.insert( sTable, null, cvEntry ); // Update and delete here also dbHandle.setTransactionSuccessful(); dbHandle.endTransaction(); If you do multiple inserts/updates/deletes where you target specific rows for a reason you can't include them all in one query, add more statements between the beginTransaction and the setTransactionSuccessful. Steven Studio LFP http://www.studio-lfp.com On Wednesday, October 12, 2011 3:29:49 PM UTC-5, John Goche wrote: On Wed, Oct 12, 2011 at 5:38 PM, Christopher Van Kirk christoph...@gmail.com wrote: You haven't provided enough information to help you. The question you need to ask is why is it slow? Are you opening and closing the connection many time? Too many records? Complex joins? Inefficient query? Lack of indexing? Unintentionally cartesianing? I don't have a lot of data. Just the following class accessed from every activity in my application and the storeAndRetrieve method called (which calls insert and delete sql statements on a handful of tables each having around just 60 rows each at the moment). class DB { private DB(Context ctx) { dbHelper = new DBHelper(ctx); database = dbHelper.getWritableDatabase(); } public static DB db(Context ctx) { if (db == null) db = new DB(ctx); return db; } // store and retrieve data public Data storeAndRetrieve(Data data) { putData(data); Data retData = getData(); return retData; } // ... data getters and setters private static DB db = null; private DBHelper dbHelper; private SQLiteDatabase database; } Yes when I run sqlite3 from adb shell it is fast, but for some reason when an activity is pushed and reads the data once opened it takes more than half a second which really slows down the user experience. Thanks for your help, John Goche -- 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: Writing to External Storage Help
That still should work fine. /mnt/sdcard on the Bionic is the internal memory and will never be removed so you shouldn't have any issue using it unless there is something wrong with the hardware. /mnt/sdcard-ext is the SD card itself and can be mounted/unmounted etc. You can try something like this to see what is available to you: File fMount = new File( /mnt ); File[] fMountPoints = fMount.listFiles(); for( File fCheck : fMountPoints ) { Log.i( SDCheck, Found: + fCheck.getName() + - Writable: + fCheck.canWrite() ); } I tried this on my Bionic and it worked great and everything in there is not writable except the two SD Card mount points. I haven't found a way to get the system to tell me if there is more than one SD Card mounted. Since even the internal memory on devices is now showing as the SD Card, hopefully ICS will give us a way to figure this out better. Unless someone else knows how to get Android to tell you about the SD Cards mount points, you can use the above to find out which directories are writable to you and these should be the SD Cards. I don't think they will be changing the /mnt mounting point any time soon, but you never know, so just be on the lookout if you use this. You may want to filter out anything starting with a dot also. I found there is some hidden and writable (or at least marked writable) files/directories in there on at least one of my devices that's a dot file. You can always find the places you can write with that and give your users a chance to pick which one they want for your application to use. Steven Studio LFP http://www.studio-lfp.com On Tuesday, October 11, 2011 9:53:53 PM UTC-5, BJGApps wrote: I have an app on the market and recently have had some reports of problems writing to the SD. What appears to work completely fine on some phones has proven not to work on others. I have done some searching on this and really need some advice to help make sure I am on the correct path. I am using Environment.getExternalStorageDirectory() to get the directory of the SD card. As I have read, this is the preferred method to get the path of external storage. From there I am creating a directory, a sub directory, and moving a file. This works perfectly fine for a majority of users, however more recently I have had reports of it failing this process. Two examples were the Atrix and the Bionic. It appears that some devices are reporting wrong information when using Environment.getExternalStorageDirectory(). It appears to return / mnt/sdcard when in reality it looks like the path should be /mnt/ sdcard-ext. This causes an exception to occur where it is trying to make a directory in the wrong location. Can someone shed some light on how I am supposed to handle this? Am I supposed to be using something other than getExternal? What am I supposed to do if the devices return wrong information? I really don't want to have to tell someone its not my problem, contact their manufacture. Help me Android Developers, you're my only hope. -BJGApps -- 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: List with seperators, checkboxes...
Your description is a bit vague, but maybe check out the ExpandableListView here: http://developer.android.com/reference/android/widget/ExpandableListView.html It's a ListView with expandable sections. To get checkboxes, you'll need to create a layout or extend a view to make it like you want. Steven Studio LFP http://www.studio-lfp.com On Tuesday, October 11, 2011 4:03:09 AM UTC-5, BearTi wrote: Hi, I´ve problems to built a list for my app. This list should have seperators, drop down menus and checkboxes. I´ve read many tutorials, but I can´t find a good one that solves my problem. (for expample which adapter I have to choose and so on) Do you have a good axample for my or some tipps? 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: Service to Activity communication with Broadcast Reciever every 1 sec . Is this right approach?
You may want to check out a foreground service if you need a high priority service like playing music, etc. http://developer.android.com/reference/android/app/Service.html#startForeground%28int,%20android.app.Notification%29 This should make it a foreground application and help keep it from being destroyed for needed memory. Steven Studio LFP http://www.studio-lfp.com On Tuesday, October 11, 2011 3:33:53 PM UTC-5, NikolaMKD wrote: Will START_STICKY keep my service running even if the phone is locked or activity is not visible to the user anymore? On Oct 11, 10:21 pm, NikolaMKD nikola.d...@gmail.com wrote: I have to create AIDL for methods from which I'll have access to the service. If I have each player feature(play, next, previous) I'm starting new service with startService(), when onBind() the object that will be returned to be used to control the service will I still have the access to the service whenever another call to startService is made? On Oct 11, 9:20 pm, TreKing treki...@gmail.com wrote: On Tue, Oct 11, 2011 at 1:58 PM, NikolaMKD nikola.d...@gmail.comwrote: 3. Is there any rather better approach than this one? Point me some... http://developer.android.com/reference/android/app/Service.html#Local... --- -- 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: Any way to embed existing views?
It seems like you may want to design a custom view object for your calendar so you can just copy/paste that into any other project you use. Then customize the calendar to fit what you want in that specific application. If you want to leave it as an application, TreKing is right in saying you can't embed it. You can always have your application call to your calendar application and then return a result back to the first application. You won't be able to catch the touch/keyboard events in your first application, but it is another way to reuse work done on your calendar application. Steven Studio LFP http://www.studio-lfp.com On Tuesday, October 11, 2011 1:14:13 PM UTC-5, yve...@gmail.com wrote: I am trying to write an app which I want to show, say, the calendar app in my app. So, is there a way I can just embed the calendar app view into one of my view (because i want to change the display size, etc) as long as I know the name of the class? Also, I want all touch event or keyboard events are captured by my app. Any way to accomplish 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: How to store AlarmManager object in to shared preference..........
I've worked quite a bit with the AlarmManager and can probably help direct you to a different solution. Since what you are asking for is not really possible (as noted by Mr. Murphy), I'm sure there are other ways of retaining the data that you need. What are you trying to accomplish by saving the AlarmManager? Steven Studio LFP http://www.studio-lfp.com On Tuesday, October 11, 2011 7:54:32 AM UTC-5, saran wrote: Hi all, I'm working on AlarmClock application. When ever my application is killed due to low memory, I want to retain some objects, so I want to store the instance in SharedPreference so that I can retrieve it whenever I needed. So I want to convert an Object into a String and store that String in sharedpreference. I would like to store *AlarmManager* object , for that I'm using ObjectSerializer.java to convert AlarmManager object to String. Below is the code I'm using AlarmManager alarmManager = (AlarmManager) getSystemService( *ALARM_SERVICE*); String alarmString = ObjectSerializer.*serialize*(alarmManager); AlarmManager *alarmMgr* = ObjectSerializer.*deserialize*(alarmString); alarmManager.set(AlarmManager. *RTC_WAKEUP*, System.*currentTimeMillis*() + (i * 1000), pendingIntent); Toast.*makeText*( *this*, Alarm set in + i + seconds, Toast. *LENGTH_LONG*).show(); I'm getting the following error. 10-11 18:10:49.015: INFO/System.out(13048): **Exception*IOE*java.io.NotSerializableException: com.lge.ObjectSerialize.PersistentTime How to resolve this issue. Atleast is there any way to store AlarmManager object into Shared Preference so dat I can use the object wen the application is killed. Any help in this regard would be highly appreciated. thanks in advance, Saran -- 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: time picker: soft keyboard problems: cannot read time
Hey John, You've run into the focus bug (or feature) with the TimePicker. It doesn't update the time put in by a keyboard until it loses focus. Try tossing a TimePicker.clearFocus() in the mix somewhere. If you use it in a dialog, call it on the TimePicker view when you go to dismiss the dialog and read the values after the clearFocus(). If it is somewhere else, you can also use the requestFocus() on other views to pull it away and then read the TimePicker. Steven Studio LFP http://www.studio-lfp.com On Monday, October 10, 2011 9:30:49 AM UTC-5, John Goche wrote: Hello, I am having the following problem with the timepicker. When I use the plus and minus signs to update the time everything works fine but when I use the soft keyboard I cannot read the new value from the time picker. Basically the problem I am having is described here: http://stackoverflow.com/questions/3380761/how-can-i-capture-when-time-changes-in-a-timepicker-if-the-keyboard-is-being-used However I tried the following: TimePicker android:id=@+id/timePicker android:addStatesFromChildren=true android:layout_width=match_parent android:layout_height=wrap_content / and the following: this.timePicker.setOnTimeChangedListener(new OnTimeChangedListener() { @Override public void onTimeChanged(TimePicker view, int hours, int minutes) { System.out.println(hours); System.out.println(minutes); } }); with no luck (I don't see the listener being called when I update the time on the buttons). Same goes for the date picker. What am I doing wrong? I really appreciate your help on this issue, John Goche -- 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
Re: [android-developers] Using drawable resources efficiently
I don't think this works for a ListView when using setBackgroundDrawable(). At least I've not gotten it to work when calling mutate() at every point possible. Is there a trick to get this to work? I didn't load mine from XML, but created it programmatically. Here are the times I called it and it hasn't worked: 1. Right after creation. 2. Right before passing it to setBackgroundDrawable() 3. A few times in between 4. All of the above. I just went back to doing a drawable for each view in the ListView. Steven Studio LFP http://www.studio-lfp.com On Monday, October 10, 2011 5:58:11 AM UTC-5, Mark Murphy (a Commons Guy) wrote: On Mon, Oct 10, 2011 at 6:54 AM, dashman erjd...@gmail.com wrote: I've got a ListView and for each item I display a selector image button defined similar to below: ?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_pressed=true android:drawable=@drawable/flag_clear2 / item android:drawable=@drawable/flag_clear1 / /selector I thought I could load the drawable from the resource file once and I would assign the drawable to each item in the list. That doesn't work because it seems all the items are sharing the same instance and causes problems. When clicking on one - all of the image buttons hilight. Sounds like you need to mutate your drawable: http://android-developers.blogspot.com/2009/05/drawable-mutations.html -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://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
Re: [android-developers] Using drawable resources efficiently
After additional testing, I've confirmed that the mutate() option doesn't allow the use of one Drawable on multiple view under the following conditions unless there is a trick to it that I'm missing. 1. Using a CursorAdapter with a ListView (Using newView and bindView, haven't tried with getView as it would take a rework of code) 2. GradientDrawable created programmatically (the only way you can do it and customize the gradient colors on the fly) 3. GradientDrawable assigned with setBackgroundDrawable() 4. ListView items having different heights and/or widths Maybe the state of the drawable doesn't include the height and width of the object, but there isn't really anything that shows what is included in the state. Seeing that the alpha was included, one would have thought things like size would have also been included. I'd like to go to reusable Drawables as it would simply things, so if anyone has a viable solution, that would be great. Steven Studio LFP http://www.studio-lfp.com On Monday, October 10, 2011 10:53:46 AM UTC-5, Studio LFP wrote: I don't think this works for a ListView when using setBackgroundDrawable(). At least I've not gotten it to work when calling mutate() at every point possible. Is there a trick to get this to work? I didn't load mine from XML, but created it programmatically. Here are the times I called it and it hasn't worked: 1. Right after creation. 2. Right before passing it to setBackgroundDrawable() 3. A few times in between 4. All of the above. I just went back to doing a drawable for each view in the ListView. Steven Studio LFP http://www.studio-lfp.com On Monday, October 10, 2011 5:58:11 AM UTC-5, Mark Murphy (a Commons Guy) wrote: On Mon, Oct 10, 2011 at 6:54 AM, dashman erj...@gmail.com wrote: I've got a ListView and for each item I display a selector image button defined similar to below: ?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_pressed=true android:drawable=@drawable/flag_clear2 / item android:drawable=@drawable/flag_clear1 / /selector I thought I could load the drawable from the resource file once and I would assign the drawable to each item in the list. That doesn't work because it seems all the items are sharing the same instance and causes problems. When clicking on one - all of the image buttons hilight. Sounds like you need to mutate your drawable: http://android-developers.blogspot.com/2009/05/drawable-mutations.html -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://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: Bitmap's getWidth problem
You have two options, use the BitmapFactory + BitmapFactory.Options like this: BitmapFactory.Options bfoOptions = new BitmapFactory.Options(); bfoOptions.inScaled = false; BitmapFactory.decodeResource( rMgr, ResID, bfoOptions ); Or you can put all the resources you don't want scaled in the drawable-nodpi directory here: Project/res/drawable-nodpi/resource.png I've used them both and they seem to both work equally well. If you want the option of deciding to scale or not via a preference or similar, the code edition would probably be the better choice. Steven Studio LFP http://www.studio-lfp.com On Monday, October 10, 2011 10:36:09 PM UTC-5, Perry168 wrote: Hi all, I found that the problem not come from 2.1 or 2.2. When the AVD is using HVGA, the image resolution will display 574. But if AVD is using WVGA800, it will display 861. How can I get the correct image's width and height? Thanks a lot! -- 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
Re: [android-developers] Re: textView Clears on Rotation
I'm compiling a list of things that need to happen in both cases. So far it looks like a lot bigger challenge to not use the android:configChanges than to use it. I've read the optimization post plenty of times and do understand it, but I'd like to get the big picture for the usages of both to be able to decide which is better in certain cases. Here's a few of the issues I'm trying to find good solutions to when *not*using configChanges: 1. Window states are not saved. ListView scroll locations, ExpandedListView drop-downs and scroll locations, ScrollView locations, etc. 2. OpenGL VBOs and textures loaded into memory get destroyed and have to be reprocessed and copied back into memory along with the GLSurfaceView state information 3. Special consideration now has to be taken with AsyncTasks since they are linked to the UI and need to be stopped, location of processing saved and restarted 4. Special consideration for threading, but not quite as much as AsyncTasks 5. Special consideration needs to be taken for the things saved in the bundle so you don't leak the previous context. This could get tricky because I'm sure a lot of people pass a context to objects or blend data and view objects *With* configChanges: 1. Layout may need to be changed on rotation 2. Other unknown issues With the resources being automatically swapped out by Android, a simple refresh on screen elements would pick up a new language if you needed to support that. That also includes any images that might be swapped over, but as I have to refresh the state of my windows even when it isn't rotated, this is already written in the base application anyways. To me it's also wrong to forget about the general case, i.e. other config changes and the out of memory killer (and maybe more cases I can't think of right now). This part did catch my eye and it is what I was wondering. Is there something that the configChanges does to cause internal issues because it is bugged? All of the configuration changes are fairly straight forward and documented, but if there is some issue internally, would be nice to know. In an effort for this discussion not to go to waste, I'm trying to get the full picture compiled together on what has to happen on both so that I can get a post on my site or somewhere to help others. I know we all see this question fly by on this group (and on other help areas) all the time, so I figure a post of the compiled pros and cons of each would be helpful. Anyone that would like to toss in additional information about the things you have to deal with on either occasion (using configChanges or not), please do so and I will compile it for us for future reference. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 9, 2011 4:47:03 AM UTC-5, Kostya Vasilyev wrote: 09.10.2011 2:41, Studio LFP пишет: *TreKing, Kostya, Romain Guy,* I do understand what you guys are saying, so I am listening, but it seems to be a contradiction since it seems most of the internal applications use it, including quite a few that Google themselves send with the devices. Maybe they aren't, but based on the speed of the rotate and the way the screen looks, I'm pretty sure they are. [snip] That's where those methods pointed out by TreKing come into play, as an optimization. And here is a blog post written by Romain Guy that covers this in more detail: http://android-developers.blogspot.com/2009/02/faster-screen-orientation-change.html Those are optimizations for the common cases. The manifest attribute is fine, too, as long as 1) one understands that it's also an optimization 2) the code can handle the general case, where the activity gets recreated and 3) the layout is the same for all orientations. It seems like there are so many times where this is useful and being used, yet people seem to be trying to tell people that it is wrong, incorrect, you are a horrible person and coder for using this. To me, it's wrong to mix up the concepts of here is how you fix this problem and this is an optimization you can make. To me it's also wrong to forget about the general case, i.e. other config changes and the out of memory killer (and maybe more cases I can't think of right now). YMMV. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 4:34:14 PM UTC-5, Romain Guy (Google) wrote: *TreKing,* If you choose to ignore a well documented feature given to us by the Android team, that's your prerogative. As for the rest of us, we'll decide when we prefer to use one feature over another. He makes a good point. Solving this issue by requesting to handle orientation changes yourself just masks the problem (unless you request to handle *all* configuration changes in which case you make more work for yourself.) Handling orientation changes yourself also has a lot of side effects (if you want to have a different
[android-developers] Re: stop progress bar when parsing JSON finish.
Check out the AsyncTask object: http://developer.android.com/reference/android/os/AsyncTask.html Simple sample would be like: private class AsyncInit extends AsyncTaskVoid, Void, Void { public static boolean bThreadRunning = false; public Context context; private ProgressDialog pdDialog; @Override protected void onPreExecute() { bThreadRunning = true; pdDialog = ProgressDialog.show( context, , Doing something, please wait..., true ); } @Override protected void onPostExecute(Void result) { bThreadRunning = false; pdDialog.dismiss(); } @Override protected Void doInBackground(Void... params) { // Do something here in the background return null; } } Then you can just activate that by this: public void openBackground( Context context ) { if( !AsyncInit.bThreadRunning ) { AsyncInit atInit = new AsyncInit(); atInit.context = context; atInit.execute( null, null, null ); } } There are other options available also, check out Threads, Handlers and Runnables also. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 9, 2011 8:12:51 AM UTC-5, Muchamad Jeffri wrote: hello, i want to ask how to implement progress bar spinner in background and then stop when parsing JSON data finish to list view. this my source code. package com.cob.json; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ListView; import android.widget.Toast; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; public class JSONListViewActivity extends Activity { /** Called when the activity is first created. */ //ListView that will hold our items references back to main.xml ListView lstTest; //Array Adapter that will hold our ArrayList and display the items on the ListView ProjectsAdapter arrayAdapter; //List that will host our items and allow us to modify that array adapter ArrayListProjects prjcts=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //Initialize ListView lstTest= (ListView)findViewById(R.id.lstText); //Initialize our ArrayList prjcts = new ArrayListProjects(); //Initialize our array adapter notice how it references the listitems.xml layout arrayAdapter = new ProjectsAdapter(JSONListViewActivity.this, R.layout.list_item,prjcts); //Set the above adapter as the adapter of choice for our list lstTest.setAdapter(arrayAdapter); //Instantiate the Web Service Class with he URL of the web service not that you must pass WebService webService = new WebService(http:// frontine.hostoi.com/jsontest.json); //Pass the parameters if needed , if not then pass dummy one as follows MapString, String params = new HashMapString, String(); params.put(var, ); //Get JSON response from server the are where the method name would normally go if needed example // webService.webGet(getMoreAllerts, params); String response = webService.webGet(, params); try { //Parse Response into our object Type collectionType = new TypeTokenArrayListProjects() {}.getType(); //JSON expects an list so can't use our ArrayList from the lstart ListProjects lst= new Gson().fromJson(response, collectionType); //Now that we have that list lets add it to the ArrayList which will hold our items. for(Projects l : lst) { prjcts.add(l); } //Since we've modified the arrayList we now need to notify the adapter that //its data has changed so that it updates the UI arrayAdapter.notifyDataSetChanged(); } catch(Exception e) { Log.d(Error: , e.getMessage()); } } protected void onListItemClick(ListView lstTest, View v, int position, long id) { // TODO Auto-generated method stub //super.onListItemClick(l, v, position, id); String selection = lstTest.getItemAtPosition(position).toString(); Toast.makeText(this, selection, Toast.LENGTH_LONG).show(); } } -- 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
[android-developers] Re: Multithreading in Android?
Android is designed to keep applications around in a paused state unless it needs the memory back. If it does need memory from currently paused applications, it will close them to free up the required memory. This is to make sure the user can move around faster and provide a better user experience. What you are seeing is normal and you don't have to worry about closing background windows as Android will handle it for you when it needs to. Check out this post for more detail: http://android-developers.blogspot.com/2010/04/multitasking-android-way.html Steven Studio LFP http://www.studio-lfp.com On Sunday, October 9, 2011 3:55:49 AM UTC-5, venugopal reddy wrote: Hi dear friends, I Created one Internet application(using webview). its working fine. I have one doubt, In Applications If click our application icon it will open in browser . i can operate.. now my requirement is if i close the browser straight away that application should be closed... but the application is running background... how can I achieve my requirement, Should i write any particular code or any setting in the emulator.. Pls help me -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: layout changes when on-screen keyboard shows/hides suggestions
Try making the Button and the EditText height match_parent (or fill_parent) instead of wrap_content. I've run into this before and I think the Button and EditText aren't quite the same initial height when using wrap_content. When the keyboard pops up, it might be pushing the Button up to the top of your LinearLayout because the Button is just a slight bit smaller than the EditText. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 9, 2011 5:33:57 AM UTC-5, Alexander Bürger wrote: Dear Android experts, I have a little problem with a layout of an activity. Some elements are moving in a strange way depending on the state of the on-screen keyboard. For testing, I made an Activity that only calls setContentView with this layout: LinearLayout xmlns:android=http://schemas.android.com/apk/res/android; android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent LinearLayout android:layout_height=wrap_content android:layout_width=match_parent android:id=@+id/topcontainer EditText android:id=@+id/editext android:layout_height=wrap_content android:layout_width=1dp android:layout_weight=1/ Button android:id=@+id/buttonright android:text=XY android:layout_height=wrap_content android:layout_width=wrap_content/ /LinearLayout /LinearLayout The problem is this: when starting to type in the EditText, the on-screen keyboard pops up a suggestion bar with some possible completions for the text typed in so far. When this suggestion bar is showing, the Button is moving up by about one pixel on my device (Xperia neo, 2.3.4), and when the suggestion bar is hidden again, the button moves back into the original position.I have no idea why this happens. To my eyes, the layout seems correct. I would be happy about any suggestions on how to get rid of this problem. Thanks for your help, Alexander -- 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: scrollview can't work programmatically
I think it has to do with you are extending ViewGroup. Try this redone code where it is extending LinearLayout instead and see if it does what you need it to. public class MyView extends LinearLayout { ScrollView myScrollView; TextView tv; public MyView( Context context ) { super(context); myScrollView = new ScrollView(context); myScrollView.setBackgroundColor(0xfff00fff); tv = new TextView(context); tv.setTextColor( Color.BLACK ); tv.setText(sadfasdfasdfasdfasdfasdfasdfsadfsadf); tv.setHeight(5000); tv.setWidth(3200); myScrollView.addView( tv, new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT ) ); addView( myScrollView, new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT ) ); } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { int width = r-l; int height =b-t; myScrollView .layout(0, 0, width, height-100); } } It works in a test situation, but not sure it will do what you want in your application, so give it a shot and let us know. Steven Studio LFP http://www.studio-lfp.com On Sunday, October 9, 2011 1:08:22 PM UTC-5, billconan wrote: Hello guys, I want to use scrollview in my app. I tried to add a text view into the scrollview, but I can't see anything rendered, except the background color of the scroll view. here is how I did it: public class MyView extends ViewGroup { ScrollView myScrollview; Textview tv; public MyView(Context context) { myScrollView = new ScrollView(context); myScrollView.setBackgroundColor(0xfff00fff); textview=new TextView(context); textview.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); textview.setLayoutParams(params) textview.setText(sadfasdfasdfasdfasdfasdfasdfsadfsadf); textview.layout(0, 0, 1000, 2000); textview.setHeight(5000); textview.setWidth(3200); myScrollView .addView(tv); addView(myScrollview); } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { // TODO Auto-generated method stub int width = r-l; int height =b-t; myScrollView .layout(0, 0, width, height-100); } } I found almost all the scrollview tutorial are using xml to define the view. But I want to do it in a programmatic way. But anyway, I also tried xml. I copied Romain Guy's xml from here for testing :http://www.curious- creature.org/2010/08/15/scrollviews-handy-trick/ The xml scrollview by itself is correct, if I create this scrollview and add it to the activity, using scrollview= (ScrollView) getLayoutInflater().inflate(R.layout.scrollviewid,null); setContentView(scrollview); or setContentView(R.layout.scrollviewid); it worked. However, if I want to make the scrollview a child view of some other view, again I could only see the background of the scrollview. nothing inside is rendered: public class MyView extends ViewGroup { ScrollView myScrollview; public MyView(Activity activity,Context context) { super(context); myScrollview= (ScrollView) activity.getLayoutInflater().inflate(R.layout.restaurantcategoryselectorviewlayout,null); myScrollview.setBackgroundColor(0xfff00fff); addView(myScrollview); } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { // TODO Auto-generated method stub int width = r-l; int height =b-t; myScrollview.layout(0, 0, width, height-100); } } What's wrong with my code? Is there any example of creating scrollview with program not xml? Also, are those java source code of android also at kernel.org? since the git service is down, where can I download android source code? Thanks you! -- 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: Graphical anomaly with hints disappearing. Can anyone explain?
There is definitely something wrong in the code. The first time I tested was on a Samsung Galaxy Tab (2.2) and I just tested it again on the Xperia Play (2.3.2) and it worked just fine. If you want to post the XML that contains the layout, that would be helpful. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 10:11:33 AM UTC-5, darrinps wrote: I have tried it out on a 2.2 device (Samsung Galaxy) and using the 2.3 emulator. Same thing on both. What is odd though is that is shows up in the preview just fine! I know, you would think that there is something shifting it in the code but the just isn't. This is very frustrating. On Oct 7, 4:04 pm, Studio LFP studi...@gmail.com wrote: I just tested this on an application I had in front of me and it worked well. Which version of Android are you testing on (and what hardware)? Are there any other settings on the view that might be causing a conflict? Or maybe there is another view overlapping that is causing an issue? Steven Studio LFPhttp://www.studio-lfp.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
Re: [android-developers] Re: Graphical anomaly with hints disappearing. Can anyone explain?
I tested the following code: EditText android:id=@+id/etMessage android:layout_width=fill_parent android:layout_height=fill_parent android:layout_weight=1 android:hint=Compose text message... android:maxLines=3 android:capitalize=sentences android:autoText=true android:inputType=textShortMessage|textAutoCorrect|textCapSentences|textMultiLine android:imeOptions=flagNoExtractUi android:gravity=top|right / On the following devices: Motorola Droid (2.2.2) HTC Hero (2.1-update 1) Samsung Galaxy Tab (2.2) Sony Xperia Play (2.3.2) They all worked fine. Maybe adding the top to it corrected it. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 10:42:59 AM UTC-5, Kostya Vasilyev wrote: FWIW: I just tried it on an HTC Incredible S (official firmware, 2.3.3) and got the same result as the OP: Setting android:gravity=right made android:hint disappear. Previews as rendered by a special library, which, AFAIK, does not use the same exact code as a real runtime (device or emulator) does. -- Kostya 08.10.2011 19:20, Studio LFP пишет: There is definitely something wrong in the code. The first time I tested was on a Samsung Galaxy Tab (2.2) and I just tested it again on the Xperia Play (2.3.2) and it worked just fine. If you want to post the XML that contains the layout, that would be helpful. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 10:11:33 AM UTC-5, darrinps wrote: I have tried it out on a 2.2 device (Samsung Galaxy) and using the 2.3 emulator. Same thing on both. What is odd though is that is shows up in the preview just fine! I know, you would think that there is something shifting it in the code but the just isn't. This is very frustrating. On Oct 7, 4:04 pm, Studio LFP stud...@gmail.com wrote: I just tested this on an application I had in front of me and it worked well. Which version of Android are you testing on (and what hardware)? Are there any other settings on the view that might be causing a conflict? Or maybe there is another view overlapping that is causing an issue? Steven Studio LFPhttp://www.studio-lfp.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-d...@googlegroups.com To unsubscribe from this group, send email to android-develop...@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
[android-developers] Re: unreasonable NullPointerException in onDestroy()
Based on that, you shouldn't get a crash, but obviously that's not the full code you are using. Are you changing that variable at any other point in the code? Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 3:34:15 AM UTC-5, DraganA wrote: I'm puzzled as to why I'm getting Null pointer exception in the construct below, knowing the Activity life cycle, it shouldn't happen. Could the clue be in TabActivity?? public class Main extends TabActivity { private ListString list; public void onCreate(Bundle savedInstanceState) { list = new ArrayListString(); } protected void onDestroy() { list.clear(); } } -- 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: ExpandableListView And Fragment
You should be able to use any widget in a Fragment just like you do in an Activity. Check this part out: http://developer.android.com/guide/topics/fundamentals/fragments.html#UI You design an XML file the same way for an Activity and a Fragment. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 2:30:33 AM UTC-5, Akhilesh Mani Tiwari wrote: Hi, Please suggest me how to use ExpandableListView and Fragments in same layout. If possible please give me right link or example. Regards Mani. -- 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
Re: [android-developers] Re: textView Clears on Rotation
*TreKing,* This is true, but he didn't ask about that. He just asked about a way for an EditText to keep the text it has on a rotate. The easiest and fastest way to solve that particular problem is the configChanges XML attribute. You'll note that I said their may be a need for other options if they needed it to do additional things other than just handle a rotate. There is no need to code complicated functions to do something simple. Fix it the simplest way possible and then add to it if other things arise. *King Salamon,* You can review this documentation to understand more about how to save the state in an Activity: http://developer.android.com/guide/topics/fundamentals/activities.html#SavingActivityState Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 2:13:01 AM UTC-5, TreKing wrote: On Fri, Oct 7, 2011 at 3:59 PM, Studio LFP studi...@gmail.com wrote: Add this to your activity tag in the AndroidManifest.xml android:configChanges=orientation|keyboardHidden That will fix you up That will hide the issue until the app is destroyed / recreated via some other means - like being put in the background and being returned to later. - 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: unreasonable NullPointerException in onDestroy()
Without code samples, I don't think anyone is going to be able to help you find your issue. I use this all the time and the only time I have seen it not work was when I made a mistake somewhere else in the code. I do usually do a null check on things in the onDestory before I use them because my code can get more complicated as it goes. I end up changing variables along the way forgetting I'm cleaning them up at the end. If you do find a serious bug like this, you'd definitely want to go through the steps to reproduce it and post a bug reports in the Android Issue Tracker if someone else hasn't found it already. http://code.google.com/p/android/issues/list Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 11:53:05 AM UTC-5, DraganA wrote: That's the problem, the list is created in onCreate() method and is not reassigned or set to null anywhere. I forgot to say, the null pointer happens in onDestroy() method in list.clear() line. From that I can only deduce that onDestroy() is called before onCreate() On Oct 8, 5:42 pm, Studio LFP studi...@gmail.com wrote: Based on that, you shouldn't get a crash, but obviously that's not the full code you are using. Are you changing that variable at any other point in the code? Steven Studio LFPhttp://www.studio-lfp.com On Saturday, October 8, 2011 3:34:15 AM UTC-5, DraganA wrote: I'm puzzled as to why I'm getting Null pointer exception in the construct below, knowing the Activity life cycle, it shouldn't happen. Could the clue be in TabActivity?? public class Main extends TabActivity { private ListString list; public void onCreate(Bundle savedInstanceState) { list = new ArrayListString(); } protected void onDestroy() { list.clear(); } } -- 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
Re: [android-developers] Re: textView Clears on Rotation
*TreKing,* If you choose to ignore a well documented feature given to us by the Android team, that's your prerogative. As for the rest of us, we'll decide when we prefer to use one feature over another. *King Salamon*, As stated previously, regardless of which way you choose to do it (neither is correct or incorrect), just read up on the things you need to handle to make them work like you need them to. If you really want to save a state long-term, I would suggest you also look at SharedPreferences: http://developer.android.com/reference/android/content/SharedPreferences.html You aren't guaranteed your state will still be there even if you do save it in a bundle. You should treat the state of your application as volatile at all times. If a state or piece of data is really important to keep around, commit it to disk immediately via the SharedPreferences or another method like a custom file, database, etc.. Devices are constantly switching states even when we don't want them to. Battery dying, being dropped, locking up, and tons of others things make sure the mobile environment is never guaranteed, so write accordingly. Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 3:02:34 PM UTC-5, TreKing wrote: On Sat, Oct 8, 2011 at 12:00 PM, Studio LFP studi...@gmail.com wrote: *TreKing,* This is true, but he didn't ask about that. LOL - so since he didn't ask for for a method that covers the case I mentioned, it's OK to give him a limited solution? He just asked about a way for an EditText to keep the text it has on a rotate. What people ask on this list is usually very different from the problem they're actually having. The easiest and fastest way to solve that particular problem is the configChanges XML attribute. Easiest and fastest, but technically incorrect. He's probably asking specifically about rotate because that's also the easiest and fastest way to see the issue. But, as I mentioned, it's not the only way and the OP should be completely aware of that before going with a strategy that will only hide the problem in one particular scenario. You'll note that I said their may be a need for other options if they needed it to do additional things other than just handle a rotate. You mentioned the case of different layouts which doesn't cover the case of leaving the app, waiting a while, and coming back to it (AFAIK). There are probably others. There is no need to code complicated functions to do something simple. Fix it the simplest way possible and then add to it if other things arise. Sure, but if the simplest way possible is known to have issues, you're not really doing the OP any favors, are you? Now he'll waste time fixing it the simplest way, then eventually having to come back and fix it the right way. Why not have him do it the right way from get-go if you can? It's not like using the save and restore methods is that complicated. IMHO, the configChanges attributes are for use when you know exactly what you're doing with them and why. Using them to get around saving / restoring state is a fragile kludge for people that can't figure out how to do it correctly. People should be encouraged to figure out how to do this the right way so it works in every scenario and not use what amounts to a hack to solve the most common instance of configuration change. And I say all this because I've seen way to many people ask about this exact scenario in this group. - 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