[android-developers] Re: UI problem
Depends on if you use custom images for the UI elements. If so, you will need to make different versions for each screen configuration (LDPI, MDPI, HDPI and the xtra large one if you truly avid in this). If your UI is comprised of only the standard UI components that the Android SDK presents you, then using relative layouts in your UI design is much better than fixed layouts. Using RelativeLayout instead of let's say LinearLayout will cause the UI to automatically scale the components you have placed on it. On 26 mei, 11:40, kaushik p kaushiks...@gmail.com wrote: Hi all I have written a UI for one android phone say X whose screen size is 7 inches , now if i install my application to other phone whose screen is 3 inches , the UI is not relatively displayed . It still shows the button as huge as 7 inch screen one . Due to this my application is only half visible on the screen . Please help me to make my application in such a way that it is correctly visible on cell phone of any size . -- ThanksRegards Kaushik Pendurthi http://kaushikpendurthi.blogspot.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: UI problem
h. OK. But without creating a new thread the changes made to the button are not visible (END View pops up). Can you give me a suggestion the original problem please? Thank 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: UI problem
Hard to say what you really want from the snippets of information and code you provided. Generally speaking you normally only call setContent() to setup your screen from your activity's onCreate() method, not when some state changes that needs reflection on the UI. When you have state changes you need to find the GUI element that you want to change with findViewById() an call setText() (or whatever) on it directly. It will redraw itself then. And as Romain said, don't do any sleeps or other long running stuff on the UI thread. This way you will block, which will in turn lead to unresponsiveness, e.g. a press of the menu key or a tap on the screen will not be dispatched until the UI thread is freed up again. Provide a working, simple, short sample just demoing one concept you are trying to understand. And it would be easier to help you. What helped me better understanding this basic concepts was doing the samples. http://developer.android.com/guide/tutorials/notepad/index.html On Thu, May 14, 2009 at 8:37 AM, Sukitha Udugamasooriya suk...@gmail.comwrote: Hi geniuses, I have few buttons on the content. When I click on one button, 1-- I want to change the text of the button. 2-- Then I want to change the content view. this is my method which executes with the onClick event. private void markUser(int index) { btnArray[index].setText(mark); btnArray[index].setClickable(false); showGameOverMenu(); // calls the setContentView(); } Here the problem is the text change of the button is not visible. How can I make it visible??? I'm not thorough with how the UI thread works in android Thanks in advance Sukitha (wannaB android master ;)) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: UI problem
You want a delay between changing the button's text and showing the new content-view? If that's the case, private void markUser(int index) { btnArray[index].setText(mark); btnArray[index].setClickable(false); postDelayed(new Runnable() { public void run() { showGameOverMenu(); // calls the setContentView (); } }, delay); } (postDelayed may have to be called using a View or Handler instance) On May 14, 2:37 am, Sukitha Udugamasooriya suk...@gmail.com wrote: Hi geniuses, I have few buttons on the content. When I click on one button, 1-- I want to change the text of the button. 2-- Then I want to change the content view. this is my method which executes with the onClick event. private void markUser(int index) { btnArray[index].setText(mark); btnArray[index].setClickable(false); showGameOverMenu(); // calls the setContentView(); } Here the problem is the text change of the button is not visible. How can I make it visible??? I'm not thorough with how the UI thread works in android Thanks in advance Sukitha (wannaB android master ;)) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: UI problem
Yeahh.. I found out.. runOnUiThread() is the solution Thread t = new Thread() { public void run() { f.runOnUiThread(new Runnable() { @Override public void run() { holdGame(3000); setContentView(R.layout.game_end_menu); initGameOver(); } }); } }; t.start(); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: UI problem
This code is just wrong: you are starting a new thread just to run code back on the UI thread. All your code amounts to doing nothing but run the content of the run() method. Even worse, if holdGame(3000) triggers a thread sleep, you are blocking the UI thread. On Thu, May 14, 2009 at 2:59 AM, Sukitha Udugamasooriya suk...@gmail.com wrote: Yeahh.. I found out.. runOnUiThread() is the solution Thread t = new Thread() { public void run() { f.runOnUiThread(new Runnable() { �...@override public void run() { holdGame(3000); setContentView(R.layout.game_end_menu); initGameOver(); } }); } }; t.start(); -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---