[android-developers] Re: How to select/install a locale other than English ?
I don't want to test individual activities. I know how to for the choice of the language using something similar to the code you post. However, I don't want to create an option "Language" in the configuration of my application, I just want to use the setting of the mobile. So, does someone know how to install a new language (here french) on Android Dev Phone 1 ? On 12 déc, 01:03, shomari wrote: > If you just need to test your "individual" activities, here is some > code that you can insert in onCreate: > > Locale locale = new Locale("fr"); > Locale.setDefault(locale); > Configuration config = new Configuration(); > config.locale = locale; > getBaseContext().getResources().updateConfiguration(config, > getBaseContext().getResources().getDisplayMetrics()); > > This should activate your French resources > > BUT! be warned that this code has stopped working for me since Android > 2.0. > Seems others are also experiencing problems since the new SDK. > Note sure how to fix it yet (so I'd suggest compiling against Android > 1.6, if possible) > > S. > > On Dec 11, 4:27 am, Syl wrote: > > > My application has resources files in English and French and works on > > Android 1.5 and >. > > > Inside the emulator, in Settings > Locale & Text > Select Locale, I > > can choose English or French. This updates the language of my > > application. > > > However, when I use the Android Dev Phone 1, only English is available > > in the "Select Locale" screen... > > > Is it possible to install french locale on Android Dev Phone 1 ? > > If so, how can I do this ? > > > Thanks for your help ! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] [Android Dev Phone 1] How to select/install a locale other than English ?
My application has resources files in English and French and works on Android 1.5 and >. Inside the emulator, in Settings > Locale & Text > Select Locale, I can choose English or French. This updates the language of my application. However, when I use the Android Dev Phone 1, only English is available in the "Select Locale" screen... Is it possible to install french locale on Android Dev Phone 1 ? If so, how can I do this ? Thanks for your help ! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] [Android Manifest] How to set same XML attributes to all activities ?
In my application, I don't want the activity to restart when user changes his mobile's orientation or when he opens his physical keyboard. So, I have to assign the following XML attribute to all my activities in the manifest file : android:configChanges="keyboard|keyboardHidden|orientation" I have a dozen of activities. So, my question is : Is it possible to assign the same XML attribute value to all activities ? Or should I copy the attribute in all the tags of the manifest ? Thanks ! PS : I try to set the attribute value in the tag but it doesn't work. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email 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 release Drawable object from memory ?
I try this solution but it did not work anymore, even if I do "System.gc()" to call the garbage collector after setting to null the variable (calling this method does not guarantee that the garbage collector will actually be run). However, I manage to solve my problem resizing the image. First I get the image size using : BitmapFactory.decodeStream(InputStream is, Rect outPadding, BitmapFactory.Options opts) and setting opts.inJustDecodeBounds to true (to save memory). Image size is then got with opts.outHeight and opts.outWidth. Then, I calculate and set opts.inSampleSize value judging from the maximum image size I want. Finally, I call again BitmapFactory.decodeStream(InputStream is, Rect outPadding, BitmapFactory.Options opts) and get the resized image. On 28 nov, 03:59, Anirudh wrote: > As a crude sort of way to get around this problem, you can assign your > drawable references to null once you do not find a use for them so > that the GC can free these allocations. > > On Nov 26, 10:23 am, "daniel.benedykt" > wrote: > > > Hi > > > Probably you are having a memory leak > > > Read this article from google blog. > > >http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks > > > Hope this helps, > > > Daniel > > > On Nov 26, 3:42 pm, Syl wrote: > > > > In my application, user can click on a button and then he can select a > > > picture from his gallery. > > > This image is then displayed. > > > > However, when the user performs 3 or 4 times this operation, the > > > following exception is thrown, due to memory allocation problem : > > > > 11-26 18:31:34.119: ERROR/dalvikvm-heap(707): 6291456-byte external > > > allocation too large for this process. > > > 11-26 18:31:34.119: ERROR/(707): VM won't let us allocate 6291456 > > > bytes > > > 11-26 18:31:34.119: DEBUG/skia(707): > > > allocPixelRef failed > > > 11-26 18:31:36.005: DEBUG/AndroidRuntime(707): Shutting down VM > > > 11-26 18:31:36.005: WARN/dalvikvm(707): threadid=3: thread exiting > > > with uncaught exception (group=0x40013e28) > > > 11-26 18:31:36.005: ERROR/AndroidRuntime(707): Uncaught handler: > > > thread main exiting due to uncaught exception > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): > > > java.lang.OutOfMemoryError: bitmap size exceeds VM budget > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.graphics.BitmapFactory.nativeDecodeStream(Native Method) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:304) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.graphics.drawable.Drawable.createFromStream(Drawable.java:635) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > com.altran.test.selectpicture.MainActivity.onActivityResult > > > (MainActivity.java:74) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.app.Activity.dispatchActivityResult(Activity.java:3415) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.app.ActivityThread.deliverResults(ActivityThread.java:2835) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.app.ActivityThread.handleSendResult(ActivityThread.java:2881) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.app.ActivityThread.access$2300(ActivityThread.java:112) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1608) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.os.Handler.dispatchMessage(Handler.java:88) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.os.Looper.loop(Looper.java:123) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > android.app.ActivityThread.main(ActivityThread.java:3742) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > java.lang.reflect.Method.invokeNative(Native Method) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > java.lang.reflect.Method.invoke(Method.java:515) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run > > > (ZygoteInit.java:739) > > > 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at > > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) > >
[android-developers] [OutOfMemoryError] How to release Drawable object from memory ?
In my application, user can click on a button and then he can select a picture from his gallery. This image is then displayed. However, when the user performs 3 or 4 times this operation, the following exception is thrown, due to memory allocation problem : 11-26 18:31:34.119: ERROR/dalvikvm-heap(707): 6291456-byte external allocation too large for this process. 11-26 18:31:34.119: ERROR/(707): VM won't let us allocate 6291456 bytes 11-26 18:31:34.119: DEBUG/skia(707): allocPixelRef failed 11-26 18:31:36.005: DEBUG/AndroidRuntime(707): Shutting down VM 11-26 18:31:36.005: WARN/dalvikvm(707): threadid=3: thread exiting with uncaught exception (group=0x40013e28) 11-26 18:31:36.005: ERROR/AndroidRuntime(707): Uncaught handler: thread main exiting due to uncaught exception 11-26 18:31:36.099: ERROR/AndroidRuntime(707): java.lang.OutOfMemoryError: bitmap size exceeds VM budget 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:304) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.graphics.drawable.Drawable.createFromStream(Drawable.java:635) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at com.altran.test.selectpicture.MainActivity.onActivityResult (MainActivity.java:74) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.app.Activity.dispatchActivityResult(Activity.java:3415) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.app.ActivityThread.deliverResults(ActivityThread.java:2835) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.app.ActivityThread.handleSendResult(ActivityThread.java:2881) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.app.ActivityThread.access$2300(ActivityThread.java:112) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1608) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.os.Handler.dispatchMessage(Handler.java:88) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.os.Looper.loop(Looper.java:123) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at android.app.ActivityThread.main(ActivityThread.java:3742) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at java.lang.reflect.Method.invokeNative(Native Method) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at java.lang.reflect.Method.invoke(Method.java:515) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:739) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) 11-26 18:31:36.099: ERROR/AndroidRuntime(707): at dalvik.system.NativeStart.main(Native Method) Here a sample of my code where problem is focused : InputStream is = getContentResolver().openInputStream( currImageURI ); Drawable drawable = Drawable.createFromStream( is, "src" ); is.close(); m_imageView.setBackgroundDrawable( drawable ); Is it possible to force object (here the Drawable object) to be released from memory ? 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] [Form] Does it exist an Android view equivalent to a "" HTML input element ?
Does it exist an Android view equivalent to a "" HTML input element ? In my application, user should fill a form. I know that ListView can display a list of elements but I think it's not relevant for a form. 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: How to remove sms notifications in status bar
I have the same problem problem of you Muhammad. I manage to detect SMS receive using a BroadcastReceiver and then delete the specified SMS in inbox. However, status bar notification always remains. I think it is not possible to remove this notification because it's sent by the Messaging application. We can avoid SMS receive notification by unchecking the "Notifications" checkbox in the Messaging application settings. However, it's not a good solution because all user won't unckeck it. I would be surprised if we can remove status bar notification of an other application because it could be used by a malware. What do you think ? Did you found a solution to this issue ? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: [Quit application correctly] How to execute code before exiting application ?
Thanks Dianne. Ok, I could implement something like this : - implement a counter inits to 0 when the thread is started - when an Activity starts (in method onStart() ), increment the counter - when an Activity stops (in method onStop() ), decrease the counter - when the counter equals 0, stop the thread However, I think a problem can occurs when the system need resource and kills the activity in the onPause() method. So the onStop() method of the activity is not called => the counter is not decreased => the Thread will not be stopped ! Q4 : Is it possible to handle this situation, when system kills the activity ? Q5 : Can you confirm me that onStop() and onDestroy() activity's methods are not called when the system kills the activity in the onPause() method ? On 18 nov, 19:02, Dianne Hackborn wrote: > You don't "exit" an application; in fact an application is a fairly nebulous > concept on Android. You should do this kind of stuff in Activity -- for > example, as long as you have an activity in the start state, then continue > running your work thread. > > > > On Wed, Nov 18, 2009 at 2:02 AM, Syl wrote: > > I would like to know how to execute code before exiting application. > > > My application is composed of several activities. When the user starts > > the application (from the launcher menu or from a notification in the > > status bar), he goes in an InitActivity where I process some > > initializations. From user experience, application always restarts. > > > One of these initializations is to init a network manager and start a > > thread that periodically sends a network request to notify a server > > that application is active. > > > I need to process some end operations, like stopping this thread when > > user quits application, for example by pressing the HOME key or BACK > > key when he's in the root activity. > > > However, when the user press the HOME key, application is still > > running in background. > > > Here are my questions : > > > Q1 : is it possible to execute code when exiting application (I see > > the onTerminate() method of the class Application but it seems not to > > be always called) ? > > > Q2 : Is it possible to force application exit (activity method finish > > () only destroy the current activity, not the application) ? > > > Q3 : Is it possible to handle HOME key press (onKeyDown() is not > > called when this button is pushed) ? > > > Thanks for your help. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Installing APK from Internet?
I have tested installation from Internet but only with the Emulator. Inside a web page, I set a link toward a APK file (for example : Click here to install). >From the web browser in the emulator, when I click on the link, the file is downloaded. Then, when I click on the downloaded file from the download manager of the browser, installation starts (NOTE : a message can invite the user to modify settings to authorize the install of packages not provided from Android Market). However, I have not tested the behaviour on a real device. Does any one know if it is the same behaviour ? On 19 nov, 04:19, babu wrote: > Is there any way to download APK from the internet on an Android phone > (T Mobile MyTouch)? I have installed the Apps Installer application > that installs APK's from the SDCard. However I want to download the > APK from the internet and then use Apps Installer to install it. > Currently when I download my APK, it gets stored as a TXT file on the > phone for some reason. Is there any way around 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] [Quit application correctly] How to execute code before exiting application ?
I would like to know how to execute code before exiting application. My application is composed of several activities. When the user starts the application (from the launcher menu or from a notification in the status bar), he goes in an InitActivity where I process some initializations. From user experience, application always restarts. One of these initializations is to init a network manager and start a thread that periodically sends a network request to notify a server that application is active. I need to process some end operations, like stopping this thread when user quits application, for example by pressing the HOME key or BACK key when he's in the root activity. However, when the user press the HOME key, application is still running in background. Here are my questions : Q1 : is it possible to execute code when exiting application (I see the onTerminate() method of the class Application but it seems not to be always called) ? Q2 : Is it possible to force application exit (activity method finish () only destroy the current activity, not the application) ? Q3 : Is it possible to handle HOME key press (onKeyDown() is not called when this button is pushed) ? Thanks for your help. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] MapActivity - "Couldn't get connection factory client" error in LogCat
I met an issue to use the Google Maps API, even using the sample code available in "/add-ons/google_apis-4/samples/ MapsDemo" directory and modifing the "android:api-key" attribute value with my own Maps API key in the MapView element. The MapView always stays grey. I create a project with a single MapActivity and a single MapView (code is provide below, Maps API key is my own key) I am behing a proxy so I configure it in "Settings > Wireless controls > Mobile networks > Access Point Name" (the web browser can access to the internet) When launching the activity, I always get the following log in logcat : 11-04 09:16:43.211: DEBUG/dalvikvm(766): GC freed 8515 objects / 598184 bytes in 91ms 11-04 09:16:46.101: INFO/ActivityManager(585): Starting activity: Intent { act=android.intent.action.MAIN cat= [android.intent.category.LAUNCHER] flg=0x1020 cmp=com.test.maps/.MyMapActivity } 11-04 09:16:46.211: ERROR/ActivityThread(766): Failed to find provider info for com.google.settings 11-04 09:16:46.222: ERROR/ActivityThread(766): Failed to find provider info for com.google.settings 11-04 09:16:46.222: WARN/MapActivity(766): Recycling dispatcher com.google.googlenav.datarequest.datarequestdispatc...@4376cd20 11-04 09:16:46.231: VERBOSE/MapActivity(766): Recycling map object. 11-04 09:16:46.362: INFO/MapActivity(766): Handling network change notification:CONNECTED 11-04 09:16:46.362: ERROR/MapActivity(766): Couldn't get connection factory client 11-04 09:16:46.421: INFO/ActivityManager(585): Displayed activity com.test.maps/.MyMapActivity: 263 ms (total 263 ms) Do you know how to solve this problem ? Why do I get a "Couldn't get connection factory client" error ? Thanks for your help ! Here my Java class, my XML layout file and my AndroidManifest.xml file. I use Android 1.6 and Eclipse ADT. I use package com.test.maps for this project # MyMapActivity.java package com.test.maps; import android.os.Bundle; import com.google.android.maps.MapActivity; public class MyMapActivity extends MapActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mapview); } protected boolean isRouteDisplayed() { return false; } } # res/layout/mapview.xml http://schemas.android.com/apk/res/ android" android:layout_height="fill_parent" android:layout_width="fill_parent" > # AndroidManifest.xml http://schemas.android.com/apk/res/android"; package="com.test.maps" android:versionCode="1" android:versionName="1.0"> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email 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] TDD
I've been looking at various tools and reading various articles around TDD on the Android platform. A common thread seems to be that the testing framework is very poorly documented - and indeed that seems to be the case. From what I can see, standard JUNIT testing (not using activities) is very easy to set up. However usage of test stories to actually test activities (user input), databases etc, seems very limited. Has anyone had any success with this that they would care to share? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email 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 -~--~~~~--~~--~--~---