[android-beginners] Re: Key Value pair in a spinner
Hi Alex, It sounds like you might be making a simple thing complicated. You want to use two parallel arrays, one array for the keys that display in the spinner and the second array for the numerical values when one of the keys is selected. Put the keys and values in the correct order so the index will match up. Maybe I misunderstand but it seems like a straightforward case where you can access the correct value by reading the position from the spinner key when there is a click event on the spinner. With regards to your request for information on layouts... I found this web page with a bunch of the layouts from Android 1.5 to be very helpful: http://svn.jetbrains.org/idea/BRANCHES/MaiaM1/bundled/android/testData/sdk1.5/platforms/android-1.5/data/res/layout/ Regards, Beth On Sep 3, 6:56 am, Justin Anderson janderson@gmail.com wrote: I haven't tried using the spinner adapter yet, so I'm not sure, but it might be possible to do the following: - Create a new object that holds both the city string and the number - Override the toString() method to return the city string - Pass the array of your new object type to the spinner - Then the spinner would return your object and you can get the number value from that Again, I don't know how the spinner adapter is set up exactly, but you might be able to get something like this to work. Hope that helps, Justin -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Thu, Sep 3, 2009 at 3:48 AM, AlexDemers demers.a...@gmail.com wrote: Anyone knows how to? Am I being clear? On Aug 20, 8:48 pm, AlexDemers demers.a...@gmail.com wrote: Hey, I was wondering how to put a string array in a spinner (I can, using the ArrayAdapter) but I also want to set keys for these also. But it seems that there's no constructors for that (I may be mistaken). I have 2 arrays: {5123, 7434, 7333, 7345 } and {City 1, City 2, City 3, City 4 }. Obviously, the spinner UI should show the name array of the cities, but in the backend (what's returned from the submission of the form is the value. Anyone knows how? // Put the array in the spinner ArrayAdapterString adapter = new ArrayAdapterString(this, android.R.layout.simple_spinner_item, cityNames); spinCities.setAdapter(adapter); While, I'm the subject of spinners: is there any resource on the internet describing every type of spinner layouts? I'm using simple_spinner_item but I find it too small. Any suggestions? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Default keyboard pop up
There are a few posts on this subject on the other Android group. I looked into this over the weekend while trying to turn off the onscreen keyboard for a timepicker widget. Here is the answer for Edit Text: -- Forwarded message -- Date: Sun, Aug 30, 2009 at 2:29 PM Subject: Re: Hide the virtual keyboard To: Beth emez...@gmail.com Hello, I'm using this code to hide the keyboard on an EditText: public void hideKeyBoard(EditText et) { InputMethodManager imm = (InputMethodManager) getSystemService (Activity.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(et.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } NOTE - this does not work with the TimePicker. I hope it helps. On Sep 2, 1:50 am, salman salman.kha...@gmail.com wrote: Hi , i made a calculator appliation on the android but whenever i click on edit text the default keyboard pop up .I want to disable it by implementing something in code because if i want default keyboard in some other application it should work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] How to set a TextView to look like the home screen icon text
Hi all, On the Android Home screen, the label set in the manifest on the application appears under the icon with a gray background. Does anyone know how to style a TextView or some other View Widget to look like the text showing under an application icon? I would like to know. Thanks and regards, Beth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: How to redraw the list in ExpandableListViewActivity
Hello again! Please allow me to rephrase the question. I have an expandable list view with a static array for the group data and an SQLite database for the child data. It is implemented with the BaseExpandableListAdapter and works great, except, when I edit the database to delete or add children to the list I do not see the changes onscreen. It looks like I can use the registerDataSetObserver method to notifiy the adapter and expandable list of a data change. What I might do in the callback to redraw the list when the data changes is an unknown. Can anyone offer advice on how to use a DataSetObserver? Documentation on this part of the SDK is a bit sparse and expandable list view example code is not a good match. It feels like I have to switch over to a Cursor type adapter. Any insight is most welcome. Pardon the double post to Android Dev. Best regards, Beth On Jul 27, 2:48 pm, Beth Mezias emez...@gmail.com wrote: Hi there, Here is the situation. In a TabbedView, one of three tabs is an ExpandableListViewActivity. My application is using SQL Lite to store the data bound to the ExpandableListView. When I change the SQL Lite data in another activity, I need to refresh the ExpandableListView and show the new data. If I am drawing the tab for the first time after adding new data, the list shows correctly after the tab switch. If I am in the ExpandableListViewActivity when I add new data to the list or edit existing data, then I do not see the change. In this case, when I exit the application and restart, I see the modified data was stored in SQL Lite as expected. Can anyone suggest how I might get the tab to redraw the list? The partially working code looks like this: @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); //stuff deleted if((requestCode == EDITOR) resultCode==RESULT_OK) { tabs.setCurrentTab(1); tabs.getCurrentView().invalidate(); } } The constructor for the list adapter is where I execute the code to populate the groups and children. Do I want to drop and create a new list adapter? That seems like a waste of perfectly good rows. Is it something I should do in the ExpandableListViewActivity, rather than the TabHost? The fact that this is an expandable list is probably irrelevant; I am stuck where an object on the screen that has changed is not redrawn automatically. Your help is deeply appreciated. Best regards, Beth -- Pablo Picassohttp://www.brainyquote.com/quotes/authors/p/pablo_picasso.html - Computers are useless. They can only give you answers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] How to redraw the list in ExpandableListViewActivity
Hi there, Here is the situation. In a TabbedView, one of three tabs is an ExpandableListViewActivity. My application is using SQL Lite to store the data bound to the ExpandableListView. When I change the SQL Lite data in another activity, I need to refresh the ExpandableListView and show the new data. If I am drawing the tab for the first time after adding new data, the list shows correctly after the tab switch. If I am in the ExpandableListViewActivity when I add new data to the list or edit existing data, then I do not see the change. In this case, when I exit the application and restart, I see the modified data was stored in SQL Lite as expected. Can anyone suggest how I might get the tab to redraw the list? The partially working code looks like this: @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); //stuff deleted if((requestCode == EDITOR) resultCode==RESULT_OK) { tabs.setCurrentTab(1); tabs.getCurrentView().invalidate(); } } The constructor for the list adapter is where I execute the code to populate the groups and children. Do I want to drop and create a new list adapter? That seems like a waste of perfectly good rows. Is it something I should do in the ExpandableListViewActivity, rather than the TabHost? The fact that this is an expandable list is probably irrelevant; I am stuck where an object on the screen that has changed is not redrawn automatically. Your help is deeply appreciated. Best regards, Beth -- Pablo Picassohttp://www.brainyquote.com/quotes/authors/p/pablo_picasso.html - Computers are useless. They can only give you answers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: SQL Lite question, can you insert negative numbers (ExpandableListView help needed)
Thanks Mark, content values work great. I am hoping for a few more examples or some direction from the experts today. I want to get sqlite data into an expandable list view (activity). After combing through the user groups and looking at docs and sample code, I find nothing that shows a SimpleCursorTreeAdapter for ELV holding data from sqlite. It looks like this adapter is intended for use with the OTHER cursor, the one holding data returned from a content provider query. Should I be using a different adapter for sqlite data? If so, which one? Thanks in advance for any advice. Best regards, Beth On Jul 10, 4:08 pm, Mark Murphy mmur...@commonsware.com wrote: Beth Mezias wrote: Hello, Can I get an (Android) example for getting signed numbers into a SQL Lite database? I've been trying many silly things that generate syntax errors so I thought I could put out the question. Note that I searched and searched the groups and (surprisingly) found no history. Outside of Android, here's a sqlite3 session: SQLite version 3.6.10 Enter .help for instructions Enter SQL statements terminated with a ; sqlite create table foo (numberreal); sqlite .schema foo CREATE TABLE foo (numberreal); sqlite insert into foo (number) values (-1); sqlite select * from foo; -1.0 sqlite .exit Inside of Android, you should be able to just put anegativenumberinto your ContentValues that you supply to your insert() call with SQLiteDatabase. Can you provide any source code and the syntax errors you are getting? -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android Development Wiki:http://wiki.andmob.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] SQL Lite question, can you insert negative numbers
Hello,Can I get an (Android) example for getting signed numbers into a SQL Lite database? I've been trying many silly things that generate syntax errors so I thought I could put out the question. Note that I searched and searched the groups and (surprisingly) found no history. Thanks and regards, Beth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Star-styling a checkbox in the res/values/styles file
Hello there, In my xml layout, I have set the star style on a CheckBox. style=?android:attr/starStyle It looks great. Now I want to setup a custom style for my CheckBox to use the star style as well as other settings (text size, padding) across activity layouts. How do I get the star attribute into my custom style declaration? Is it a parent attribute? Thanks and regards, Beth -- Jack Benny http://www.brainyquote.com/quotes/authors/j/jack_benny.html - I don't deserve this award, but I have arthritis and I don't deserve that either. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: CheckBox enabled/disabled reality check
Dear Jack, Thank you for the help with my checkbox reality check. When I programmed the button, there was a point in my onResume method where I have to call setEnabled(false). When switching from a button to a CheckBox, I missed that piece of code. It was easy to correct and is now working as expected. Cheers! Beth On Jul 2, 7:45 pm, Jack Ha jack...@t-mobile.com wrote: setEnabled(false) works fine for CheckBox. What version of SDK are you using? Can you post your code here? -- Jack Ha Open Source Development Center ・T・ ・ ・Mobile・ stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 2, 6:18 pm, Beth Mezias emez...@gmail.com wrote: Hello, I want to switch a button out of my UI in favor of a CheckBox object. However, the enable = false parameter in my layout does not seem to have any effect on a CheckBox! My plan is to code the CheckBox to be enabled when certain other objects are valid. With a button object, the grayness and the lack of response to clicks is clear and obvious. When I use a CheckBox and set it to be disabled it has no effect. The object is drawn the same way with true as it is drawn with false in the enabled/setClickable parameter, the callbacks for the touch events work the same, the object continues to respond to onClick and onCheckedChange events when it is supposed to be disabled. This looks like a bug to me. Has anybody got the setEnabled(false) or setClickable(false) methods working on a CheckBox? Any workaround or explanation would be helpful. Thanks and regards, Beth -- Rita Rudner http://www.brainyquote.com/quotes/authors/r/rita_rudner.html - I was a vegetarian until I started leaning toward the sunlight. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
Re: Fwd: [android-beginners] Alarm Manager
I hit this issue hard and found the answers sorting through threads on the non-beginner developer group. Here is what I learned... When setting more than one timer/alarm, the second parameter in the Pending Intent call to getBroadcast is important. Your code looks like this: PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, i, 0); The first zero can be changed up. At this point, the docs define the second parameter this way: requestCode Private request code for the sender (currently not used). However, this request code can be used. If you want to setup a bunch of timers/alarm calls, try using unique request codes for each individual alarm. Track these request codes and set them to be the same when you want to update or cancel an existing alarm. Although the docs say that system is supposed to recognize the intent parameter and take action based on matching the intent and the flags in the last parameter, I found that the request code was used in the match-up. Setting unique request codes for each unique intent solved all my problems. World peace will ensue. Best regards, Beth On Jul 1, 11:09 am, Veroland marius.ven...@gmail.com wrote: To get around this problem look at the flags the PendingIntent takes, I changed mine to PedingIntent.FLAG_CANCEL_CURRENT in the getBroadcast method, it means that if there was a previous PendingIntent it will update it with the new Intent. What I am not sure about yet is being able to create/control more than one of the same PendingIntent's that do the same thing. For multiple reminders for instance like what I am trying. Hope this helps On Jul 1, 7:52 am, varsha acharya varsha.acharya...@gmail.com wrote: Hi, I have a similar problem.. I have to send a sms on alarm to a predefined number. first time it works well... sends the sms on alarm but then if i set the alarm to send a different sms,it sends the previous sms. -- Forwarded message -- From: Veroland marius.ven...@gmail.com Date: Tue, Jun 30, 2009 at 3:53 PM Subject: [android-beginners] Alarm Manager To: Android Beginners android-beginners@googlegroups.com Hi I have 2 problems, I create a timer using AlarmManager and I set an Intent with certain values in the putExtra methods and then create the pendingIntent with this intent and call alamarmManager.set(RTC_Wakeup, time, pendingIntent) 1. The first time I do this everything works fine. The second time I do this and use a intent with different data in the intent when the alarm gets fired in my BroadcastReceiver class the data on the intent is the data of the intent used in the first alarm and NOT the second one. 2. If I call the alarmManager.set 2 times with 2 differents intents and settings only the last alarmManager.set seems to result in my broadcast receiver getting called. Does anyone know how to create multiple alarms? Here is my code I use to create the alarms Intent i = new Intent(getApplicationContext(), ReminderAlarm.class); i.putExtra(ReminderDbAdapter.KEY_ROWID, extras.getLong (ReminderDbAdapter.KEY_ROWID)); i.putExtra(ReminderDbAdapter.KEY_TITLE, extras.getString (ReminderDbAdapter.KEY_TITLE)); i.putExtra(ReminderDbAdapter.KEY_BODY, extras.getString (ReminderDbAdapter.KEY_BODY)); Log.d(Sending, extras.getString(ReminderDbAdapter.KEY_TITLE)); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, i, 0); AlarmManager alarmManager = (AlarmManager) getSystemService (ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, lcal, pendingIntent); -- Regards, Varsha --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] CheckBox enabled/disabled reality check
Hello, I want to switch a button out of my UI in favor of a CheckBox object. However, the enable = false parameter in my layout does not seem to have any effect on a CheckBox! My plan is to code the CheckBox to be enabled when certain other objects are valid. With a button object, the grayness and the lack of response to clicks is clear and obvious. When I use a CheckBox and set it to be disabled it has no effect. The object is drawn the same way with true as it is drawn with false in the enabled/setClickable parameter, the callbacks for the touch events work the same, the object continues to respond to onClick and onCheckedChange events when it is supposed to be disabled. This looks like a bug to me. Has anybody got the setEnabled(false) or setClickable(false) methods working on a CheckBox? Any workaround or explanation would be helpful. Thanks and regards, Beth -- Rita Rudner http://www.brainyquote.com/quotes/authors/r/rita_rudner.html - I was a vegetarian until I started leaning toward the sunlight. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] install Android app from Gmail
Hey there, hi there, ho there...Is there a way to make Android open and install an apk file as an attachment sent in a Gmail message? This is a nice, signed apk file that installs to the phone correctly from Eclipse or the command line. I'm just checking to see if this is working for somebody somewhere. Cheers, Beth -- Princess Margarethttp://www.brainyquote.com/quotes/authors/p/princess_margaret.html - I have as much privacy as a goldfish in a bowl. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Spinner's default selection, select nothing
Hi all, Do you know any way to turn off the default select that happens with Spinner creation? Although I could set a blank entry or put a selection prompt string at the top or bottom of my Spinner display array, I would prefer to skip any default selection and listen only for a selection done directly by the user after creation of my activity. There is an onNothingSelected listener method. Can I use the spinner setSelection method to select nothing? How do you select nothing in a Spinner? Ciao, Beth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Layout component width measure returns zero from onCreate
Romain, So, we understand each other and want the same things :-) Can you please provide an example or pseudocode of the animation framework doing this job? I'm missing the link between the XML tag you suggested and getting the numbers in the code. My animation is spinning an ImageView inside a Linear Layout ViewGroup. The View Group's center X and Y points are parameters used to set the rotation axis. How do I get those numbers? What exactly do the attributes look like in XML? Thanks and regards, Beth On Jun 17, 10:40 pm, Romain Guy romain...@google.com wrote: That's my point, don't try to compute the center position, just let the animation framework do it for you by declaring your animation with the correct values. On Wed, Jun 17, 2009 at 10:17 PM, Beth emez...@gmail.com wrote: Thanks Romain. So, when does the first layout happen? The XML tip looks good but I cannot see how to use it to determine the centerpoint of my screen in the Java code. I thought I could get layout components and their dimensions after setContentView had done its work. My app animates a simple image view hosted in a Layout that uses the fill_parent width. Under that is a text view that doesn't move. The width of the animation is the entire screen and should change when there is a switch from portrait to landscape. How do I find my center point in a dynamic way? My current solution is to set up a landscape layout with a fixed width on the animation view so it is the same as the portrait orientation. What is the right way? On Jun 11, 6:08 pm, Romain Guy romain...@google.com wrote: You cannot do that from onCreate(), you have to wait for the first layout to happen. Besides, you don't need to hard code values in animation since you can use values relative to a view, or its parent. For instance, in XML, you can use 50%p to say 50% of the size of the parent or 40% to say 40% of the size of the animated view. On Thu, Jun 11, 2009 at 4:57 PM, Beth Meziasemez...@gmail.com wrote: Hi there, Can a layout expert offer insight here? I have an animation in a lovely LinearLayout ViewGroup object that I get into Java from the XML using findViewById. It's working great most of the time. However, my first call to the animate function at the end of onCreate measures the width of this ViewGroup to be zero. What am I missing? The same object will return correct width measurements later in the thread of execution. How can I get the correct measure from onCreate? Because of this behavior I have hard-coded values into my application for the Center X which might work nicely on the current HTC devices and then blow up later, or it might look bad in Europe on devices with different screen sizes. I tried a number of things to solve this (force layout, varied animation cache persistence, getMeasuredWidth instead of getWidth, invalidate on the ViewGroup and parent). The layout and the component's measurements should be the same for onCreate as it is in another method in the Activity that responds to touch input from the user. Also note that if I navigate in the app to another activity, change orientation, and then return to the first activity, this scenario also causes the ViewGroup's getWidth command to be zero. That is why I assume the issue is related to onCreate. How do I get the correct measure of a (linearlayout) component when executing from onCreate? Is there something in the window's drawing sequence that I need to workaround? Any tips or suggestions are most welcome. Regards, Beth -- 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 -- 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 Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Layout component width measure returns zero from onCreate
Thanks Romain. So, when does the first layout happen? The XML tip looks good but I cannot see how to use it to determine the centerpoint of my screen in the Java code. I thought I could get layout components and their dimensions after setContentView had done its work. My app animates a simple image view hosted in a Layout that uses the fill_parent width. Under that is a text view that doesn't move. The width of the animation is the entire screen and should change when there is a switch from portrait to landscape. How do I find my center point in a dynamic way? My current solution is to set up a landscape layout with a fixed width on the animation view so it is the same as the portrait orientation. What is the right way? On Jun 11, 6:08 pm, Romain Guy romain...@google.com wrote: You cannot do that from onCreate(), you have to wait for the first layout to happen. Besides, you don't need to hard code values in animation since you can use values relative to a view, or its parent. For instance, in XML, you can use 50%p to say 50% of the size of the parent or 40% to say 40% of the size of the animated view. On Thu, Jun 11, 2009 at 4:57 PM, Beth Meziasemez...@gmail.com wrote: Hi there, Can a layout expert offer insight here? I have an animation in a lovely LinearLayout ViewGroup object that I get into Java from the XML using findViewById. It's working great most of the time. However, my first call to the animate function at the end of onCreate measures the width of this ViewGroup to be zero. What am I missing? The same object will return correct width measurements later in the thread of execution. How can I get the correct measure from onCreate? Because of this behavior I have hard-coded values into my application for the Center X which might work nicely on the current HTC devices and then blow up later, or it might look bad in Europe on devices with different screen sizes. I tried a number of things to solve this (force layout, varied animation cache persistence, getMeasuredWidth instead of getWidth, invalidate on the ViewGroup and parent). The layout and the component's measurements should be the same for onCreate as it is in another method in the Activity that responds to touch input from the user. Also note that if I navigate in the app to another activity, change orientation, and then return to the first activity, this scenario also causes the ViewGroup's getWidth command to be zero. That is why I assume the issue is related to onCreate. How do I get the correct measure of a (linearlayout) component when executing from onCreate? Is there something in the window's drawing sequence that I need to workaround? Any tips or suggestions are most welcome. Regards, Beth -- 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 Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] LED Alerts
Hello good people, Has anybody got an LED notification from the notification manager working? I tried using a custom setup as well as using the DEFAULT_LIGHTS setting but I see nothing in the emulator nor on the device. The log shows the method is executing the code inside my if. Here's some code I tried: if (prefs.getBoolean(ctxt.getString(R.string.led), false)) { //notification.defaults |= Notification.DEFAULT_LIGHTS; // when default did not work I tried these settings notification.ledARGB = 0xff00ff00; notification.ledOnMS = 3000; notification.ledOffMS = 1000; notification.flags |= Notification.FLAG_SHOW_LIGHTS; } If you have it going can you send me a snippet with your working settings? Thanks and regards, Beth -- W. C. Fields http://www.brainyquote.com/quotes/authors/w/w_c_fields.html - If I had to live my life over, I'd live over a saloon. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Layout component width measure returns zero from onCreate
Hi there, Can a layout expert offer insight here? I have an animation in a lovely LinearLayout ViewGroup object that I get into Java from the XML using findViewById. It's working great most of the time. However, my first call to the animate function at the end of onCreate measures the width of this ViewGroup to be zero. What am I missing? The same object will return correct width measurements later in the thread of execution. How can I get the correct measure from onCreate? Because of this behavior I have hard-coded values into my application for the Center X which might work nicely on the current HTC devices and then blow up later, or it might look bad in Europe on devices with different screen sizes. I tried a number of things to solve this (force layout, varied animation cache persistence, getMeasuredWidth instead of getWidth, invalidate on the ViewGroup and parent). The layout and the component's measurements should be the same for onCreate as it is in another method in the Activity that responds to touch input from the user. Also note that if I navigate in the app to another activity, change orientation, and then return to the first activity, this scenario also causes the ViewGroup's getWidth command to be zero. That is why I assume the issue is related to onCreate. How do I get the correct measure of a (linearlayout) component when executing from onCreate? Is there something in the window's drawing sequence that I need to workaround? Any tips or suggestions are most welcome. Regards, Beth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: PreferenceActivity, using the built-ins with style
OK, so I found one answer... In the docs, there is a Note: to refer to a value in the currently applied theme, use ? instead of @ However, I still need helping getting Android to find my style in the layout tag. Anybody? On Jun 1, 12:15 pm, Beth emez...@gmail.com wrote: Do you have any suggestions on how to setup a Theme and/or Style. There is a layout tag available and I would like some help on how to use it. In the demo code on the Dev Guide I found this tag: CheckBoxPreference android:key=child_checkbox_preference android:dependency=parent_checkbox_preference android:layout=?android:attr/preferenceLayoutChild android:title=@string/title_child_preference android:summary=@string/summary_child_preference / (http://developer.android.com/guide/samples/ApiDemos/res/xml/ preferences.html) So I read and searched the groups and then scratched my head. I am not able to extrapolate from the docs and this example how to pull in something from my application's styles.xml file. What is the question mark doing in this tag? If somebody has styled their preferences xml and can get me on track, I would really appreciate the help. Best regards, Beth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] PreferenceActivity, using the built-ins with style
Do you have any suggestions on how to setup a Theme and/or Style. There is a layout tag available and I would like some help on how to use it. In the demo code on the Dev Guide I found this tag: CheckBoxPreference android:key=child_checkbox_preference android:dependency=parent_checkbox_preference android:layout=?android:attr/preferenceLayoutChild android:title=@string/title_child_preference android:summary=@string/summary_child_preference / (http://developer.android.com/guide/samples/ApiDemos/res/xml/ preferences.html) So I read and searched the groups and then scratched my head. I am not able to extrapolate from the docs and this example how to pull in something from my application's styles.xml file. What is the question mark doing in this tag? If somebody has styled their preferences xml and can get me on track, I would really appreciate the help. Best regards, Beth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] PreferenceActivity, can a checkbox and a checkbox preference share?
In a tabbed view, I have two activities where I want to display the same preference. One tab is a preference activity and the other is an ordinary activity. Although this seems straightforward, the screens are not staying in sync. When I modify the checkbox in the ordinary activity tab, I fetch the shared preference with the Checkbox Preference key and edit the value as needed, committing the change to Shared Preferences (code pasted below). The PreferencesActivity should display the shared preference value and does not seem to get the update. The reverse is also true. If I set the preference in the preferences activity, my regular activity should read the update and display the checkbox to match the preference screen. Maybe a view of the activity is cached. Does that explain both cases? How do I ask the system to redraw the tab rather than use a cached view? Here are snippets, for clarity in my description: From the ordinary activity - if(mPreferences.getBoolean(getString(R.string.sch_enabled), false)) { enabled.setChecked(true); other stuff to do } //no else clause included public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { //code to handle enabling through the scheduler checkbox mEditor.putBoolean(getString(R.string.sch_enabled), true); mEditor.commit(); } else { mEditor.putBoolean(getString(R.string.sch_enabled), false); mEditor.commit(); } } //other code not included From preferences.xml: CheckBoxPreference android:key=@string/sch_enabled android:title=@string/enable_cb android:summary=@string/sched_desc android:defaultValue=false android:layout_width=wrap_content android:layout_height=wrap_content / If anybody has dealt with this, I sure would appreciate a tip. Best regards, Beth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] MODIFY_AUDIO_SETTINGS permission
Hello there, I first wrote to the android developer group about this and I got no responses. Has anybody successfully set the MODIFY_AUDIO_SETTINGS use permission? I try to set it and get a permission exception with every run of my application. Thanks for any insight you might have. Regards, Beth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---