Interview Questions and Answers - Android

Basics :2


1# : Explain file and folder after create new android application


  After Create Android application the following files & folders in the package explorer in eclipse :
  • src: Contains the .java source & write the code for application in this file. files are available under the package name for project.
  • gen : Contains the R.java file. It is compiler-generated file that references all the resources found in project & auto generate files when build project.
  • library(Android & 
    Android Private Libraries
     
    Contains android.jar file, which contains all the class libraries needed for an Android application.
  • assets:  Contains all the information about HTML file, text files, databases, etc. & All external files.
  • bin: Contains the .apk (Android Package) file is the application binary file. generated by the ADT during the build process. 
  • libs : Contains android.jar file
  • res: Contains all the resource files & layout details for application also contains subfolders as: drawable, menu, layout, and values etc.
  • AndroidManifest.xml : File contains the following information about the application:
  • The package name of the application.
  • The version code of the application .
  • This value is used to identify the version number of application.
  • The version name of the application.
  • The android:minSdkVersion,android:targetSdkVersion,android:maxminSdkVersion
  • ic_launcher.png is the default image that located in the drawable folders.
  • App_name defines the name of application and available in the strings.xml file.
also proguard-project.txt & project.properties





2# : Android activity life cycle :


Interactive screen to the users (UI - User Interface Handler). It can contain many user interface components. Android developer has to define a main activity that is launched on the application startup.

package com.example.demoapp;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true; }
}

Life Cycle :- 
  • Starting an Activity 
  • Pausing and Resuming an Activity
  • Stopping and Restarting an Activity
  • Recreating an Activity
  • Destroy an Activity


3# : Process for launch an Activity within you application?


  Launching activity with in the application need to create an intent.
   Ex.
Intent intent = new Intent(this, NewActivity.class);
startActivity(intent);


4# : What is Intent ?

An intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service.

    There are two types of Intents - Explicit Intent, Implicit Intent.


5# :Type of data base use in android app ?

Android provides several options for save application data. The solution depends on specific needs, such as whether the data should be private to your application or accessible to other applications and how much space your data requires.

Your data storage options are the following:
  • Shared Preferences    : Store private primitive data in key-value pairs.
  • Internal Storage         : Store private data on the device memory.
  • External Storage        : Store public data on the shared external storage.
  • SQLite Databases      : Store structured data in a private database.
  • Network Connection : Store data on the web with your own network server.
 << Previous                    Next  >>

Popular posts from this blog

Cordova Plugin Firebase Cloud Messaging For Android

iOS Phonegap app share extension (images) with ionic

Print Hand Plugin With Cordova/PhoneGap For Android.