Re: [android-beginners] Re: Library Class Method
REMOVE ME On Thu, Mar 25, 2010 at 2:15 PM, Kitzy kitzyk...@gmail.com wrote: I was looking for something for my program and ran across this other posting which I think really helps answer some of the questions addressed in this thread: http://groups.google.com/group/android-developers/browse_thread/thread/5537ae10e4143240 Sincerely, -Kitzy On Mar 2, 2:03 pm, Mitch besse...@gmail.com wrote: Hi Mark, Don't feel bad about the suggestion. I am a C++ programmer, so yes learning Java makes sense. So far I'm unimpressed with Java in that the language seems highly restrictive, especially in the generics and non existant in the preprocessor area. Yes, I'm aware that Java has other ways to do some of the same things, but often with less than ideal equivalents. Personally if I could code in C++ for Android, I'd be happy and I'm sure a Java programmer would feel the same moving to C ++. After some research it appeared that while you can code in C++, you can't do UI work and there's cost to crossing the C++/Java divide. Hence I started to learn Java as well as Android, Eclipse, and while I was at it, might as well throw in some Linux learning. I'm doing my best to dovetail the learning so they can help reinforce each other. I don't see much on the Java compiler model. I see some stuff about .java creates .class files, there a JVM etc, but no real world application layouts yet. I'm sure I'll find more as I learn, but that is really what this post is about - Learning the build model for combining application code and user written libraries. Should be simple. No? On Mar 2, 9:24 am,Mark Murphymmur...@commonsware.com wrote: Mitch wrote: 1. Create a JAR file and use it in my activity. The JAR file must be a standard Java JAR (whatever that means). I see there are options to choose in the wizard for the JRE and no idea what a good choice is. 2. Try to put the code into a particular folder and reference it in each Android Activity project. This will cause duplication of the code inside each activity? 3. Create a service with the code and ask it to do the calculations and/or UI calls. Not sure if I can call UI inside a service. I think not after some reading. I'd still like other options if anyone is reading this... To be honest, I think the best option is: 4. Spend some time learning Java outside of Android first. You seem to be fighting Java and Eclipse as much as, if not more so, than Android. Android is just strange enough that newcomers to Java often run into problems. Learn how to create standard Java console apps and JARs using Eclipse (or dump Eclipse and use other tools). Then, head back into Android to see how to utilize those techniques there. This is not particular to you -- I make this same recommendation to anyone new to Java. IIRC, you said your background was C++, not Java, which is why I make the recommendation here. -- Mark Murphy(a Commons Guy)http://commonsware.com| http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.3 Available! -- 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 To unsubscribe from this group, send email to android-beginners+ unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 To unsubscribe from this group, send email to android-beginners+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: [android-beginners] Re: Library Class Method
Remove yourself... -- There are only 10 types of people in the world... Those who know binary and those who don't. -- On Thu, Mar 25, 2010 at 5:44 PM, Sreekant Sreedharan ssreedhar...@gmail.com wrote: REMOVE ME On Thu, Mar 25, 2010 at 2:15 PM, Kitzy kitzyk...@gmail.com wrote: I was looking for something for my program and ran across this other posting which I think really helps answer some of the questions addressed in this thread: http://groups.google.com/group/android-developers/browse_thread/thread/5537ae10e4143240 Sincerely, -Kitzy On Mar 2, 2:03 pm, Mitch besse...@gmail.com wrote: Hi Mark, Don't feel bad about the suggestion. I am a C++ programmer, so yes learning Java makes sense. So far I'm unimpressed with Java in that the language seems highly restrictive, especially in the generics and non existant in the preprocessor area. Yes, I'm aware that Java has other ways to do some of the same things, but often with less than ideal equivalents. Personally if I could code in C++ for Android, I'd be happy and I'm sure a Java programmer would feel the same moving to C ++. After some research it appeared that while you can code in C++, you can't do UI work and there's cost to crossing the C++/Java divide. Hence I started to learn Java as well as Android, Eclipse, and while I was at it, might as well throw in some Linux learning. I'm doing my best to dovetail the learning so they can help reinforce each other. I don't see much on the Java compiler model. I see some stuff about .java creates .class files, there a JVM etc, but no real world application layouts yet. I'm sure I'll find more as I learn, but that is really what this post is about - Learning the build model for combining application code and user written libraries. Should be simple. No? On Mar 2, 9:24 am,Mark Murphymmur...@commonsware.com wrote: Mitch wrote: 1. Create a JAR file and use it in my activity. The JAR file must be a standard Java JAR (whatever that means). I see there are options to choose in the wizard for the JRE and no idea what a good choice is. 2. Try to put the code into a particular folder and reference it in each Android Activity project. This will cause duplication of the code inside each activity? 3. Create a service with the code and ask it to do the calculations and/or UI calls. Not sure if I can call UI inside a service. I think not after some reading. I'd still like other options if anyone is reading this... To be honest, I think the best option is: 4. Spend some time learning Java outside of Android first. You seem to be fighting Java and Eclipse as much as, if not more so, than Android. Android is just strange enough that newcomers to Java often run into problems. Learn how to create standard Java console apps and JARs using Eclipse (or dump Eclipse and use other tools). Then, head back into Android to see how to utilize those techniques there. This is not particular to you -- I make this same recommendation to anyone new to Java. IIRC, you said your background was C++, not Java, which is why I make the recommendation here. -- Mark Murphy(a Commons Guy)http://commonsware.com| http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.3 Available! -- 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 To unsubscribe from this group, send email to android-beginners+ unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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 To unsubscribe from this group, send email to android-beginners+ unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject. -- 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
Re: [android-beginners] Re: Library Class Method
you can use some Ant script which could: - copy the Android manifest from the project you are currently building to the top of the source directory - eventually copy project files needed for this particular project also at the top (for example resources, or even a .project where you can filter out un-needed directories) for each new project, you create an Ant script that will copy the manifest at the top. Basically, the issue with Android in Eclipse is that the project has a top-down view from the directory that contains the manifest file. So, the trick is to bring the manifest in the top directory of your source directories. Hope it's clear. Another option, is to include source folders in your project. In that case, the path is hard coded so it is hard/impractical in a team project. Eric On Tue, Mar 2, 2010 at 12:03 PM, Mitch besse...@gmail.com wrote: Hi Mark, Don't feel bad about the suggestion. I am a C++ programmer, so yes learning Java makes sense. So far I'm unimpressed with Java in that the language seems highly restrictive, especially in the generics and non existant in the preprocessor area. Yes, I'm aware that Java has other ways to do some of the same things, but often with less than ideal equivalents. Personally if I could code in C++ for Android, I'd be happy and I'm sure a Java programmer would feel the same moving to C ++. After some research it appeared that while you can code in C++, you can't do UI work and there's cost to crossing the C++/Java divide. Hence I started to learn Java as well as Android, Eclipse, and while I was at it, might as well throw in some Linux learning. I'm doing my best to dovetail the learning so they can help reinforce each other. I don't see much on the Java compiler model. I see some stuff about .java creates .class files, there a JVM etc, but no real world application layouts yet. I'm sure I'll find more as I learn, but that is really what this post is about - Learning the build model for combining application code and user written libraries. Should be simple. No? On Mar 2, 9:24 am, Mark Murphy mmur...@commonsware.com wrote: Mitch wrote: 1. Create a JAR file and use it in my activity. The JAR file must be a standard Java JAR (whatever that means). I see there are options to choose in the wizard for the JRE and no idea what a good choice is. 2. Try to put the code into a particular folder and reference it in each Android Activity project. This will cause duplication of the code inside each activity? 3. Create a service with the code and ask it to do the calculations and/or UI calls. Not sure if I can call UI inside a service. I think not after some reading. I'd still like other options if anyone is reading this... To be honest, I think the best option is: 4. Spend some time learning Java outside of Android first. You seem to be fighting Java and Eclipse as much as, if not more so, than Android. Android is just strange enough that newcomers to Java often run into problems. Learn how to create standard Java console apps and JARs using Eclipse (or dump Eclipse and use other tools). Then, head back into Android to see how to utilize those techniques there. This is not particular to you -- I make this same recommendation to anyone new to Java. IIRC, you said your background was C++, not Java, which is why I make the recommendation here. -- Mark Murphy (a Commons Guy)http://commonsware.com| http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.3 Available! -- 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
Re: [android-beginners] Re: Library Class Method
Kitzy wrote: One last word of advice, if you are creating a standard jar file, then your project (for that code) shouldn't be an Android project but a regular java project. That may be true, but it is perfectly valid to link to the appropriate Android JAR file, to reference classes and methods available in the Android SDK. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- 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
Re: [android-beginners] Re: Library Class Method
Mitch wrote: 1. Create a JAR file and use it in my activity. The JAR file must be a standard Java JAR (whatever that means). I see there are options to choose in the wizard for the JRE and no idea what a good choice is. 2. Try to put the code into a particular folder and reference it in each Android Activity project. This will cause duplication of the code inside each activity? 3. Create a service with the code and ask it to do the calculations and/or UI calls. Not sure if I can call UI inside a service. I think not after some reading. I'd still like other options if anyone is reading this... To be honest, I think the best option is: 4. Spend some time learning Java outside of Android first. You seem to be fighting Java and Eclipse as much as, if not more so, than Android. Android is just strange enough that newcomers to Java often run into problems. Learn how to create standard Java console apps and JARs using Eclipse (or dump Eclipse and use other tools). Then, head back into Android to see how to utilize those techniques there. This is not particular to you -- I make this same recommendation to anyone new to Java. IIRC, you said your background was C++, not Java, which is why I make the recommendation here. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.3 Available! -- 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
Re: [android-beginners] Re: Library Class Method
Mitch wrote: I'm not sure what the options are, which is the basis of my question. I have some code that is general (geometry calculations, Android UI helpers, ... etc). I would like to have multiple applications have access to the same code. I don't need this done at runtime, but I do know that is an option. I would like to start with sharing the source and then move to sharing the compiled code (.class?). I don't know how to set up the project to do this. I guessed by creating a new Java Project and leaving off the Activity, which worked as far as the Eclipse environment was concerned (no warnings, errors, etc), but when it runs, it's ugly and unhelpful as to what's wrong. Even debugging doesn't help. I assume there's a model here for sharing code. Source sharing, compiled code sharing, runtime sharing, ... I simply don't know what the options are for sharing. You need to create a project that creates a JAR file as its target, then use that JAR file in other projects. I am sure there is some magic incantation, probably involving pentagrams drawn in chicken blood, to get Eclipse to do that. :-) Outside of Eclipse, using Ant, it's about a 15 second operation once you have the pattern in hand. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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