Monday , December 10 2018
Home / Android questions

Android questions

1.  What is Android ?
Ans. Android is an open source, linux-based operating system which is used in tablets, televisions,mobiles.

2. Does android support other language ?
Ans. Yes, android application can be developed in C/C++ also using android NDK (Native Development Kit). It makes the performance faster. It should be used with android SDK.

3. When does onResume() method called ?
Ans. onResume() method is an activity lifecycle method. This is called when the activity come to foreground. You can override this method in your activity to execute code when activity is started, restarted or comes to foreground.

4. What is a ContentProvider and what is it typically used for ?
Ans. A ContentProvider manages access to a structured set of data. It encapsulates the data and provide mechanisms for defining data security. ContentProvider is the standard interface that connects data in one process with code running in another process.

5.  What are the life cycle methods of android activity ?
Ans.   There are 7 life-cycle methods of activity. They are as follows:

  1. onCreate()
  2. onStart()
  3. onResume()
  4. onPause()
  5. onStop()
  6. onRestart()
  7. onDestroy()

6. Android application can only be programmed in Java?
Ans. False. You can program Android apps in C/C++ using NDK .

7.When does Android start and end an application process?
Ans. Android starts an application process when application’s component needs to be executed. It then closes the process when it’s no longer needed (garbage collection).

8. How does Android system track the applications?
Ans. Android system assigns each application a unique ID that is called Linux user ID. This ID is used to track each application.

9. Define Android application resource files?
Ans. As an Android application developer, you can inject files (XML, JSON, JPEG etc) into the build process and can load them from the code. These injected files are revered as resources.

10. What are Intents?
Ans. Intents displays notification messages to the user from within the Android enabled device. It can be used to alert the user of a particular state that occurred. Users can be made to respond to intents.

11. What are Activities?
Ans. Activities are what you refer to as the window to a user interface. Just as you create windows in order to display output or to ask for an input in the form of dialog boxes, activities play the same role, though it may not always be in the form of a user interface.

12. What is differentiate Activities from Services?
Ans. Activities can be finished, or terminated anytime the user wishes. On the other hand, services are designed to run behind the screens, and can act independently. Most services run continuously, regardless of whether there are certain or no activities being executed.

13. Why XML-based layouts is used for design?
Ans. he use of XML-based layouts provides a consistent and somewhat standard means of setting GUI definition format. In common practice, layout details are placed in XML files while other items are placed in source files.

14. What is adb?
Ans. Adb is short for Android Debug Bridge. It allows developers the power to execute remote shell commands. Its basic function is to allow and control communication towards and from the emulator port.

15. What is an Action?
Ans. Action in Android glossary is something that an Intent sender wants done. It is a string value that is assigned to intent. Action string can be defined by the Android itself or by you as third party application developer.

16. Describe three common use cases for using an Intent.
Ans. Common use cases for using an Intent include:
To start an activity: You can start a new instance of an Activity by passing an Intent to startActivity() method.
To start a service: You can start a service to perform a one-time operation (such as download a file) by passing an Intent to startService().
To deliver a broadcast: You can deliver a broadcast to other apps by passing an Intent to sendBroadcast(), sendOrderedBroadcast(), or sendStickyBroadcast().

17. What are the core building blocks of android?
Ans. The core building blocks of android are:
1)Activity
2)View
3)Intent
4)Service
5)Content Provider
6)Fragment etc.

18. How to call another activity in android?
Ans. Intent i = new Intent(getApplicationContext(), ActivityTwo.class);
startActivity(i);

19. What is the name of database used in android?
Ans. SQLite: An opensource and lightweight relational database for mobile devices.

20. What is a ANR ?
Ans. ANR is short for Application Not Responding. Android systems shows this dialog, if application is performing too much of task on main thread and been unresponsive for a long period of time.

21. How to share text using android share Intent ?
Ans. Share intent is an easy and convenient way of sharing content of your application with other apps.

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, “This is my text to send.”);
sendIntent.setType(“text/plain”);
startActivity(sendIntent);

22. How can your application perform actions that are provided by other application e.g. sending email?
Ans. Intents are created to define an action that we want to perform and the launches the appropriate activity from another application.
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, recipientArray);
startActivity(intent);

23. How will you pass data to sub-activities?
Ans. We can use Bundles to pass data to sub-activities. There are like HashMaps that and take trivial data types. These Bundles transport information from one Activity to another.

Bundle b = new Bundle();
b.putString(“EMAIL”, “abc@xyz.com”);
i.putExtras(b); // where i is the intent

24. What is AAPT?
Ans. AAPT is an acronym for android asset packaging tool. It handles the packaging process.

25. What is fragment?
Ans. Fragment is a part of Activity. By the help of fragments, we can display multiple screens on one activity.

26) What is DDMS?
Ans. DDMS stands for Dalvik Debug Monitor Server. It gives the wide array of debugging features:

  • Port forwarding services
  • Screen capture
  • Thread and heap information
  • Network traffic tracking
  • Location data spoofing

27) Define Android Architecture?
Ans. Android architecture consists of 4 components:

  • Linux Kernal
  • Libraries
  • Android Framework
  • Android Applications

28) What is a portable wi-fi hotspot?
Ans. The portable wi-fi hotspot is used to share internet connection to other wireless devices.

29) Name the dialog box which are supported by android?

Ans.

  • Alert Dialog
  • Progress Dialog
  • Date Picker Dialog
  • Time picker Dialog

30) Name some exceptions in android?

  • Inflate Exception
  • Surface.OutOfResourceException
  • SurfaceHolder.BadSurfaceTypeException
  • WindowManager.BadTokenException

31) What are the basic tools used to develop an android app?

  • JDK
  • Eclipse+ADT plugin
  • SDK Tools

Leave a Reply