Android Notepad tutorial: Still "State of the art"? - android

I am going to make my first app for android (no fear it's just a school project and won't be another useless app in the market :>).
So, before starting this task I did some tutorials, one of these (and which I thought would be very useful, because of the sqlite part) was the Notepad Tutorial. While working through it I saw it was originally designed for Android 1.8 or something (certainly it still worked on my android 4.1).
What I'm really wondering now is:
Is this code still "state of the art" in android programming (especially sqlite, but also the rest :) or is it "deprecated"? If so, can you point me to something newer and better?
Thank you.

SQLite is definitely still the database available by default on every Android device. Also, the basics covered in this tutorial still apply to any Android version. Of course, every new version of the OS also provides new possibilities as to which controls you can use or other new APIs, but for very simple applications, this tutorial is still valid.

I skimmed the article; most of its content seem to be valid for Android 4.x.
Although I don't think the tutorial mention fragments anywhere : they were introduced with Android 3.0.
I think that an important exercise after this tutorial is to read the fragment documentation; have a look at some samples (like the gallery app) and rewrite the notepad in order to use fragments.
You will have to use the Support Library in order to use fragments if the minimum version of Android supported by your app is inferior to Android 3.0 but I think it is also an interesting exercise.
A little tip : many beginners (and experienced devs also :) ) mistakes come from adding a new element in an app but forgetting to declare it in the manifest.xml.

Related

Is "AndroidAnnotaions" reliable?

Is "AndroidAnnotations" reliable? I've searched it but couldn't find many articles on it(reviews or tutorials).
I've been considering using this library in my project which already has quite lots of users. Before adopting it, I need a good reputation on it. So my concerns mainly are,
Are there famous products using this library?
Can I say it's stable enough to adopt it for my big project?
Will it be maintained well? (bug fixes, etc)
Thanks in advance.
I am the lead developer of AndroidAnnotations. Let's answer your questions:
Can you rely on AndroidAnnotations?
I think so. AndroidAnnotations is a compile time framework which generates code. The generated code is readable java code, which means that if you need to understand what happens, you can. No magic happening at runtime => you are in control.
We try to maintain a list of external articles / tutorials here.
Are there famous products using this library?
Let's be honest: I don't know. Matthias Kaeppler from Qype talked about AndroidAnnotations at DroidCon London 2011. The frontpage lists the applications that we know for sure are using it. I know there are way more people using it because they ask for enhancements and report bugs, but they usually don't let us know when they publish an app. And of course, the idea of "writing clean and maintainable Android code" is not yet very common in the Android community.
Can I say it's stable enough to adopt it for my big project?
We are using it in our own apps, and we find it perfectly stable. So I would answer yes, but I think you should just try it :-) . Download the 2.2 RC2 (will be released stable soon), follow the instructions and see for yourself. You can do progressive enhancement, and start enhancing only one or two activities. See how it fits you, and let us know if anything goes wrong. And if you do release an app with AndroidAnnotations on the Android market, please let us know, we'll update the front page.
Will AndroidAnnotations be maintained?
Yes, it will. Although it started as a personal project, AndroidAnnotations is now sponsored by a company, eBusiness Information. This company employs people (including me) to work on AndroidAnnotations, with the aim of making it a major Open Source Android framework.
As you can see here and there, we are adding a lot of new features for the 2.2 release. And you won't find a lot of open Defects in the issues, because we concentrate on fixing any bug before adding new features.

How to choose objects for your android application?

I am new to Android but not to programming. I have taken C++ in school and we have been taught how to create objects, but not how to build robust programs using multiple objects. So you can see that using java to build Android apps leaves me with questions.....
thinking like an object oriented programmer, do i just shop through a list of classes until i find ones that i think would suite my app
is there a definite method of choosing the best classes for your project
do i find an app similar to the one i am trying to create and try to find what classes they used
any thoughts appreciated!!!!!!
The best way to learn (for me, at least) is by making small incremental changes to an example so I can how all the various elements of it work.
Download the examples (listed here) - but accessible from your AVD and SDK manager tool from within Eclipse (Window -> Android SDK and AVD Manager).
Start by modifying those examples. They are the best possible examples you can get for much of what you will want to do.
I'd recommend you start with Tutorials and also read about Application Fundamentals - they should get you started. Also browsing Classes is useful if you like wading through lots of technical docs (I do). Those three links are definitely worth looking at.
Well first when building Android applications you need to:
Figure out what your application will be, and how it would work.
Next you would need to find out how you will implement the android classes.
i would recommend first reading a book on Android development. One that really helped me and made me an advance developer was CommonsWare
You should really get these books. When you finish you will be well on your way.

How to manipulate Android classes

New to Android. Trying to find docs that show what Android classes expect to elicit changes. For example, to make a keyboard always visible, I could find some info searching Google, but not directly in the docs of the SDK. Is there a source for more comprehensive docs on how Android works not just from the individual class level, but how it boots up and what to do to make small tweaks for an app.
I don't know if this would be what you're looking for, but here's some information on packages and classes
http://developer.android.com/reference/android/inputmethodservice/package-summary.html
I've been teaching myself Android for about a month now and the best reference I've found so far is the Android Developer site, especially under the References and Resources pages.
Hopefully that helps a little bit. Sorry I couldn't be of more help.

Android App - XML or java

I am currently starting to create an app for a small charity company. But I'm not entirely sure how to properly learn how to code for the Android OS. I have searched online for tutorials, but most stop at the same stage and only show you how to launch the "helloWorld" app.
My question is this:
1) Will using solely XML be sufficient to code an app? Does it require working in partnership with Java?
2) Does anyone know of any books, recommended books of course, that break everything down for you step-by-step?
Android Developer site very good to give you all ideas. Start from Hello, World
1.) Not at all. XML is ONLY used for the layouts.
2.) There are a few books out there that I'm sure someone will come along and recommend, but I've found the tutorials here to be the best start.
In your case, I'd look at AppInventor which allows you to create small Apps without coding (at least that's what it says, haven't used it yet myself)
1) No, you can use XML for interface, but you can't write an Android app in XML :) You are not required to work with Java, but Android language is based on Java, so knowing Java is an advantage while learning to code.
2) Did you installed Eclipse and the plugin for Android?
The Android Training is pretty useful, and I've learnt a lot from the tutorials and the sample code provided there. (The Notepad app is way more complex than the Hello World tutorial ;)!).
Also, take a look at the answers on that question: How can I learn Android?

how best to cope with different versions of Android?

I have an app that works fine in Android 1.x but not in Android 2.x
i need to do things different based on the version of Android the app is running on (querying contacts).
is it possible to have two separate methods within the one app that i can choose based on the version of Android the app is running on?
many thanks
Ed
Use reflection and class loaders. See this post on the Android developers blog: http://feedproxy.google.com/~r/blogspot/hsDu/~3/9WEwRp2NWlY/how-to-have-your-cupcake-and-eat-it-too.html
Edit:
Thanks to CommonsWare for pointing out a sample project which uses both the new and old contacts content providers and conditional class loading: http://github.com/commonsguy/cw-advandroid/tree/master/Contacts/Spinners/
you can get the sdk version with BUILD.VERSION, check
How to retrieve the android sdk version?
however, i am wondering what function is runnable on 1.x and not available on 2.x.
did you use any of the internal classes?
I really suggest that you fix the function issue, rather than doing different things with different versions, if it can be avoid.
You can read out the OS version of the device.You can have different methods in your app depending on the device OS version, but you can only compile against one SDK version. Therefore, you need to choose the minimum, which at the moment currently is 1.6 (I think 1.5 is rarely used anymore)
see:
http://developer.android.com/reference/android/os/Build.VERSION.html
developing for multiple screens / devices:
http://developer.android.com/guide/practices/screens_support.html
The Business Card example that comes with the latest Android SDK was a big, big help. I recommend it to those that like me might not be a professional full-time developer. Thanks everyone for your kind input.

Categories

Resources