Re: [android-developers] change image onConfigurationChanged
If i use setContentView in onConfigurationChanged it works but i have to get all views from layout again. Any other ideas ? On Mon, Jul 12, 2010 at 4:46 PM, Martin Obreshkov manig...@gmail.comwrote: Nothing happens still the image from portrait view is shown On Mon, Jul 12, 2010 at 4:41 PM, Mark Murphy mmur...@commonsware.comwrote: On Mon, Jul 12, 2010 at 9:31 AM, Martin Obreshkov manig...@gmail.com wrote: @Override public void onConfigurationChanged(Configuration conf) { super.onConfigurationChanged(conf); mImageView.setImageDrawable(getResources().getDrawable(mBackgroundDrawableId)); } On a whim, try mImageView.setImageResource(mBackgroundDrawableId); -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- When I raise my flashing sword, and my hand takes hold on judgment, I will take vengeance upon mine enemies, and I will repay those who haze me. Oh, Lord, raise me to Thy right hand and count me among Thy saints. -- When I raise my flashing sword, and my hand takes hold on judgment, I will take vengeance upon mine enemies, and I will repay those who haze me. Oh, Lord, raise me to Thy right hand and count me among Thy saints. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] change image onConfigurationChanged
Hi all, I have an activity which handles configuration changes by itself e.g it's not destroyed and recreated every time. But now i have to change one image with another when configuration is changed. The easies way is just to remove android:configChanges attribute from manifest and to let android handle config changes but there are some resources coupled with activity lifecycle which i don't wont to refactor right now. So is there a way to change image for different configurations manually. I tried in onConfigurationChanged callback just to set again the image drawable and hoping will get the correct image but it's still showing the image for portrait view ( the two images are placed in res/ drawable and res/drawable-land :) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] change image onConfigurationChanged
On Mon, Jul 12, 2010 at 9:18 AM, manigault manig...@gmail.com wrote: I tried in onConfigurationChanged callback just to set again the image drawable and hoping will get the correct image but it's still showing the image for portrait view ( the two images are placed in res/ drawable and res/drawable-land :) A code snippet showing how you are doing this will help us help you. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] change image onConfigurationChanged
@Override public void onConfigurationChanged(Configuration conf) { super.onConfigurationChanged(conf); mImageView.setImageDrawable(getResources().getDrawable(mBackgroundDrawableId)); } where mImageView is my ImageView and mBackgroundDrawableId is the id of the current ImageView drawable ( cause there can be more then one drawable set ) and as i said there are two versions of the image in res/drawable and res/drawable-land. If i start the activity in landscape mode the correct image is taken. On Mon, Jul 12, 2010 at 4:22 PM, Mark Murphy mmur...@commonsware.comwrote: On Mon, Jul 12, 2010 at 9:18 AM, manigault manig...@gmail.com wrote: I tried in onConfigurationChanged callback just to set again the image drawable and hoping will get the correct image but it's still showing the image for portrait view ( the two images are placed in res/ drawable and res/drawable-land :) A code snippet showing how you are doing this will help us help you. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- When I raise my flashing sword, and my hand takes hold on judgment, I will take vengeance upon mine enemies, and I will repay those who haze me. Oh, Lord, raise me to Thy right hand and count me among Thy saints. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] change image onConfigurationChanged
On Mon, Jul 12, 2010 at 9:31 AM, Martin Obreshkov manig...@gmail.com wrote: @Override public void onConfigurationChanged(Configuration conf) { super.onConfigurationChanged(conf); mImageView.setImageDrawable(getResources().getDrawable(mBackgroundDrawableId)); } On a whim, try mImageView.setImageResource(mBackgroundDrawableId); -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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] change image onConfigurationChanged
Nothing happens still the image from portrait view is shown On Mon, Jul 12, 2010 at 4:41 PM, Mark Murphy mmur...@commonsware.comwrote: On Mon, Jul 12, 2010 at 9:31 AM, Martin Obreshkov manig...@gmail.com wrote: @Override public void onConfigurationChanged(Configuration conf) { super.onConfigurationChanged(conf); mImageView.setImageDrawable(getResources().getDrawable(mBackgroundDrawableId)); } On a whim, try mImageView.setImageResource(mBackgroundDrawableId); -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- When I raise my flashing sword, and my hand takes hold on judgment, I will take vengeance upon mine enemies, and I will repay those who haze me. Oh, Lord, raise me to Thy right hand and count me among Thy saints. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en