[android-beginners] closing multiple activities
I have 3 activities, activityA, activityB activityC. I want to add a menu button NEW SEARCH that will destroy/finish all 3 and start a new activityA. I do not want to finish the activities as they process as I want the user to be able to navigate between the 3 unless the NEW SEARCH menu option is chosen. I guess basically I want to know how to finish activityB C from activityA. Thanks! -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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: closing multiple activities
All activities are developed by me. The NEW SEARCH button will be in all 3 activities. B is launched from A. C is launched from B by the user (based on button clicks). On Jul 2, 2:13 pm, Justin Anderson janderson@gmail.com wrote: Are all three activities developed by you or are B C third-party activities? In which Activity should this button reside? Are B C launched from A or are they launched separately on their own by the user? -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, Jul 2, 2010 at 1:06 PM, Tollas tolla...@gmail.com wrote: I have 3 activities, activityA, activityB activityC. I want to add a menu button NEW SEARCH that will destroy/finish all 3 and start a new activityA. I do not want to finish the activities as they process as I want the user to be able to navigate between the 3 unless the NEW SEARCH menu option is chosen. I guess basically I want to know how to finish activityB C from activityA. Thanks! -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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: Clicking in an AppWidget
You can set any view to be focusable and add an OnClickListener. ScrollView view = (ScrollView)findViewById(R.id.my_scroll_view); view.setFocusable(true); view.setOnClickListener(new OnClickListener(){ public void onClick(View v) { // DoStuff }}); On Jul 2, 2:19 pm, Jake Colman col...@ppllc.com wrote: I know how to write code that would launch an activity when a button is pressed on my appwidget. I would prefer, however, to not dedicate real-estate for a button. Is there a way to launch an activity simply by clicking anywhere in the appwidget? If so, is that a violation of Android standards? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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] Comparing data retrieved from SQL query
I am retrieving data from a SQL query. The data retrieves fine. If I place the data in a TextView field, I see the text. When I try to compare it in an IF statement, however, the statement sees the data as false, even if it should be true. If I set the variable to a good value (not getting data from the SQL query) the IF statement works fine. Example String queryString = c.getString(c.getColumnIndex(table_query)); if (queryString == text){ // do this } I have checked my data. If I query the database for table_query = 'text' I receive results. This is happening for 5 different fields where a comparison is made, each with a different variable and if statement. -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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: Comparing data retrieved from SQL query
Worked great! Thanks! On Jun 18, 11:12 am, Justin Anderson janderson@gmail.com wrote: You cannot use == for comparing strings. You have to use the equals method: if (queryString.equals(text)) //do stuff -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, Jun 18, 2010 at 9:57 AM, Tollas tolla...@gmail.com wrote: I am retrieving data from a SQL query. The data retrieves fine. If I place the data in a TextView field, I see the text. When I try to compare it in an IF statement, however, the statement sees the data as false, even if it should be true. If I set the variable to a good value (not getting data from the SQL query) the IF statement works fine. Example String queryString = c.getString(c.getColumnIndex(table_query)); if (queryString == text){ // do this } I have checked my data. If I query the database for table_query = 'text' I receive results. This is happening for 5 different fields where a comparison is made, each with a different variable and if statement. -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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] Writing a loop to set multiple TextView properties
I have 12 TextView fields named textView1 - textView12. Each TextView will have 2 attributes set: SetText SetBackgroundDrawable which are read from an array (textValue[] and textBackground[]). What I would like to do is write a for (or similar loop) statement to draw them in a loop rather than write each one individually. Something like for(int Z=1; Z=12; Z++){ textViewZ.setText(textValue[Z]); textViewZ.setBackgroundColor(textBackground[Z]); } Unfortunately is looks for the variable textViewZ instead of textView1. -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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: Missing/Hidden/Dissappearing Button problem
I have no idea why, but changing the file name to anything that doesn't begin with the letter a seems to work. I had tried different file names, but all of them began with a. I don't have any idea why this would affect anything. I have other files the same size (both in pixels and in kb) that begin with a that work just fine. I guess since as a user the file name doesn't matter, it's not that big of a deal, but it would be nice to know why! On Jun 5, 5:55 pm, Tollas tolla...@gmail.com wrote: Yes, I have tried that. Same result. I've also tried making it an ImageButton and ImageView with the same result. On Jun 5, 3:48 pm, Gubatron gubat...@gmail.com wrote: Did you try passing the drawable on the Button XML? ... android:background=@drawable/attack_any / or you can only obtain the drawable at runtime? (dynamic drawable) On May 28, 1:43 pm, Tollas tolla...@gmail.com wrote: Button android:id=@+id/attack_ability_button android:layout_width=52dp android:layout_height=52dp android:layout_x=10dp android:layout_y=70dp/ final Button attack_ability_button = (Button)findViewById(R.id.attack_ability_button); attack_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.attack_any)); My problem is that when I use the attack_any drawable to create the button, it just isn't there. If I change to another image of the same size, the button shows up just fine. I've tried replacing the image file, renaming it, resizing it. Always with the same results. I tried using the attack_any drawable for another button and it disappears as well. I've also tried moving the button and changing its size, but the problem persists. I've even tried drawing the background in XML rather than java and it still will not show up. attack_any.png is a 60x60px image 1kb in size. Scroll View -Absolute Layout -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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: Missing/Hidden/Dissappearing Button problem
And this also broke another image. Fixing that one by changing the name broke a 3rd image. Fixing that broke a 4th. Changed all 4 image names and now all work properly. On Jun 6, 8:11 pm, Tollas tolla...@gmail.com wrote: I have no idea why, but changing the file name to anything that doesn't begin with the letter a seems to work. I had tried different file names, but all of them began with a. I don't have any idea why this would affect anything. I have other files the same size (both in pixels and in kb) that begin with a that work just fine. I guess since as a user the file name doesn't matter, it's not that big of a deal, but it would be nice to know why! On Jun 5, 5:55 pm, Tollas tolla...@gmail.com wrote: Yes, I have tried that. Same result. I've also tried making it an ImageButton and ImageView with the same result. On Jun 5, 3:48 pm, Gubatron gubat...@gmail.com wrote: Did you try passing the drawable on the Button XML? ... android:background=@drawable/attack_any / or you can only obtain the drawable at runtime? (dynamic drawable) On May 28, 1:43 pm, Tollas tolla...@gmail.com wrote: Button android:id=@+id/attack_ability_button android:layout_width=52dp android:layout_height=52dp android:layout_x=10dp android:layout_y=70dp/ final Button attack_ability_button = (Button)findViewById(R.id.attack_ability_button); attack_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.attack_any)); My problem is that when I use the attack_any drawable to create the button, it just isn't there. If I change to another image of the same size, the button shows up just fine. I've tried replacing the image file, renaming it, resizing it. Always with the same results. I tried using the attack_any drawable for another button and it disappears as well. I've also tried moving the button and changing its size, but the problem persists. I've even tried drawing the background in XML rather than java and it still will not show up. attack_any.png is a 60x60px image 1kb in size. Scroll View -Absolute Layout -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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: Missing/Hidden/Dissappearing Button problem
Ok. Tried switching to RelativeLayout and I'm still having the same problem. On May 30, 2:31 am, Justin Anderson janderson@gmail.com wrote: Why are you using AbsoluteLayout? -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Sat, May 29, 2010 at 8:14 PM, Tollas tolla...@gmail.com wrote: No. I have a single AbosoluteLayout nested in a single ScrollView. ScrollView android:id=@+id/scrollview android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical xmlns:android=http://schemas.android.com/apk/res/android; AbsoluteLayout android:id=@+id/mainlayout android:layout_width=fill_parent android:layout_height=fill_parent On May 29, 8:14 am, niko20 nikolatesl...@yahoo.com wrote: Hi, Are you using a relative layout at all? Relative layout has some bugs when you use forward references, and basically will disappear. -niko On May 28, 3:07 pm, Tollas tolla...@gmail.com wrote: Yes. (getResources().getDrawable(R.drawable.attack_any) != null) returns true. On May 28, 1:41 pm, Justin Anderson janderson@gmail.com wrote: Have you verified that getResources().getDrawable(R.drawable.attack_any) is not returning a null value? -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, May 28, 2010 at 12:22 PM, Tollas tolla...@gmail.com wrote: The button is there. I can click on it and it behaves normally. I have a Spinner onItemSelected that updates the button's image. When I activate that set to any value but the default, the button updates properly and the new image is displayed. On May 28, 12:57 pm, Justin Anderson janderson@gmail.com wrote: Is it there and you just can't see it? Or is it not there period? What happens if you click where the button is supposed to be at? One other thing I noticed... You are using AbsoluteLayout. That has been deprecated and it will not play nice with phones that have different screen sizes. -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, May 28, 2010 at 11:43 AM, Tollas tolla...@gmail.com wrote: Button android:id=@+id/attack_ability_button android:layout_width=52dp android:layout_height=52dp android:layout_x=10dp android:layout_y=70dp/ final Button attack_ability_button = (Button)findViewById(R.id.attack_ability_button); attack_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.attack_any)); My problem is that when I use the attack_any drawable to create the button, it just isn't there. If I change to another image of the same size, the button shows up just fine. I've tried replacing the image file, renaming it, resizing it. Always with the same results. I tried using the attack_any drawable for another button and it disappears as well. I've also tried moving the button and changing its size, but the problem persists. I've even tried drawing the background in XML rather than java and it still will not show up. attack_any.png is a 60x60px image 1kb in size. Scroll View -Absolute Layout -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@googlegroups.com android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@googlegroups.com android-beginners%252bunsubscr...@googlegroups.comandroid-beginners%25252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question
[android-beginners] Re: Missing/Hidden/Dissappearing Button problem
I can't remember why. I tried changing the button size to 60x60 with the same results. On Jun 5, 4:06 am, Justin Anderson janderson@gmail.com wrote: Man... I am stumped here. I have no idea what the problem could be. Just out of curiosity (I can't imagine this would be the cause of the problem), is there a reason that your image is 8 pixels larger than the size of your button? -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Sat, Jun 5, 2010 at 12:50 AM, Tollas tolla...@gmail.com wrote: Ok. Tried switching to RelativeLayout and I'm still having the same problem. On May 30, 2:31 am, Justin Anderson janderson@gmail.com wrote: Why are you using AbsoluteLayout? -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Sat, May 29, 2010 at 8:14 PM, Tollas tolla...@gmail.com wrote: No. I have a single AbosoluteLayout nested in a single ScrollView. ScrollView android:id=@+id/scrollview android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical xmlns:android=http://schemas.android.com/apk/res/android; AbsoluteLayout android:id=@+id/mainlayout android:layout_width=fill_parent android:layout_height=fill_parent On May 29, 8:14 am, niko20 nikolatesl...@yahoo.com wrote: Hi, Are you using a relative layout at all? Relative layout has some bugs when you use forward references, and basically will disappear. -niko On May 28, 3:07 pm, Tollas tolla...@gmail.com wrote: Yes. (getResources().getDrawable(R.drawable.attack_any) != null) returns true. On May 28, 1:41 pm, Justin Anderson janderson@gmail.com wrote: Have you verified that getResources().getDrawable(R.drawable.attack_any) is not returning a null value? -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, May 28, 2010 at 12:22 PM, Tollas tolla...@gmail.com wrote: The button is there. I can click on it and it behaves normally. I have a Spinner onItemSelected that updates the button's image. When I activate that set to any value but the default, the button updates properly and the new image is displayed. On May 28, 12:57 pm, Justin Anderson janderson@gmail.com wrote: Is it there and you just can't see it? Or is it not there period? What happens if you click where the button is supposed to be at? One other thing I noticed... You are using AbsoluteLayout. That has been deprecated and it will not play nice with phones that have different screen sizes. -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, May 28, 2010 at 11:43 AM, Tollas tolla...@gmail.com wrote: Button android:id=@+id/attack_ability_button android:layout_width=52dp android:layout_height=52dp android:layout_x=10dp android:layout_y=70dp/ final Button attack_ability_button = (Button)findViewById(R.id.attack_ability_button); attack_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.attack_any)); My problem is that when I use the attack_any drawable to create the button, it just isn't there. If I change to another image of the same size, the button shows up just fine. I've tried replacing the image file, renaming it, resizing it. Always with the same results. I tried using the attack_any drawable for another button and it disappears as well. I've also tried moving the button and changing its size, but the problem persists. I've even tried drawing the background in XML rather than java and it still will not show up. attack_any.png is a 60x60px image 1kb in size. Scroll View -Absolute Layout -- You received this message because you are subscribed to the Google Groups
[android-beginners] Re: Missing/Hidden/Dissappearing Button problem
Yes, I have tried that. Same result. I've also tried making it an ImageButton and ImageView with the same result. On Jun 5, 3:48 pm, Gubatron gubat...@gmail.com wrote: Did you try passing the drawable on the Button XML? ... android:background=@drawable/attack_any / or you can only obtain the drawable at runtime? (dynamic drawable) On May 28, 1:43 pm, Tollas tolla...@gmail.com wrote: Button android:id=@+id/attack_ability_button android:layout_width=52dp android:layout_height=52dp android:layout_x=10dp android:layout_y=70dp/ final Button attack_ability_button = (Button)findViewById(R.id.attack_ability_button); attack_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.attack_any)); My problem is that when I use the attack_any drawable to create the button, it just isn't there. If I change to another image of the same size, the button shows up just fine. I've tried replacing the image file, renaming it, resizing it. Always with the same results. I tried using the attack_any drawable for another button and it disappears as well. I've also tried moving the button and changing its size, but the problem persists. I've even tried drawing the background in XML rather than java and it still will not show up. attack_any.png is a 60x60px image 1kb in size. Scroll View -Absolute Layout -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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: Missing/Hidden/Dissappearing Button problem
No. I have a single AbosoluteLayout nested in a single ScrollView. ScrollView android:id=@+id/scrollview android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical xmlns:android=http://schemas.android.com/apk/res/android; AbsoluteLayout android:id=@+id/mainlayout android:layout_width=fill_parent android:layout_height=fill_parent On May 29, 8:14 am, niko20 nikolatesl...@yahoo.com wrote: Hi, Are you using a relative layout at all? Relative layout has some bugs when you use forward references, and basically will disappear. -niko On May 28, 3:07 pm, Tollas tolla...@gmail.com wrote: Yes. (getResources().getDrawable(R.drawable.attack_any) != null) returns true. On May 28, 1:41 pm, Justin Anderson janderson@gmail.com wrote: Have you verified that getResources().getDrawable(R.drawable.attack_any) is not returning a null value? -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, May 28, 2010 at 12:22 PM, Tollas tolla...@gmail.com wrote: The button is there. I can click on it and it behaves normally. I have a Spinner onItemSelected that updates the button's image. When I activate that set to any value but the default, the button updates properly and the new image is displayed. On May 28, 12:57 pm, Justin Anderson janderson@gmail.com wrote: Is it there and you just can't see it? Or is it not there period? What happens if you click where the button is supposed to be at? One other thing I noticed... You are using AbsoluteLayout. That has been deprecated and it will not play nice with phones that have different screen sizes. -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, May 28, 2010 at 11:43 AM, Tollas tolla...@gmail.com wrote: Button android:id=@+id/attack_ability_button android:layout_width=52dp android:layout_height=52dp android:layout_x=10dp android:layout_y=70dp/ final Button attack_ability_button = (Button)findViewById(R.id.attack_ability_button); attack_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.attack_any)); My problem is that when I use the attack_any drawable to create the button, it just isn't there. If I change to another image of the same size, the button shows up just fine. I've tried replacing the image file, renaming it, resizing it. Always with the same results. I tried using the attack_any drawable for another button and it disappears as well. I've also tried moving the button and changing its size, but the problem persists. I've even tried drawing the background in XML rather than java and it still will not show up. attack_any.png is a 60x60px image 1kb in size. Scroll View -Absolute Layout -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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] Missing/Hidden/Dissappearing Button problem
Button android:id=@+id/attack_ability_button android:layout_width=52dp android:layout_height=52dp android:layout_x=10dp android:layout_y=70dp/ final Button attack_ability_button = (Button)findViewById(R.id.attack_ability_button); attack_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.attack_any)); My problem is that when I use the attack_any drawable to create the button, it just isn't there. If I change to another image of the same size, the button shows up just fine. I've tried replacing the image file, renaming it, resizing it. Always with the same results. I tried using the attack_any drawable for another button and it disappears as well. I've also tried moving the button and changing its size, but the problem persists. I've even tried drawing the background in XML rather than java and it still will not show up. attack_any.png is a 60x60px image 1kb in size. Scroll View -Absolute Layout -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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: Missing/Hidden/Dissappearing Button problem
The button is there. I can click on it and it behaves normally. I have a Spinner onItemSelected that updates the button's image. When I activate that set to any value but the default, the button updates properly and the new image is displayed. On May 28, 12:57 pm, Justin Anderson janderson@gmail.com wrote: Is it there and you just can't see it? Or is it not there period? What happens if you click where the button is supposed to be at? One other thing I noticed... You are using AbsoluteLayout. That has been deprecated and it will not play nice with phones that have different screen sizes. -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, May 28, 2010 at 11:43 AM, Tollas tolla...@gmail.com wrote: Button android:id=@+id/attack_ability_button android:layout_width=52dp android:layout_height=52dp android:layout_x=10dp android:layout_y=70dp/ final Button attack_ability_button = (Button)findViewById(R.id.attack_ability_button); attack_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.attack_any)); My problem is that when I use the attack_any drawable to create the button, it just isn't there. If I change to another image of the same size, the button shows up just fine. I've tried replacing the image file, renaming it, resizing it. Always with the same results. I tried using the attack_any drawable for another button and it disappears as well. I've also tried moving the button and changing its size, but the problem persists. I've even tried drawing the background in XML rather than java and it still will not show up. attack_any.png is a 60x60px image 1kb in size. Scroll View -Absolute Layout -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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: Missing/Hidden/Dissappearing Button problem
Yes. (getResources().getDrawable(R.drawable.attack_any) != null) returns true. On May 28, 1:41 pm, Justin Anderson janderson@gmail.com wrote: Have you verified that getResources().getDrawable(R.drawable.attack_any) is not returning a null value? -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, May 28, 2010 at 12:22 PM, Tollas tolla...@gmail.com wrote: The button is there. I can click on it and it behaves normally. I have a Spinner onItemSelected that updates the button's image. When I activate that set to any value but the default, the button updates properly and the new image is displayed. On May 28, 12:57 pm, Justin Anderson janderson@gmail.com wrote: Is it there and you just can't see it? Or is it not there period? What happens if you click where the button is supposed to be at? One other thing I noticed... You are using AbsoluteLayout. That has been deprecated and it will not play nice with phones that have different screen sizes. -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Fri, May 28, 2010 at 11:43 AM, Tollas tolla...@gmail.com wrote: Button android:id=@+id/attack_ability_button android:layout_width=52dp android:layout_height=52dp android:layout_x=10dp android:layout_y=70dp/ final Button attack_ability_button = (Button)findViewById(R.id.attack_ability_button); attack_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.attack_any)); My problem is that when I use the attack_any drawable to create the button, it just isn't there. If I change to another image of the same size, the button shows up just fine. I've tried replacing the image file, renaming it, resizing it. Always with the same results. I tried using the attack_any drawable for another button and it disappears as well. I've also tried moving the button and changing its size, but the problem persists. I've even tried drawing the background in XML rather than java and it still will not show up. attack_any.png is a 60x60px image 1kb in size. Scroll View -Absolute Layout -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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: Changing button image based on user input.
I know I'm heading in the right direction, I just can't seem to make it work! MAIN.JAVA public static final int SPEED_ABILITY = 1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageButton speed_ability_button = (ImageButton)findViewById(R.id.speed_ability_button); speed_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.speed_any)); speed_ability_button.setOnClickListener(new View.OnClickListener(){ public void onClick(View view){ Intent get_speed_ability = new Intent(view.getContext(), Speed_ability.class); startActivityForResult (get_speed_ability, SPEED_ABILITY); } }); protected void onActivityResult(int requestCode, int resultCode, Intent data){ switch(requestCode) { case SPEED_ABILITY: String speeda = data.getStringExtra(speeda_choice); if (resultCode == RESULT_OK speeda == any){ ImageButton speed_ability_button = (ImageButton)findViewById(R.id.speed_ability_button); speed_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.speed_any)); } if (resultCode == RESULT_OK speeda == boot){ ImageButton speed_ability_button = (ImageButton)findViewById(R.id.speed_ability_button); speed_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.speed_boot)); } } } } Speed_ability.JAVA public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.speed_ability); ImageButton speed_any = (ImageButton) findViewById(R.id.speed_any_selection); speed_any.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent set_as_any_speed = new Intent(); String speeda_choice = any; set_as_any_speed.putExtra(speeda_choice, speeda_choice); setResult(RESULT_OK, set_as_any_speed); finish(); } }); ImageButton speed_boot = (ImageButton) findViewById(R.id.speed_boot_selection); speed_boot.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent set_as_boot_speed = new Intent(); String speeda_choice = boot; set_as_boot_speed.putExtra(speeda_choice, speeda_choice); setResult(RESULT_OK, set_as_boot_speed); finish(); } }); } } On May 10, 9:25 am, TreKing treking...@gmail.com wrote: On Mon, May 10, 2010 at 8:49 AM, Tollas tolla...@gmail.com wrote: I've searched high and low for a way to do this, but have come up with nothing. Search for startActivityForResut(), setResult() and onActivityResult(). - TreKing - Chicago transit tracking app for Android-powered deviceshttp://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow athttp://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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] Changing button image based on user input.
I've searched high and low for a way to do this, but have come up with nothing. I want to have a button on my main screen (button1). When button1 is pressed, it takes me to a 2nd screen with multiple buttons. (this part is done). When a user presses a button on that screen, it goes back to the main screen and changes that button to the same image as the button they pressed. Example Screen 1 -Button1 (set as image_1 - dynamic) Screen 2 -Button2 (set as image_1 - static) -Button3 (set as image_2 - static) If Button3 is pressed, Button1 will now be set as image_2. -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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