Android
Android
Cache builds up overtime The cache is built during the first boot
onCreate(): It is called when the activity is first created. This is where all the
static work is done like creating views, binding data to lists, etc.
onStart(): It is invoked when the activity is visible to the user. It is followed
by onResume() if the activity is invoked from the background.
Android basic Question
onRestart(): It is invoked after the activity has been stopped and prior to its
starting stage and thus is always followed by onStart() when any activity is
revived from background to on the screen.
onResume(): It is invoked when the activity starts interacting with the user.
At this point, the activity is at the top of the activity stack, with a user
interacting with it.
onPause(): It is invoked when an activity is going into the background but
has not yet been killed. It is a counterpart to onResume()
onStop(): It is invoked when the activity is not visible to the user. It is
followed by onRestart() when the activity is revoked from the background,
followed by onDestroy() when the activity is closed or finished, and nothing
when the activity remains on the background only.
onDestroy(): The final call received before the activity is destroyed. This
can happen either because the activity is finished (when finish() is invoked)
or because the system is temporarily destroying this instance of the activity
to save space.
Methods Description
Methods Description
the fragment.
Activity is an application
The fragment is only part of an activity,
component that gives a user
it basically contributes its UI to that
interface where the user can
activity.
interact.
Activity Fragment
View ViewGroup
View ViewGroup
30. MVC vs MVP vs MVVM architecture and which one we should choose?
MVVM(MODEL
MVC(MODEL VIEW MVP(MODEL VIEW VIEW
CONTROLLER) PRESENTER) VIEWMODEL)
This architecture
pattern is more
It resolves the problem of
event-driven as it
UI(View) and data- having a
uses data binding
access dependent View by
and thus makes
mechanism(Model) are using Presenter as a
easy separation
tightly coupled. communication channel
of core business
between Model and View.
logic from
the View.
require a converter to change it into Gson first. Retrofit is much simpler than
other libraries; we don’t have to parse our JSON. It directly returns objects but
there is one disadvantage: it doesn’t provide support to load images from the
server, but we can use Picasso for the same.