[android-beginners] Re: need clarification on resolving intents.
ok, thanks! I see that for action VIEW, the type fields are different. But in general, back to my question What if an intent matches two or more activities - how is it resolved? Since Android is meant to be very loosely coupled, it is likely that activities from different applications may match the same intent. Traditional systems are more tightly coupled. - Anil On Dec 13, 4:03 pm, Mark Murphy wrote: > Anil wrote: > > What if an intent matches two or more activities - how is it resolved? > > > In the example provided on the intents page, > >http://code.google.com/android/reference/android/content/Intent.html > > both Noteslist and NoteEditor have type > > > > > > So in the example, an intent like > > > { action=android.app.action.VIEW data=content:// > > com.google.provider.NotePad/notes } > > > How can we be sure it will map to the the NotesList activity and not > > to the NoteEditor? > > The MIME type is only one of the criteria used for determining if an > Intent matches an IntentFilter. > > Another is the action. In the cited example, NotesList responds to > android.intent.action.GET_CONTENT for > vnd.android.cursor.item/vnd.google.note, while NoteEditor responds to > android.intent.action.VIEW and android.intent.action.EDIT for > vnd.android.cursor.item/vnd.google.note. > > So, if a VIEW intent for a note comes in, it will match NoteEditor > (match on action and type) and not NotesList (match on type but not action). > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 1.9 Available! --~--~-~--~~~---~--~~ 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: I broke my project
ok this is wierd. It broke on me again. All i did was replace one of the images in the drawable folder and now im getting the following error again. Description Resource Path Location Type Unparsed aapt error(s)! Check the console for output. Unknown Generic ADT Problem along with a lot of errors on references to items in the drawable folder. This morning i just deleted the import statement for R but i did it this time and no luck. Any ideas as to what im doing wrong? On Sat, Dec 13, 2008 at 8:33 AM, Josh Dobbs wrote: > I got it! I don't know how this got in my activity but once i removed the > following import everything went back to normal. > > import *android* > .R; > > Thanks! > > > On Sat, Dec 13, 2008 at 8:27 AM, Josh Dobbs wrote: > >> I still cannot resolve this issue. Whenever i try to access something in >> my layout folder like this >> R.Layout.somelayout >> >> None of my layouts are suggested by autocomplete. Its as if my application >> lost reference to the layout folder. >> >> any suggestions would be appreciated >> ** >> ** >> btnGo =(Button) findViewById(*R.id.btnGo*); >> >> >> On Sat, Dec 13, 2008 at 12:43 AM, Josh wrote: >> >>> >>> Im not sure what i did but now every line of code that specifies a >>> resource in the res folder is underlined in red. I tried to manually >>> add the raw directory under res and ithe compiler could not resolve >>> any of the items in the raw folder. i took one of eclipses suggestions >>> to fix the problem(can't remember which option i chose) and then >>> everything broke. Any suggestions? >>> >>> >>> >> > > > --~--~-~--~~~---~--~~ 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: need clarification on resolving intents.
Anil wrote: > What if an intent matches two or more activities - how is it resolved? > > In the example provided on the intents page, > http://code.google.com/android/reference/android/content/Intent.html > both Noteslist and NoteEditor have type > > > > So in the example, an intent like > > { action=android.app.action.VIEW data=content:// > com.google.provider.NotePad/notes } > > How can we be sure it will map to the the NotesList activity and not > to the NoteEditor? The MIME type is only one of the criteria used for determining if an Intent matches an IntentFilter. Another is the action. In the cited example, NotesList responds to android.intent.action.GET_CONTENT for vnd.android.cursor.item/vnd.google.note, while NoteEditor responds to android.intent.action.VIEW and android.intent.action.EDIT for vnd.android.cursor.item/vnd.google.note. So, if a VIEW intent for a note comes in, it will match NoteEditor (match on action and type) and not NotesList (match on type but not action). -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.9 Available! --~--~-~--~~~---~--~~ 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] need clarification on resolving intents.
What if an intent matches two or more activities - how is it resolved? In the example provided on the intents page, http://code.google.com/android/reference/android/content/Intent.html both Noteslist and NoteEditor have type So in the example, an intent like { action=android.app.action.VIEW data=content:// com.google.provider.NotePad/notes } How can we be sure it will map to the the NotesList activity and not to the NoteEditor? thanks, Anil --~--~-~--~~~---~--~~ 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: keeping an application in portrait mode
No, you just have to use a ScrollView in your layout code. On Sat, Dec 13, 2008 at 10:05 PM, Josh Dobbs wrote: > If i dont keep it in portrait mode it doesnt scroll automatically when in > landscape mode. Do i need to hadle scrolling in code? > > On Sat, Dec 13, 2008 at 12:43 PM, Romain Guy wrote: >> >> Hi Josh, >> >> > I noticed while testing on it yeasterday prior to implementing portrait >> > only >> > mode that when i switched to landscape on the phone the whole >> > application >> > would restart. Im hoping that keeping it in portrait only will fix that >> > issue however the app im working on is best suited for portrait only for >> > other reasons as well. >> >> The entire application does not restart, but the activity is indeed >> destroyed and recreated. This happens so that you can use alternative >> resources (using, for instance, res/layout-land or res/drawable-land) >> in your application. It is the correct, default behavior for all apps >> and certainly not an issue. Most system apps (like the Home screen, >> Alarm Clock or Calculator) work that way. Unless your app really is >> not meant for landscape mode (which could be the case for a game for >> instance), I would really advise you to NOT work around this. A cool >> thing about Android is that most apps work in both orientation and >> apps that don't support orientation change can be surprising or even >> frustrating to the user. >> >> -- >> Romain Guy >> www.curious-creature.org >> >> Yahoo Messenger: makef...@yahoo.com >> AIM: JoshDFlexGuy >> MSN: joshdo...@hotmail.com >> Google Talk: joshdo...@gmail.com >> >> >> >> > -- Romain Guy www.curious-creature.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] Re: keeping an application in portrait mode
If i dont keep it in portrait mode it doesnt scroll automatically when in landscape mode. Do i need to hadle scrolling in code? On Sat, Dec 13, 2008 at 12:43 PM, Romain Guy wrote: > > Hi Josh, > > > I noticed while testing on it yeasterday prior to implementing portrait > only > > mode that when i switched to landscape on the phone the whole application > > would restart. Im hoping that keeping it in portrait only will fix that > > issue however the app im working on is best suited for portrait only for > > other reasons as well. > > The entire application does not restart, but the activity is indeed > destroyed and recreated. This happens so that you can use alternative > resources (using, for instance, res/layout-land or res/drawable-land) > in your application. It is the correct, default behavior for all apps > and certainly not an issue. Most system apps (like the Home screen, > Alarm Clock or Calculator) work that way. Unless your app really is > not meant for landscape mode (which could be the case for a game for > instance), I would really advise you to NOT work around this. A cool > thing about Android is that most apps work in both orientation and > apps that don't support orientation change can be surprising or even > frustrating to the user. > > -- > Romain Guy > www.curious-creature.org > > > > -- cell: 714-588-4077 - feel free to send me txt msgs at this number email: joshdo...@gmail.com, joshdo...@hotmail.com Yahoo Messenger: makef...@yahoo.com AIM: JoshDFlexGuy MSN: joshdo...@hotmail.com Google Talk: joshdo...@gmail.com --~--~-~--~~~---~--~~ 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: center the tablelayout
ok. Thanks! I got it to work ith wrap_content. On Sat, Dec 13, 2008 at 12:54 PM, Romain Guy wrote: > > It will work only if your TableLayout has a width set to wrap_content, > otherwise it will occupy the entire screen. > > On Sat, Dec 13, 2008 at 9:51 PM, Josh Dobbs wrote: > > I tried that as well with no luck > > > > On Sat, Dec 13, 2008 at 12:44 PM, Romain Guy > wrote: > >> > >> "center_horizontal" not "centerHorizontal" :) > >> > >> On Sat, Dec 13, 2008 at 9:42 PM, Josh Dobbs > wrote: > >> > I did try that and i get the following error at design time... > >> > Description Resource Path Location Type > >> > ERROR Error: String types not allowed (at 'layout_gravity' with value > >> > 'centerHorizontal'). main.xml line 3 aapt Problem > >> > > >> > > >> > > >> > On Sat, Dec 13, 2008 at 8:37 AM, Mark Murphy > > >> > wrote: > >> >> > >> >> Josh Dobbs wrote: > >> >> > my view is comprised of a tablelayout. How can I set the table > >> >> in > >> >> the > >> >> > center of the screen? by default it looks to be left alligned. > >> >> > >> >> Have you tried adding android:layout_gravity="centerHorizontal" to > your > >> >> TableLayout, to center it in the parent container? > >> >> > >> >> -- > >> >> Mark Murphy (a Commons Guy) > >> >> http://commonsware.com > >> >> > >> >> Android Training on the Ranch! -- Mar 16-20, 2009 > >> >> http://www.bignerdranch.com/schedule.shtml > >> >> >> > >> > > >> > >> > >> > >> -- > >> Romain Guy > >> www.curious-creature.org > >> >> > > > > > > -- > Romain Guy > www.curious-creature.org > > > > -- cell: 714-588-4077 - feel free to send me txt msgs at this number email: joshdo...@gmail.com, joshdo...@hotmail.com Yahoo Messenger: makef...@yahoo.com AIM: JoshDFlexGuy MSN: joshdo...@hotmail.com Google Talk: joshdo...@gmail.com --~--~-~--~~~---~--~~ 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: center the tablelayout
my mistake. i had tried "center_Horizantal". i just changed it to "center_horizontal" and although i don't get an error it doesnt center the tablelayout in the middle of the display. On Sat, Dec 13, 2008 at 12:44 PM, Romain Guy wrote: > > "center_horizontal" not "centerHorizontal" :) > > On Sat, Dec 13, 2008 at 9:42 PM, Josh Dobbs wrote: > > I did try that and i get the following error at design time... > > Description Resource Path Location Type > > ERROR Error: String types not allowed (at 'layout_gravity' with value > > 'centerHorizontal'). main.xml line 3 aapt Problem > > > > > > > > On Sat, Dec 13, 2008 at 8:37 AM, Mark Murphy > > wrote: > >> > >> Josh Dobbs wrote: > >> > my view is comprised of a tablelayout. How can I set the table in > >> the > >> > center of the screen? by default it looks to be left alligned. > >> > >> Have you tried adding android:layout_gravity="centerHorizontal" to your > >> TableLayout, to center it in the parent container? > >> > >> -- > >> Mark Murphy (a Commons Guy) > >> http://commonsware.com > >> > >> Android Training on the Ranch! -- Mar 16-20, 2009 > >> http://www.bignerdranch.com/schedule.shtml > >> >> > > > > > > -- > Romain Guy > www.curious-creature.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] Re: center the tablelayout
It will work only if your TableLayout has a width set to wrap_content, otherwise it will occupy the entire screen. On Sat, Dec 13, 2008 at 9:51 PM, Josh Dobbs wrote: > I tried that as well with no luck > > On Sat, Dec 13, 2008 at 12:44 PM, Romain Guy wrote: >> >> "center_horizontal" not "centerHorizontal" :) >> >> On Sat, Dec 13, 2008 at 9:42 PM, Josh Dobbs wrote: >> > I did try that and i get the following error at design time... >> > Description Resource Path Location Type >> > ERROR Error: String types not allowed (at 'layout_gravity' with value >> > 'centerHorizontal'). main.xml line 3 aapt Problem >> > >> > >> > >> > On Sat, Dec 13, 2008 at 8:37 AM, Mark Murphy >> > wrote: >> >> >> >> Josh Dobbs wrote: >> >> > my view is comprised of a tablelayout. How can I set the table >> >> in >> >> the >> >> > center of the screen? by default it looks to be left alligned. >> >> >> >> Have you tried adding android:layout_gravity="centerHorizontal" to your >> >> TableLayout, to center it in the parent container? >> >> >> >> -- >> >> Mark Murphy (a Commons Guy) >> >> http://commonsware.com >> >> >> >> Android Training on the Ranch! -- Mar 16-20, 2009 >> >> http://www.bignerdranch.com/schedule.shtml >> >> >> >> > >> >> >> >> -- >> Romain Guy >> www.curious-creature.org >> >> > -- Romain Guy www.curious-creature.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] Re: center the tablelayout
I tried that as well with no luck On Sat, Dec 13, 2008 at 12:44 PM, Romain Guy wrote: > > "center_horizontal" not "centerHorizontal" :) > > On Sat, Dec 13, 2008 at 9:42 PM, Josh Dobbs wrote: > > I did try that and i get the following error at design time... > > Description Resource Path Location Type > > ERROR Error: String types not allowed (at 'layout_gravity' with value > > 'centerHorizontal'). main.xml line 3 aapt Problem > > > > > > > > On Sat, Dec 13, 2008 at 8:37 AM, Mark Murphy > > wrote: > >> > >> Josh Dobbs wrote: > >> > my view is comprised of a tablelayout. How can I set the table in > >> the > >> > center of the screen? by default it looks to be left alligned. > >> > >> Have you tried adding android:layout_gravity="centerHorizontal" to your > >> TableLayout, to center it in the parent container? > >> > >> -- > >> Mark Murphy (a Commons Guy) > >> http://commonsware.com > >> > >> Android Training on the Ranch! -- Mar 16-20, 2009 > >> http://www.bignerdranch.com/schedule.shtml > >> >> > > > > > > -- > Romain Guy > www.curious-creature.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] Re: Understanding the basic overridden onCreate function
OK, I see. So basically, by calling super.onCreate (savedInstanceState) one is making sure that any code in the superclass gets run, and then the stuff that is custom to the new class. Thanks. On Dec 13, 1:31 pm, Mark Murphy wrote: > Doughy wrote: > > I'm trying to understand the code for the basic onCreate function that > > is part of every application. > > > @Override > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > } > > > I understand the @Override, and the function declaration. It's the > > second line that I am confused about: > > > super.onCreate(savedInstanceState); > > > First of all, what is super? Secondly, why is it necessary to call > > another onCreate inside of the overridden onCreate function. Can > > someone explain to me what is happening here? > > The pseudo-variable super represents the superclass. By calling > super.onCreate(savedInstanceState), you are "chaining to the > superclass", calling its constructor before performing the guts of yours. > > http://java.sun.com/docs/books/tutorial/java/IandI/super.html > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 1.9 Available! --~--~-~--~~~---~--~~ 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: center the tablelayout
"center_horizontal" not "centerHorizontal" :) On Sat, Dec 13, 2008 at 9:42 PM, Josh Dobbs wrote: > I did try that and i get the following error at design time... > Description Resource Path Location Type > ERROR Error: String types not allowed (at 'layout_gravity' with value > 'centerHorizontal'). main.xml line 3 aapt Problem > > > > On Sat, Dec 13, 2008 at 8:37 AM, Mark Murphy > wrote: >> >> Josh Dobbs wrote: >> > my view is comprised of a tablelayout. How can I set the table in >> the >> > center of the screen? by default it looks to be left alligned. >> >> Have you tried adding android:layout_gravity="centerHorizontal" to your >> TableLayout, to center it in the parent container? >> >> -- >> Mark Murphy (a Commons Guy) >> http://commonsware.com >> >> Android Training on the Ranch! -- Mar 16-20, 2009 >> http://www.bignerdranch.com/schedule.shtml >> >> > -- Romain Guy www.curious-creature.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] Re: keeping an application in portrait mode
Hi Josh, > I noticed while testing on it yeasterday prior to implementing portrait only > mode that when i switched to landscape on the phone the whole application > would restart. Im hoping that keeping it in portrait only will fix that > issue however the app im working on is best suited for portrait only for > other reasons as well. The entire application does not restart, but the activity is indeed destroyed and recreated. This happens so that you can use alternative resources (using, for instance, res/layout-land or res/drawable-land) in your application. It is the correct, default behavior for all apps and certainly not an issue. Most system apps (like the Home screen, Alarm Clock or Calculator) work that way. Unless your app really is not meant for landscape mode (which could be the case for a game for instance), I would really advise you to NOT work around this. A cool thing about Android is that most apps work in both orientation and apps that don't support orientation change can be surprising or even frustrating to the user. -- Romain Guy www.curious-creature.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] Re: center the tablelayout
I did try that and i get the following error at design time... Description Resource Path Location Type ERROR Error: String types not allowed (at 'layout_gravity' with value 'centerHorizontal'). main.xml line 3 aapt Problem On Sat, Dec 13, 2008 at 8:37 AM, Mark Murphy wrote: > > Josh Dobbs wrote: > > my view is comprised of a tablelayout. How can I set the table in > the > > center of the screen? by default it looks to be left alligned. > > Have you tried adding android:layout_gravity="centerHorizontal" to your > TableLayout, to center it in the parent container? > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com > > Android Training on the Ranch! -- Mar 16-20, 2009 > http://www.bignerdranch.com/schedule.shtml > > > > --~--~-~--~~~---~--~~ 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: keeping an application in portrait mode
I am using version 1.0_r1 of the sdk. I don't have a G1 but I my friend does and ill be able to test on it on monday. I noticed while testing on it yeasterday prior to implementing portrait only mode that when i switched to landscape on the phone the whole application would restart. Im hoping that keeping it in portrait only will fix that issue however the app im working on is best suited for portrait only for other reasons as well. On Sat, Dec 13, 2008 at 10:51 AM, Mark Murphy wrote: > > Josh Dobbs wrote: > > When I run the RotationFourDemo in landscape and portrait the app > > orientation changes orientation. > > That is totally wild. I have no explanation for the behavior you're seeing. > > I just now tested RotationFour on a G1, and the behavior matches my > emulator -- the screen stays portrait regardless of the position of the > keyboard. > > So, some questions: > > 1. Do you have a G1? If so, what happens when you run RotationFour on > your G1? > > 2. Which version of the SDK are you on? I'm on 1.0r1, since I am a lazy > bum and have not yet upgraded to 1.0r2 just yet. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 1.9 Available! > > > > --~--~-~--~~~---~--~~ 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: Understanding the basic overridden onCreate function
Doughy wrote: > I'm trying to understand the code for the basic onCreate function that > is part of every application. > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > } > > I understand the @Override, and the function declaration. It's the > second line that I am confused about: > > super.onCreate(savedInstanceState); > > First of all, what is super? Secondly, why is it necessary to call > another onCreate inside of the overridden onCreate function. Can > someone explain to me what is happening here? The pseudo-variable super represents the superclass. By calling super.onCreate(savedInstanceState), you are "chaining to the superclass", calling its constructor before performing the guts of yours. http://java.sun.com/docs/books/tutorial/java/IandI/super.html -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.9 Available! --~--~-~--~~~---~--~~ 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] Understanding the basic overridden onCreate function
I'm trying to understand the code for the basic onCreate function that is part of every application. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } I understand the @Override, and the function declaration. It's the second line that I am confused about: super.onCreate(savedInstanceState); First of all, what is super? Secondly, why is it necessary to call another onCreate inside of the overridden onCreate function. Can someone explain to me what is happening here? 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: keeping an application in portrait mode
Josh Dobbs wrote: > When I run the RotationFourDemo in landscape and portrait the app > orientation changes orientation. That is totally wild. I have no explanation for the behavior you're seeing. I just now tested RotationFour on a G1, and the behavior matches my emulator -- the screen stays portrait regardless of the position of the keyboard. So, some questions: 1. Do you have a G1? If so, what happens when you run RotationFour on your G1? 2. Which version of the SDK are you on? I'm on 1.0r1, since I am a lazy bum and have not yet upgraded to 1.0r2 just yet. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.9 Available! --~--~-~--~~~---~--~~ 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: keeping an application in portrait mode
Josh Dobbs wrote: > It doesnt seem to work. I am able to launch the emulator in landscape > however the app is also displayed in landscape even though the following > line is in AndroidManifest.xml > > android:screenOrientation="portrait" Visit: http://commonsware.com/Android/ Click on the Version 1.9 tab, then download the source code from that tab. Unzip the archive, and build and install the Rotation/RotationFour project. I just tested it, and whether the emulator starts in portrait or landscape, or switches to landscape, the activity stays in portrait mode. If you find this sample is not working for you, let me know. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.9 Available! --~--~-~--~~~---~--~~ 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: keeping an application in portrait mode
It doesnt seem to work. I am able to launch the emulator in landscape however the app is also displayed in landscape even though the following line is in AndroidManifest.xml android:screenOrientation="portrait" On Sat, Dec 13, 2008 at 9:43 AM, Josh Dobbs wrote: > nevermind i figured it out. > > On Sat, Dec 13, 2008 at 9:40 AM, Josh Dobbs wrote: > >> Thanks Mark! >> >> Is there a way to run the emulator in landscape mode to test? >> >> On Sat, Dec 13, 2008 at 8:38 AM, Mark Murphy >> wrote: >> >>> >>> Josh wrote: >>> > How can I ensure that my application is always displayed in portrait >>> > orientation? >>> >>> http://androidguys.com/?p=2891 >>> >>> That post covers the use of android:screenOrientation="portrait" to >>> force an application to stay in portrait orientation regardless of the >>> state of the keyboard. >>> >>> -- >>> Mark Murphy (a Commons Guy) >>> http://commonsware.com >>> >>> Android Training on the Ranch! -- Mar 16-20, 2009 >>> http://www.bignerdranch.com/schedule.shtml >>> >>> >>> >>> >> >> > > --~--~-~--~~~---~--~~ 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: keeping an application in portrait mode
nevermind i figured it out. On Sat, Dec 13, 2008 at 9:40 AM, Josh Dobbs wrote: > Thanks Mark! > > Is there a way to run the emulator in landscape mode to test? > > On Sat, Dec 13, 2008 at 8:38 AM, Mark Murphy wrote: > >> >> Josh wrote: >> > How can I ensure that my application is always displayed in portrait >> > orientation? >> >> http://androidguys.com/?p=2891 >> >> That post covers the use of android:screenOrientation="portrait" to >> force an application to stay in portrait orientation regardless of the >> state of the keyboard. >> >> -- >> Mark Murphy (a Commons Guy) >> http://commonsware.com >> >> Android Training on the Ranch! -- Mar 16-20, 2009 >> http://www.bignerdranch.com/schedule.shtml >> >> >> >> > > -- cell: 714-588-4077 - feel free to send me txt msgs at this number email: joshdo...@gmail.com, joshdo...@hotmail.com Yahoo Messenger: makef...@yahoo.com AIM: JoshDFlexGuy MSN: joshdo...@hotmail.com Google Talk: joshdo...@gmail.com --~--~-~--~~~---~--~~ 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: keeping an application in portrait mode
Thanks Mark! Is there a way to run the emulator in landscape mode to test? On Sat, Dec 13, 2008 at 8:38 AM, Mark Murphy wrote: > > Josh wrote: > > How can I ensure that my application is always displayed in portrait > > orientation? > > http://androidguys.com/?p=2891 > > That post covers the use of android:screenOrientation="portrait" to > force an application to stay in portrait orientation regardless of the > state of the keyboard. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com > > Android Training on the Ranch! -- Mar 16-20, 2009 > http://www.bignerdranch.com/schedule.shtml > > > > --~--~-~--~~~---~--~~ 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: Assistance with understanding LunarLander code
Cheers, that makes sense. I didnt notice the reference to the class in the lunar_layour xml. On Dec 13, 3:58 pm, Mark Murphy wrote: > RichardS wrote: > > Steve, I'm sure the instance is created by > > > setContentView(R.layout.lunar_layout) > > > so the constructor will have been run by the time we do > > > mLunarView = (LunarView) findViewById(R.id.lunar) > > Correct. > > If you look in res/layout/lunar_layout.xml, you will see the declaration: > > android:id="@+id/lunar" > android:layout_width="fill_parent" > android:layout_height="fill_parent"/> > > When the layout is inflated via setContentView(), the constructors for > each widget and container are called. For built-in widgets like > FrameLayout, Android knows they are in the package android.widget; for > custom ones, the full namespace is spelled out in the layout > (com.example.android.lunarlander.LunarView). > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 1.9 Available! --~--~-~--~~~---~--~~ 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: anyone buy an android dev phone?
awesome, thanks! can't wait. 4 days for you to get yours ordered mine monday night dec 8, maybe i will get it today. And APN is part of the fun (when it actually all works out smoothly w/ minimal attempts) :D hope you're enjoying it. And I hope nobody bricked their original G1's reflashing them to dev versions. _henry On Dec 12, 2008, at 10:39 PM, Anodes wrote: > > yep, same experience. i ordered mine sunday (dec 7), standard > shipping...it arrived thurs the 11th. never got a tracking number, > trying to track on brightstarcorp's site yielded nothing, calling them > was pleasant but pointless. except i had entered the wrong suite# for > delivery and they did change it. > > anyway it seems they just aren't setup for tracking/customer svc, but > they do get the phone out to you efficiently. > > then you just have to figure out how to get on your carrier's APN...;) > > > --~--~-~--~~~---~--~~ 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] programming tutorials and free source code
Hello guys , Some times ago I had launched a developers community , formed to provide a place where programmers around the world can meet and exchange ideas. My community address is http://www.intelliproject.net . If you are interested to join us and to share some of your source code and programming knowledge let me know. If someone want to contact me it can reply at sil...@intelliproject.net I'm waiting for your feedback , Kind regards, Silviu --~--~-~--~~~---~--~~ 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: ListActivity with image and text
I want to load images into my list view from the web. I have a URLs of the images/thumbnails which I've retrieved from an rss feed and stored in a table. Is this possible with a list or cursor adapter or is there another way? What is a good way to prepare loading and display of a set of images? In some cases I just want to display images in the list, in other cases I might have an mrss file defining a slide show and I would want to show them in a grid, list or gallery/switcher view. creating the view is no problem. The part I haven't seen any examples of is resolving the url to something usuable like content uri or displayable... I can load a single image into an ImageView by creating an InputStream from the URL, but is there a better way when dealing with many remote images? --~--~-~--~~~---~--~~ 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: Broken link in installation instructions
On Dec 12, 1:06 am, Ratha Grimes wrote: > The link to install the ADT plugin for Eclipse seems to be broken. The > documentation athttp://code.google.com/android/intro/installing.html > provides the following link:https://dl-ssl.google.com/android/eclipse/ > - which gives 404. I can't seem to find any contact information in the > documentation. Where should I report this? At the bottom of the page, there is a link for feedback: http://moderator.appspot.com/#e%253Dagltb2RlcmF0b3JyDgsSBlNlcmllcxifggIM%252Bv%253D0 For what it's worth, I had the same problem but if you drop the 's' from https and just use http://dl-ssl.google.com/android/eclipse/ then the ADT plugin will download and install correctly. John --~--~-~--~~~---~--~~ 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: anyone buy an android dev phone?
yep, same experience. i ordered mine sunday (dec 7), standard shipping...it arrived thurs the 11th. never got a tracking number, trying to track on brightstarcorp's site yielded nothing, calling them was pleasant but pointless. except i had entered the wrong suite# for delivery and they did change it. anyway it seems they just aren't setup for tracking/customer svc, but they do get the phone out to you efficiently. then you just have to figure out how to get on your carrier's APN...;) --~--~-~--~~~---~--~~ 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: Android 1.0 SDK Released
On Dec 11, 6:17 pm, kenb wrote: > Don't Java compilers do these kinds of optimizations, assuming the > fields aren't volatile? The common compilers (e.g. javac) do not. Some post-processors (e.g. ProGuard) might. --~--~-~--~~~---~--~~ 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] what is Europa and Ganymede?
What are the differences between Eclipse 3.3 (Europa) and Eclipse 3.4 (Ganymede) ? I am planning to install Android SDK on vista. Which one of these IDEs is reqeuired? Connect with friends all over the world. Get Yahoo! India Messenger at http://in.messenger.yahoo.com/?wm=n/ --~--~-~--~~~---~--~~ 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: keeping an application in portrait mode
Josh wrote: > How can I ensure that my application is always displayed in portrait > orientation? http://androidguys.com/?p=2891 That post covers the use of android:screenOrientation="portrait" to force an application to stay in portrait orientation regardless of the state of the keyboard. -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training on the Ranch! -- Mar 16-20, 2009 http://www.bignerdranch.com/schedule.shtml --~--~-~--~~~---~--~~ 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: center the tablelayout
Josh Dobbs wrote: > my view is comprised of a tablelayout. How can I set the table in the > center of the screen? by default it looks to be left alligned. Have you tried adding android:layout_gravity="centerHorizontal" to your TableLayout, to center it in the parent container? -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training on the Ranch! -- Mar 16-20, 2009 http://www.bignerdranch.com/schedule.shtml --~--~-~--~~~---~--~~ 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: I broke my project
I got it! I don't know how this got in my activity but once i removed the following import everything went back to normal. import *android*.R; Thanks! On Sat, Dec 13, 2008 at 8:27 AM, Josh Dobbs wrote: > I still cannot resolve this issue. Whenever i try to access something in > my layout folder like this > R.Layout.somelayout > > None of my layouts are suggested by autocomplete. Its as if my application > lost reference to the layout folder. > > any suggestions would be appreciated > ** > ** > btnGo =(Button) findViewById(*R.id.btnGo*); > > > On Sat, Dec 13, 2008 at 12:43 AM, Josh wrote: > >> >> Im not sure what i did but now every line of code that specifies a >> resource in the res folder is underlined in red. I tried to manually >> add the raw directory under res and ithe compiler could not resolve >> any of the items in the raw folder. i took one of eclipses suggestions >> to fix the problem(can't remember which option i chose) and then >> everything broke. Any suggestions? >> >> >> > -- cell: 714-588-4077 - feel free to send me txt msgs at this number email: joshdo...@gmail.com, joshdo...@hotmail.com Yahoo Messenger: makef...@yahoo.com AIM: JoshDFlexGuy MSN: joshdo...@hotmail.com Google Talk: joshdo...@gmail.com --~--~-~--~~~---~--~~ 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: I broke my project
I still cannot resolve this issue. Whenever i try to access something in my layout folder like this R.Layout.somelayout None of my layouts are suggested by autocomplete. Its as if my application lost reference to the layout folder. any suggestions would be appreciated ** ** btnGo =(Button) findViewById(*R.id.btnGo*); On Sat, Dec 13, 2008 at 12:43 AM, Josh wrote: > > Im not sure what i did but now every line of code that specifies a > resource in the res folder is underlined in red. I tried to manually > add the raw directory under res and ithe compiler could not resolve > any of the items in the raw folder. i took one of eclipses suggestions > to fix the problem(can't remember which option i chose) and then > everything broke. Any suggestions? > > > --~--~-~--~~~---~--~~ 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: Assistance with understanding LunarLander code
RichardS wrote: > Steve, I'm sure the instance is created by > > setContentView(R.layout.lunar_layout) > > so the constructor will have been run by the time we do > > mLunarView = (LunarView) findViewById(R.id.lunar) Correct. If you look in res/layout/lunar_layout.xml, you will see the declaration: When the layout is inflated via setContentView(), the constructors for each widget and container are called. For built-in widgets like FrameLayout, Android knows they are in the package android.widget; for custom ones, the full namespace is spelled out in the layout (com.example.android.lunarlander.LunarView). -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.9 Available! --~--~-~--~~~---~--~~ 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: Assistance with understanding LunarLander code
Steve, I'm sure the instance is created by setContentView(R.layout.lunar_layout) so the constructor will have been run by the time we do mLunarView = (LunarView) findViewById(R.id.lunar) richard. On 13 Dec, 14:04, steve_macleod wrote: > Hi Richard, > OK, so it looks like the line: > > mLunarView = (LunarView) findViewById(R.id.lunar) > > creates an instance of the LunarView object, running the constructor. > I didnt think that running the findViewById and casting to a LunarView > would have this effect. > > Thanks for that > > On Dec 12, 5:19 pm, RichardS wrote: > > > > > Steve, > > > This is my understanding of it: > > > The file res/layout/lunar_layout.xml describes the layout of the view. > > The src/R.java file is auto generated: it equates object ids to names. > > > setContentView(R.layout.lunar_layout) > > > 'reads' lunar_layout.xml file and creates and instance of the > > LunarView class and hence the View itself. > > If you look in the XML file it contains an Id string "@+id/lunar": > > this is one of the ids that R.java > > defines a name for - in this case R.id.lunar. > > > mLunarView = (LunarView) findViewById(R.id.lunar) > > > searches all view for the one identified by R.id.lunar ( == "@+id/ > > lunar"). This returns a reference to > > the LunaView instance created above which we store in a member > > variable. > > > The constructor for LunarView created a private LunarThread object so > > doing: > > > mLunarThread = mLunarView.getThread() > > > enables us to retrieve a reference to the thread object. > > > Hope that's correct and helpful! > > > richard. > > > On 12 Dec, 15:49, steve_macleod wrote: > > > > Hi, > > > I have been working through the lunarlander example application, in > > > an > > > attempt to understand the source code. I have run into a couple of > > > problems, and would really appreciate if someone could space a couple > > > of minutes to assist in may understanding. > > > > The onCreate method contains the following: > > > > protected void onCreate(Bundle savedInstanceState) { > > > super.onCreate(savedInstanceState); > > > > // turn off the window's title bar > > > requestWindowFeature(Window.FEATURE_NO_TITLE); > > > > // tell system to use the layout defined in our XML file > > > setContentView(R.layout.lunar_layout); > > > > // get handles to the LunarView from XML, and its LunarThread > > > mLunarView = (LunarView) findViewById(R.id.lunar); > > > mLunarThread = mLunarView.getThread(); > > > > // give the LunarView a handle to the TextView used for > > > messages > > > mLunarView.setTextView((TextView) findViewById(R.id.text)); > > > > if (savedInstanceState == null) { > > > // we were just launched: set up a new game > > > mLunarThread.setState(LunarThread.STATE_READY); > > > Log.w(this.getClass().getName(), "SIS is null"); > > > } else { > > > // we are being restored: resume a previous game > > > mLunarThread.restoreState(savedInstanceState); > > > Log.w(this.getClass().getName(), "SIS is nonnull"); > > > } > > > } > > > > I can see that we are performing the following: > > > Turn off the title bar in the window > > > Set the activity content to the lunar_layour layout file > > > gets a reference to the 'lunar' layout > > > gets a reference to the thread member of the LunarView class > > > give the LunarView a reference to the textview for game > > > messages > > > we then set the state of the lunar thread to STATE_READY, > > > which also > > > outputs a bunch of status messages > > > > The problem is that after executution of setState, the code seems to > > > end. I can see no sections of code that actually creates the > > > LunarView > > > or LunarThread objects, which are required to start the game proper. > > > Obviously I am missing something here, I was wondering if anyone > > > could > > > assist! Thanks lots!- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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: Assistance with understanding LunarLander code
Hi, At what point does the surfaceCreated() method fire? I presume its after we add the callback interface with addCallback? On Dec 12, 5:19 pm, RichardS wrote: > Steve, > > This is my understanding of it: > > The file res/layout/lunar_layout.xml describes the layout of the view. > The src/R.java file is auto generated: it equates object ids to names. > > setContentView(R.layout.lunar_layout) > > 'reads' lunar_layout.xml file and creates and instance of the > LunarView class and hence the View itself. > If you look in the XML file it contains an Id string "@+id/lunar": > this is one of the ids that R.java > defines a name for - in this case R.id.lunar. > > mLunarView = (LunarView) findViewById(R.id.lunar) > > searches all view for the one identified by R.id.lunar ( == "@+id/ > lunar"). This returns a reference to > the LunaView instance created above which we store in a member > variable. > > The constructor for LunarView created a private LunarThread object so > doing: > > mLunarThread = mLunarView.getThread() > > enables us to retrieve a reference to the thread object. > > Hope that's correct and helpful! > > richard. > > On 12 Dec, 15:49, steve_macleod wrote: > > > > > Hi, > > I have been working through the lunarlander example application, in > > an > > attempt to understand the source code. I have run into a couple of > > problems, and would really appreciate if someone could space a couple > > of minutes to assist in may understanding. > > > The onCreate method contains the following: > > > protected void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > > // turn off the window's title bar > > requestWindowFeature(Window.FEATURE_NO_TITLE); > > > // tell system to use the layout defined in our XML file > > setContentView(R.layout.lunar_layout); > > > // get handles to the LunarView from XML, and its LunarThread > > mLunarView = (LunarView) findViewById(R.id.lunar); > > mLunarThread = mLunarView.getThread(); > > > // give the LunarView a handle to the TextView used for > > messages > > mLunarView.setTextView((TextView) findViewById(R.id.text)); > > > if (savedInstanceState == null) { > > // we were just launched: set up a new game > > mLunarThread.setState(LunarThread.STATE_READY); > > Log.w(this.getClass().getName(), "SIS is null"); > > } else { > > // we are being restored: resume a previous game > > mLunarThread.restoreState(savedInstanceState); > > Log.w(this.getClass().getName(), "SIS is nonnull"); > > } > > } > > > I can see that we are performing the following: > > Turn off the title bar in the window > > Set the activity content to the lunar_layour layout file > > gets a reference to the 'lunar' layout > > gets a reference to the thread member of the LunarView class > > give the LunarView a reference to the textview for game > > messages > > we then set the state of the lunar thread to STATE_READY, > > which also > > outputs a bunch of status messages > > > The problem is that after executution of setState, the code seems to > > end. I can see no sections of code that actually creates the > > LunarView > > or LunarThread objects, which are required to start the game proper. > > Obviously I am missing something here, I was wondering if anyone > > could > > assist! Thanks lots!- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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: Assistance with understanding LunarLander code
Hi Richard, OK, so it looks like the line: mLunarView = (LunarView) findViewById(R.id.lunar) creates an instance of the LunarView object, running the constructor. I didnt think that running the findViewById and casting to a LunarView would have this effect. Thanks for that On Dec 12, 5:19 pm, RichardS wrote: > Steve, > > This is my understanding of it: > > The file res/layout/lunar_layout.xml describes the layout of the view. > The src/R.java file is auto generated: it equates object ids to names. > > setContentView(R.layout.lunar_layout) > > 'reads' lunar_layout.xml file and creates and instance of the > LunarView class and hence the View itself. > If you look in the XML file it contains an Id string "@+id/lunar": > this is one of the ids that R.java > defines a name for - in this case R.id.lunar. > > mLunarView = (LunarView) findViewById(R.id.lunar) > > searches all view for the one identified by R.id.lunar ( == "@+id/ > lunar"). This returns a reference to > the LunaView instance created above which we store in a member > variable. > > The constructor for LunarView created a private LunarThread object so > doing: > > mLunarThread = mLunarView.getThread() > > enables us to retrieve a reference to the thread object. > > Hope that's correct and helpful! > > richard. > > On 12 Dec, 15:49, steve_macleod wrote: > > > > > Hi, > > I have been working through the lunarlander example application, in > > an > > attempt to understand the source code. I have run into a couple of > > problems, and would really appreciate if someone could space a couple > > of minutes to assist in may understanding. > > > The onCreate method contains the following: > > > protected void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > > // turn off the window's title bar > > requestWindowFeature(Window.FEATURE_NO_TITLE); > > > // tell system to use the layout defined in our XML file > > setContentView(R.layout.lunar_layout); > > > // get handles to the LunarView from XML, and its LunarThread > > mLunarView = (LunarView) findViewById(R.id.lunar); > > mLunarThread = mLunarView.getThread(); > > > // give the LunarView a handle to the TextView used for > > messages > > mLunarView.setTextView((TextView) findViewById(R.id.text)); > > > if (savedInstanceState == null) { > > // we were just launched: set up a new game > > mLunarThread.setState(LunarThread.STATE_READY); > > Log.w(this.getClass().getName(), "SIS is null"); > > } else { > > // we are being restored: resume a previous game > > mLunarThread.restoreState(savedInstanceState); > > Log.w(this.getClass().getName(), "SIS is nonnull"); > > } > > } > > > I can see that we are performing the following: > > Turn off the title bar in the window > > Set the activity content to the lunar_layour layout file > > gets a reference to the 'lunar' layout > > gets a reference to the thread member of the LunarView class > > give the LunarView a reference to the textview for game > > messages > > we then set the state of the lunar thread to STATE_READY, > > which also > > outputs a bunch of status messages > > > The problem is that after executution of setState, the code seems to > > end. I can see no sections of code that actually creates the > > LunarView > > or LunarThread objects, which are required to start the game proper. > > Obviously I am missing something here, I was wondering if anyone > > could > > assist! Thanks lots!- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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] I broke my project
Im not sure what i did but now every line of code that specifies a resource in the res folder is underlined in red. I tried to manually add the raw directory under res and ithe compiler could not resolve any of the items in the raw folder. i took one of eclipses suggestions to fix the problem(can't remember which option i chose) and then everything broke. Any suggestions? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---