4.18.24 Movement Legacies, Reflection, and Review.pptx
Android interview questions
1. www.enrollmytraining.com
www.enrollmytraining.com,Mail Us: info@enrollmytraining.com
Call Us:+91-9705981289,Skype id: enrollmy.training
Android interview questions
1.Explain the life cycle of an activity, in android?
onCreate-> onStart() -> onResume() -> onPause() -> onStop() -
> onDestroy()
2.What is the difference between px, dp, dip, and dpi ?
px - pixels, dp - density independentpixels, dip - density
independentpixels, sp - scale independentpixels
3.What is android:gravityattribute in the view tag?
it is to align the view content either right/top/bottom/center
with in that view.
2. www.enrollmytraining.com
www.enrollmytraining.com,Mail Us: info@enrollmytraining.com
Call Us:+91-9705981289,Skype id: enrollmy.training
4.What is the difference between linearlayout and relative
layout?
linearlayout - arranges element in either vertical or horizontal
fashion.
Relative layout- arranges elements in relative to each other.
5.How to killan activity?
i. finish()
ii.finishActivity(intrequestcode)
6.what is the life cycle of an activity in case of configuration
change or orientationchange?
a)onPause() -> onSaveInstanceState()-> onCreate() -> onStart()
-> onRestoreInstanceState() -> onResume()
b)onPause() -> onSaveInstanceState()-> onStop() -> onCreate()
-> onStart() -> onRestoreInstanceState() -> onResume()
c)onPause() -> onSaveInstanceState() -> onStop() ->
onDestroy()->onCreate() -> onStart() ->
onRestoreInstanceState() -> onResume()
3. www.enrollmytraining.com
www.enrollmytraining.com,Mail Us: info@enrollmytraining.com
Call Us:+91-9705981289,Skype id: enrollmy.training
7.How many kinds of linearlayoutsare there in android?
horizontal& vertical linearlayout
8.What is Bundle?What does it contain in onCreate() of your
activity?
Bundle containprevious savedInstantceState
9.How to get image from gallery, in android?
Intent in = new Intent();
in.setType("image/*");
in.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(in, 0);
10.Name some list adapters?
array adapter, cursor adapter, expandablelist adapter, etc..
4. www.enrollmytraining.com
www.enrollmytraining.com,Mail Us: info@enrollmytraining.com
Call Us:+91-9705981289,Skype id: enrollmy.training
11.When an activity is in stopped state, is it still in memory or
not?
when onStop() is called,then activity is still in memory and all
its states and variables are intact.
12.How to pass data between activities? let’s say pass user id,
city, and password to next activity and displayit.
Intent in = new Intent();
in.setAction("ACTION");//this should match with other activity
intent-filter
in.putExtra("uid","kalis");
in.putExtra("city","Chennai");
in.putExtra("pw","androidtips");
13.What is activity in android?
Each screen in android,with which user interacts is called as an
activity.
14.What is a context in android?
5. www.enrollmytraining.com
www.enrollmytraining.com,Mail Us: info@enrollmytraining.com
Call Us:+91-9705981289,Skype id: enrollmy.training
a).It is an interface to global informationof an application.
b).contexts are generally used to create a new componentsor
objects, like views.
c).Contexts are also used to start an activity, or service or a
receiver.
d).There are two types of contexts, activity context(this) and
applicationcontext.You can obtainapplication contextby
getApplicationContext()method.
15.What is pendingintent in android?
An intent which will be fired or triggered at future pointof time
by some one else (esp Alarm Manager or NotificationManager)
on behalf of your application.
http://www.enrollmytraining.com/android-online-training/