970_90

Tuesday, 28 April 2015

Android Interview Questions and Answers for fresher and Experienced

Android Interview Questions and Answers for fresher and Experienced


Question: What is Android?
Android an open-source operating system used for smartphones and tablet.


Question: How to start anroid development?
1. Download Android Studio.
2. Download the latest SDK tools and platforms.
3. Create a Project(Application) with Android Studio.
4. Now Running Your Application.
5. Install an editor for development (I am using eclipse editor for development).


Question: What main components of Android application?
1. Activities: They dictate the UI and handle the user interaction to the screen.
2. Services: They handle background processing associated with an application.
3. Broadcast Receivers: They handle communication between Android OS and applications.v 4. Content Providers: They handle data and database management stuff.


Question: What is Intent? What are two different type of Intent?
Intent means "intention" to do an action.
Question: Difference between px, sp, dip, dpi and pt in Android?
px is one pixel. px is corresponds to actual pixels on the screen.
sp is scale-independent pixels. SP is like the dp unit, but it is also scaled by the user's font size preference.
dip is Density-independent pixels.
dpi is Dots per inches.
pt is points.


Question: How to Close/hide the Android Soft Keyboard?
Hide the virtual keyboard using the InputMethodManager.


Question: How to Lazy load of images in ListView in Android?
You can use droidQuery.
$.with(myView).image(url);



Question: How to get unique Android device ID?
Settings.Secure#ANDROID_ID 
Will return unique Android device ID.


Question: How to get screen dimensions in pixels in Andorid Devices?
int screenHeight = getResources().getDisplayMetrics().heightPixels;
int screenWidth = getResources().getDisplayMetrics().widthPixels; 



Question: How do I center text horizontally and vertically in a TextView in Android?
<textview android:gravity="center" android:layout_height="fill_parent" android:layout_width="fill_parent" android:text="@string/username"></textview>



Question:What is the difference between match_parent and fill_parent?
Both are same thing and are different name in different API version.
match_parent means view should be as big as its parent (minus padding. This name is used in less than API Level 7.
fill_parent means view should be as big as its parent (minus padding). This constant is deprecated starting from API Level 8 and is replaced by match_parent.


Question: Is there a way to get the source code from an APK file?
http://stackoverflow.com/questions/3593420/is-there-a-way-to-get-the-source-code-from-an-apk-file


Question: How to set Standard Android Button with a different color?
button.getBackground().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0xFFAA0000));



Question: How to disable landscape mode in Android?
Open AndroidManifest.xml file and set following.
android:screenOrientation="sensorPortait"



Question: How can I open a URL in Android's web browser from my application?
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.web-technology-experts-notes.in/2015/04/to-whom-does-pci-compliance-need-to-apply.html"));
startActivity(browserIntent);



Question: How do you install an APK file in the Android emulator?
http://stackoverflow.com/questions/3480201/how-do-you-install-an-apk-file-in-the-android-emulator


Question: How to Converting pixels to dp and vise versa?
public static float dpFromPx(final Context context, final float px) {
    return px / context.getResources().getDisplayMetrics().density;
}



Question: Can we display HTML in TextView? If yes, then How?
Yes, we can display HTML.
myTextView.setText(Html.fromHtml("<h2>
Web Technology</h2>
This is testing

"));



Question: How to put a border around an android textview?
<textview android:background="@drawable/back" android:text="Some text"></textview>


No comments:

Post a Comment