I seem to stuck at creating a complete application even after reading a few books on Android.
That wasn't the case when I first did PHP 10 years ago, after reading 2 or 3 books, I managed to grasp the idea behind, start making database interactive scripts with very minimal referencing to the books.
Android seems like a giant beast which is hard to handle. If I were to make an app with map function, I can't write more than 5 lines without reading the books. When I wanted to create another app with telephony function, I would "copy" the codes from books and modified from there. After learning for 2-3 months, I still couldn't remember the programmatical ways how to handle ListActivity. There seem to be a few thousands of classes that I need to remember. And till now I still not knowing the reason to use "this" as context, I just figure to use it when context was needed, if not getApplicationContext() would be a good replacement. The thing is, 99% when context was used, it must be a call of "this" from current activity, why couldn't Android framework handle the context internally and do developers a huge favour and let the 1% call it with extra arguments when it's really needed?
When I did PHP, I spent 25% of the time on script planning and overflow. 70% on writing the code. 5% on referring the syntax.
Now as I do Android development, 5% time needed on planning (because most of the apps look very straightforward with minimal purposes), 50% time copying the codes (from books or online sources), 10% time modifying the codes, 35% troubleshooting where the code went wrong. My job is basically one thing - blending all 'tiny recipes' into a working condition.
Was it just me, or most developers stumbled into the same problem?
Well, coming from a C# background myself, I quickly picked up the syntax very quickly. I did not read any books, I used the google to start learning. I would say it took me 3 months to grasp most the concepts, but still need to check how its done online for almost 6 months I would say. But after that I was able to write just about most of my apps without using google for help, except for new things that I have not done before. But it is now quite easy for me to remember. One of the trickiest things for me to remember was Adapter concept, but I got that down now.
And to answer your context question:
A Context is a handle to the system. It provides services like resolving resources, obtaining access to databases and preferences and so on. An android app has activities. It's like a handle to the environment your application is currently running in. The activity object inherits the Context object, that is why you can use this from an activity level.
This is a very good reply. Almost an answer I -wanted- to hear.
Since I've almost zero OOP knowledge in the past (i didn't use OO in PHP, though I could understand what's written by others, hence "almost"), plus my growing age which leads to slower learning pace and lousier brain memorizing power, I would give myself at least twice or triple the time mentioned to master the exact same level achieved by you.
That is, 9 months to grasp the concepts, 18 months before I can start writing apps fluently without referring to tutorial samples.
Which means I'm not even 1/6 of there yet. I'll keep reading & pumping more knowledge into my brain deposits, follow more sample codes, maybe the main problem is that I'm lack of practice.
I am glad it helped you. In my experience, the best and quickest way to learn is to have a project and do it. Google how to do each section as you go along. The more projects you do, the quicker you will learn it.
I can't add to the discussion regarding Android development, but I agree with NightStalker-DNS about learning.
I'm "middle" aged and started off learning procedural Basic, it's taken quite some time to get my brain into thinking OOP but I like to think I'm getting there.
What works best for you may be different of course, but what I do is:
Skim documentaion to get an idea of what's there and get familliar with terminology
Try a few simple "hello world" type scripts to make sure the environment is set up correctly
Do a few "walk through" scripts to reinforce my learning of syntax
Work on projects, going back to the documentation / looking at sample code when need be
Unless I'm interested in learning how to do something in particular, I mostly learn on a "need to know" basis.
I think a key point to learning is to understand how the code works. Copy-Paste code is OK to test the envirnment, but leaning on it too much without understanding it doesn't help me learn anything, certainly not "best practice" as there is plenty of poor code out there. You may end up with something that "works", but it might not neccessarily be the "best" or even "good".
Don't worry about age too much. In my experience I've found I have an easier time learning things now without all the distractions and preoccupations of youth.
Thanks Mittineague for sharing your experience with me.
I was on pretty much same ground like you, started off by picking up on BASIC (basica / qbasic, during the 90s, who wasn't at that time?
But I then left programming in late 90s for study, chose to pursue a subject which didn't require coding knowledge. It wasn't until 2002 i started doing php for like 2-3 years (mainly as hobby where i wrote for fun and made little side income), after which it was another 'lost decade'.
To me OOP wasn't as scary like some said. Recently I went to local bookstores, did a few sessions of "free readings", managed to gobble up the ideas behind it, because it makes sense in most part.
However, Android development, on the other hand, looks a lot like a giant beast, which is hard to be tamed. To developers, it's more like putting together the scattered pieces of jigsaw puzzles, rather than working the code from ground up.
The more classes and samples one could memorize, the better coder he is (as an android developer). It defies the purpose of "there's more than one way to do it" - a popular belief in many programming languages. There's actually only a few ways (if not one) to make it work in android while a lots more ways to break it, one must abide a few dozens rules and coding patterns to make the code works. Like mentioned above, I still don't understand when or why should i used 'context' in some functions while not in others, though I briefly understood its main purpose is parsing the current environmental resources for other components to be interpreted.
E.g., when we use Toast.makeText(context, strings, duration), what's the 'context' doing there? It serves no 'obvious' purpose rather than some internal data parsing. Some serious programmers would argue how useful the context is for code efficiency especially in multiple activities, but really we are falling back to low-level or even assembly language with that thinking. Why not Android team make 'context' optional by following the current 'activity' state and save all the confusions?
If, 'context', must be parsed without altering its content (most of the time, 'this' or getBaseContext() could not be modified), what's the exact reason we must make it as an argument?
And as for the coding patterns, say, I want to make a specific marker on a map where a user input its GPS in EditText(textbox). Sounds pretty basic. But it's not, at least not to me. (I wonder how many could write from scratch without referring to any references. )
What I would do was finding all resources available about map marker, the perfect case would be there's an exact recipe ready for use, if not, I would copy out those similar codes with classes that make sense (MyLocationOverlay(), addOverlay(), etc) filter out the unwanted lines, joined all the codes together, praying that it will work.
Not sure if it's only me, but that really puts me off. Can't it be much simpler. Calling a map with a rectangle (2 point GPS -top left & bottom right), then place a specific marker with GPS on it, set zoom level, navigable logic (true/false), etc. Done.
When we need multiple locations, we'll recall same class with different objects. Then depend on our needs, we could draw a straight line to calculate distance, a real streetview path with real distance, etc. That's it! Is that too much to ask?
I don't know if that's the reason. On Google Play, though there are near 800,000 apps, but many among those apps rendered not much useful, even among the 'useful' ones perform very basic functions like 'show me the car park location', 'your friend's current location at xxx via sms' etc.
Perhaps the difficulty in coding practice limits the apps usefulness and creativity. I have a dozen ideas which (in my humble opinion) works better than FourSquare, but just could not realize it into app, though they were just performing basic GPS marker functions, storing into SQLite (and these data will be fetched into server's for public sharing), Store ratings and comments, near-distant ads auto displayed (via wifi or bluetooth) etc. I was thinking if every laptop/pc equipped with gps and the data was embedded into browser's headers, I would have managed to create a script like this in PHP with not much problems at all.
Well, I shouldn't complaint too much. Maybe I have not dig far enough and am not there yet.
But I'm seeing some replacements to the native way of coding that might come in the near future, not HTML5 (Mark Zuckerberg's FB web app should endorse HTML5 more than anyone else on earth, but he has not), maybe something similar to AppInventor, but with greater flexibility and features. Maybe an improved version of AppInv will make creating apps much easier and innovative. Creating Angry Bird on adroid should be as easy as doing it in Flash.
I take back what I've said about HTML5.
After spending the last few hours googling for latest progress in HTML5, it looks promising and could very well be the future main choice of most developers in mobile apps.
I was comparing the syntax as well. For an average developer, like myself, coding in HTML5 is much easier and more intuitive than native java.
Before starting any application development or software development we need to make proper planning. because poor planning cause more error. we have think about the target audience, compatibility, purpose of application, and finally testing.
I started with a solid computer science degree learning the basics of programming, during my studies I worked as an intern on various projects. After studies I started coding for large companies and picked up a lot. With such a background I had no problem learning to develop Android and iOs applicatoins, including a solid server side backend
Web development isn't easy, but application development has a whole other set of challenges and I think most web developers experience these kinds of challenges as they move to applications. Android in particular doesn't have perfect documentation and there's so many things that the platform doesn't do automatically that you have to do on your own and that just adds to the complexity level. The key is to just make sure that you're focused and learning one new thing every day. Eventually you sort of take a step forwards and figure out exactly how to develop applications.
Your knowledge of web development can actually help your Android development because you should know how to build a restful API for data access and storage and to some extent that's a hard thing for new developers.
I'm able to get into Android app development because PhoneGap helps me leverage my HTML/CSS experience. Now I'm converting my iPhone apps to Android one by one, using the same HTML/CSS code.
This topic is now closed. New replies are no longer allowed.