The largest Interview Solution Library on the web


Interview Questions
« Previous | 0 | 1 | 2 | 3 | 4 | Next »

41.Is it possible to use or add a fragment without using a user interface?

Yes, it is possible to do that, such as when you want to create a background behavior for a particular activity. You can do this by using add(Fragment,string) method to add a fragment from the activity.

42.How do you remove icons and widgets from the main screen of the Android device?

To remove an icon or shortcut, press and hold that icon. You then drag it downwards to the lower part of the screen where a remove button appears.

43.What are the core components under the Android application architecture?

There are 5 key components under the Android application architecture:

  • services
  • intent
  • resource externalization
  • notifications
  • content providers

44.What composes a typical Android application project?

A project under Android development, upon compilation, becomes an .apk file. This apk file format is actually made up of the AndroidManifest.xml file, application code, resource files, and other related files.

45.What is a Sticky Intent?

A Sticky Intent is a broadcast from sendStickyBroadcast() method such that the intent floats around even after the broadcast, allowing others to collect data from it.

46.Do all mobile phones support the latest Android operating system?

Some Android-powered phone allows you to upgrade to the higher Android operating system version. However, not all upgrades would allow you to get the latest version. It depends largely on the capability and specs of the phone, whether it can support the newer features available under the latest Android version.

47.What is portable wi-fi hotspot?

Portable Wi-Fi Hotspot allows you to share your mobile internet connection to other wireless device. For example, using your Android-powered phone as a Wi-Fi Hotspot, you can use your laptop to connect to the Internet using that access point.

48.What is an action?

In Android development, an action is what the intent sender wants to do or expected to get as a response. Most application functionality is based on the intended action.

49.What is the difference between a regular bitmap and a nine-patch image?

In general, a Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

50.What language is supported by Android for application development?

The main language supported is Java programming language. Java is the most popular language for app development, which makes it ideal even for new Android developers to quickly learn to create and deploy applications in the Android environment.

51.When does onResume() method called?

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.

52.How to launch an activity in your application?

For launching an activity, we need to create an explicit intent that defines the activity that we wish to start. In the below code snippet, the first parameter to Intent constructor is the current activity context and the second parameter is your new activityclass.startActivity() method can be called on Activity context.

Intentintent =newIntent(this,SecondActivity.class);startActivity(intent);

If you want to start an activity from fragment

Intentintent =newIntent(getActivity(),SecondActivity.class);getActivity().startActivity(intent);

53.How to define an Activity as launcher activity in application Manifest file?

All the activities used in the application should be defined in application manifest file. For launcher activity you need to define intent filter as shown in the below code snippets.

<activity android:name=".MyActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

54.What is a ANR ?

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.

55.What are the measures to avoid application ANR?

ANR in application is annoying to user. It can be caused due to various reasons. Below are some of the tips to avoid ANR

  • Perform all you long running network or database operation in separate thread
  • If you have too much of background tasks, then take it off the UI thread. You may use IntentService
  • Server not responding for longer period can be guilt for ANR. To avoid always define HTTP time out for your all your webs service calls.
  • Be watchful of infinite loops during your complex calculations

56.What is the difference between a regular .png and a nine-patch image?

The nine patch images are extension with .9.png. Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

57.How to share text using android share Intent ?

Share intent is an easy and convenient way of sharing content of your application with other apps.

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

58.What is the use of WebView in android?

A WebView is an android UI component that displays webpages. It can either display a remote webpage or can also load static HTML data. This encompasses the functionality of a browser that can be integrated to application. WebView uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, etc

59.Define different kind of context in android

Context defines the current state of application or object. Context provides access to things such as creating new activity instance, access databases, start a service, etc. You can get the context by invoking getApplicationContext(), getContext(),getBaseContext() or this when in the activity class.

//Creating ui instanceImageButton button = newImageButton(getContext());
//creating adapterListAdapter adapter =newSimpleCursorAdapter(getApplicationContext(),...);
//querying content providergetApplicationContext().getContentResolver().query(uri, ...);
//start activity. Here this means activity contextIntentintent =new Intent(this, SecondActivity.class);

60.What are the different storage methods in android?

Android offers several different options for data persistence.

  • Shared Preferences – Store private primitive data in key-value pairs. This sometimes gets limited as it offers only key value pairs. You cannot save your own java types.
  • 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. You can define many number of tables and can store data like other RDBMS.
RELATED POSTS:

Android Input Dialog Example
Android TextView Example
Installing Android Studio
How to Add an Event to Device Calendar in Android
Android Versions and API Levels
Edittext Validation in Android Example
How to create Bitmap blur effect in Android using RenderScript

« Previous | 0 | 1 | 2 | 3 | 4 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com