Tuesday, November 25, 2014

Android Fragments

A Fragment is a piece of an application's user interface or behavior that can be placed in an Activity which enable more modular activity design. It will not be wrong if we say, a fragment is a kind of sub-acitivity. Following are important points about fragment:
  • A fragment has its own layout and its own behavior with its own lifecycle callbacks.
  • You can add or remove fragments in an activity while the activity is running.
  • You can combine multiple fragments in a single activity to build a multi-pane UI.
  • A fragment can be used in multiple activities.
  • Fragment life cycle is closely related to the lifecycle of its host activity which means when the activity is paused, all the fragments available in the acivity will also be stopped.
  • A fragment can implement a behavior that has no user interface component.

Fragment Life Cycle

Android fragments have their own life cycle very similar to an android activity. This section briefs different stages of its life cycle.
Phase I: When a fragment gets created, it goes through the following states:
  • onAttach()
  • onCreate()
  • onCreateView()
  • onActivityCreated()

Phase II: When the fragment becomes visible, it goes through these states:
  • onStart()
  • onResume()
Phase III: When the fragment goes into the background mode, it goes through these states:
  • onPaused()
  • onStop()
Phase IV: When the fragment is destroyed, it goes through the following states:
  • onPaused()
  • onStop()
  • onDestroyView()
  • onDestroy()
  • onDetach()

Tuesday, July 1, 2014



Remember that the GUI layer doesn't request data directly from the web; data is always loaded from a local database.
The service layer periodically updates the local database.

What is the risk in blocking the Main thread when performing a lengthy operation such as web access or heavy computation? Application_Not_Responding exception will be thrown which will crash and restart the application.

Why is List View not recommended to have active components? Clicking on the active text box will pop up the software keyboard but this will resize the list, removing focus from the clicked element.

For senior employees

Beyond a certain level of experience, the job interview questions cease to be "difference between abstract class and interface", and focus more on testing your technical acumen, collaboration and communication skills. A list of such questions, typically asked during interviews for senior positions is given below:

Explain the life cycle of an application development process you worked on previously.

What the interviewer looks for is communication of requirements, planning, modeling, construction and deployment on the back end.

Here's a hypothetical project. Explain how you would go about it.

They want to know how you would break your work down into tasks and how many weeks for each task. I'm really looking to find out about planning methods, their skill set and how quickly they can execute.

How do you respond to requirement changes in the middle of a cycle?

What type of methodology have you used in the past? What are its drawbacks?

What are different techniques for prototyping an application?

Similar question: Do you feel there is value in wireframing an application? Why?

How do you manage conflicts in Web applications when there are different people managing data?

Tell me something you learned from a team member in the last year.

What software testing procedures have you used to perform a QA?

Once the coding skills verified. Sample I

· The Activity life cycle is must. Ask about the different phases of Activity Life cycle. For example: when and how the activity comes to foreground?

· Check the knowledge on AndroidManifest file, For example: Why do we need this file, What is the role of this file in Android app development.

· Different Kinds of Intents

· Ask about different Kinds of context

· Ask about different Storage Methods in android

· Kinds of Log debugger and Debugger Configuration

· How to debug the application on real device.

· How do you ensure that the app design will be consistent across the different screen resolutions

· Thread concepts also plus points as we deal with the treads more.

· Can you able to build custom views and how?

· How to create flexible layouts, For example to place English, Chinese fonts.

· What is localization and how to achieve?

· What are 9-patch images

· How to avoid ANR status

· How to do Memory management

· Ask about IPC

· What is onCreate(Bundle savedInstanceState), Have you used savedInstanceState when and why?

· To check how updated the person is just ask about what are Fragments in an Activity

If this is an Android specific job, just ask the obvious stuff. Sample II

Application lifecycle

When to use a service

How to use a broadcast receiver and register it both in the manifest and in code

Intent filters

Stuff about what manifest attributes and tags mean

The types of flags to run an application
How to do data intensive calculations using threads

Passing large objects (that can't be passed via intents and shouldn't be serialized) via a service
Binding to a service and the service lifecycle

How to persist data (both savedInstanceState and more permanent ways)

Just go through and see what sounds like it's important. Hopefully you're an android developer and know what all those things are, otherwise you're just waiting your interviewee's time =P