Google News
logo
Android Interview Questions
Android AsyncTask going to do background operation on the background thread and update on the main thread. In android, We can't directly touch the background thread to the main thread in android development. asyncTask helps us to make communication between the background thread to the main thread.
A Handler is used to send and process Message and Runnable objects associated with a thread's MessageQueue. When a Handler created default bound with a Looper class. It will deliver messages and runnable to that Looper's message queue and execute them on Looper's thread.
 
Handlers are mainly used to Update the User Interface from a background thread, Enqueue a task for a different thread and Schedule a task for a specified time.
The onTrimMemory(int level) is used when the operating system has determined that a process to trim unneeded memory from its subprocess.
Implicit Intent is used whenever you are performing an action. For example, send email, SMS, dial number or you can use a Uri to specify the data type.

For example :
Intent i = new Intent(ACTION_VIEW,Uri.parse("https://www.freetimelearning.com")); 
startActivity(i);

 

Explicit, on the other hand, helps you to switch from one activity to another activity(often known as the target activity). It is also used to pass data using putExtra method and retrieved by other activity by getIntent().getExtras() methods.
 
For example : 
Intent i = new Intent(this, Activitytwo.class); #ActivityTwo is the target component
i.putExtra("Value1","This is ActivityTwo"); 
i.putExtra("Value2","This Value two for ActivityTwo"); 
startactivity(i);

 

* Toast notification is a message that pops up on the window.
* It only covers the expanse of space required for the message and the user’s recent activity remains visible and interactive.
* The notification automatically fades in and out and does not accept interaction events.
 
Syntax :

Toast.makeText(ProjectActivity.this, "Your message here", Toast.LENGTH_LONG).show();

AAPT is short for Android Asset Packaging Tool. This tool provides developers with the ability to deal with zip-compatible archives, which includes creating, extracting as well as viewing its contents.
* Broadcast Receiver is a mechanism using which host application can listen for System level events.
* Broadcast receiver is used by the application whenever they need to perform the execution based on system events. Like listening for Incoming call, sms etc.
* Broadcast receivers helps in responding to broadcast messages from other application or from the system.
* It is used to handle communication between Android operating system and applications. 

It is implemented as a subclass of BroadcastReceiver class and each message is broadcaster as an Intent object.
public class MyReceiver extends BroadcastReceiver {
  Public void onReceive(context,intent){}
}

 

WebView is a view that display web pages inside your application. According to Android, “this class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more. In order to add WebView to your application, you have to add <WebView> element to your XML layout file.
src : contains the .java source files for your project.
gen : contains the .R file, a compiler-generated file that references all the resources found in your project.
bin : contains the Android package files .apk built by the ADT during the build process and everything else needed to run an Android application.
res/drawable-hdpi : this is a directory for drawable objects that are designed for high-density screens.
res/layout : this is a directory for files that define your app’s user interface.
res/values : this is a directory for other various XML files that contain a collection of resources, such as strings and colors definitions.
AndroidManifest.xml : this is the manifest file which describes the fundamental characteristics of the app and defines each of its components.
Activity is typically a single, focused operation that a user can perform such as dial a number, take a picture, send an email, view a map etc.
 
Fragment is a modular section of an activity, with its own lifecycle and input events, and which can be added or removed at will. Also, a fragment’s lifecycle is directly affected by its host activity’s lifecycle i.e. when the activity is paused, so are all fragments in it, and when the activity is destroyed, so are all of its fragments.