Which topics must be covered while learning Android?
These all focus on programming… You know what other thing is one of the most important topics? UX and UI design. UI is the most important aspect of an app according to me (provided that programming is sufficiently given importance). UI is what an user sees. It should give the user experience she/he cannot forget.
The main topics include
Activity Lifecycle
In this topic,we will learn about the building block of user app interface (UI).You also learn about using intent to communicate from one to another.An email app might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading individual messages.
The activities in the app work with each other o form a cohesive UI,while each activity is dependent on others.It helps to start activity in the app,which also provide the other app to start activity into that app.For example, a messaging app could start an activity in a camera app to take a picture, then start an activity in an email app to let the user share the picture in email.
Fragments
Fragment is the activity done in the app which is known as the sub-activity.There can be more than activity in the fragment.As it represents multiple activity in one activity.Android Fragment Lifecycle is affected by activity lifeycle as it is done with the fragment is included.Each fragment has its own lifecycle which affects affected by activity life cycle because fragments are embedded in activity.
The fragment manager class is responsible to make interaction between fragment objects.
onAttach(Activity)it is called only once when it is attached with activity.onCreate(Bundle)It is used to initialize the fragment.onCreateView(LayoutInflater, ViewGroup, Bundle)creates and returns view hierarchy.onActivityCreated(Bundle)It is invoked after the completion of onCreate() method.onViewStateRestored(Bundle)It provides information to the fragment that all the saved state of fragment view hierarchy has been restored.onStart()makes the fragment visible.onResume()makes the fragment interactive.onPause()is called when fragment is no longer interactive.onStop()is called when fragment is no longer visible.onDestroyView()allows the fragment to clean up resources.onDestroy()allows the fragment to do final clean up of fragment state.onDetach()It is called immediately prior to the fragment no longer being associated with its activity.
Threads
Network operations and database calls, as well as loading of certain components, are common examples of operations that one should avoid in the main thread. When they are called in the main thread, they are called synchronously, which means that the UI will remain completely unresponsive until the operation completes. For this reason, they are usually performed in separate threads, which thereby avoids blocking the UI while they are being performed (i.e., they are performed asynchronously from the UI).
Android provides many ways of creating and managing threads, and many third-party libraries exist that make thread management a lot more pleasant. However, with so many different approaches at hand, choosing the right one can be quite confusing.
Networking
Android lets your application connect to the internet or any other local network and allows you to perform network operations.
A device can have various types of network connections. This chapter focuses on using either a Wi-Fi or a mobile network connection.
Checking Network Connection
Before you perform any network operations, you must first check that are you connected to that network or internet e.t.c. For this android provides ConnectivityManager class. You need to instantiate an object of this class by calling getSystemService() method.
You will use Android studio IDE to create an Android application under a package com.tutorialspoint.myapplication.
Modify src/MainActivity.java file to add Activity code.
Modify layout XML file res/layout/activity_main.xml add any GUI component if required.
Modify AndroidManifest.xml to add necessary permissions.
Run the application and choose a running android device and install the application on it and verify the results.
Intents
An intent is to perform an action on the screen. It is mostly used to start activity, send broadcast receiver,start services and send message between two activities. There are two intents available in android as Implicit Intents and Explicit Intents. Here is a sample example to start new activity with old activity.
Create a new project in Android Studio,go to File ⇒ New Project and fill all required details to create a new project.
Add the following code to res/layout/activity_main.xml. (First Activity layout)
Create a new layout in res/layout/ folder and add the following code to res/layout/activity_main.xml. (Second Activity layout )
Add the following code to src/MainActivity.java (First activity)
Create a new activity and add the following code to src/SecondActivity.java (Second Activity)
Other 3rd party libraries that you would use (learn it when you want to use them in your projects)
Layouts and its components (including stuff like ListView, RecyclerView etc.)
Conclusion
So there you have it. Who thought so much could be said about marketing an Android app? Google has created an incredible and growing opportunity for developers around the world to achieve success on the Android Market and other sites that showcase Android apps. Although not without its flaws and complaints, the Android Market has created a tremendous opportunity for individual developers and app companies to build and sell mobile technology for the masses. Here’s to your success.