Home > Tag Archives: android

Tag Archives: android

How to create Android Menus

android

Options Menu The options menu is created when the user presses the menu button while the Activity is active.Step 1 – Creating the menu XML Step 2 – Showing the menu (implemented in Activity class) Step 3 – Listening to user choice (implemented in Activity class) Step 4 – optional: updating the menu items dynamically. Opening the options menu by ... Read More »

Android Questions & Answers for Experienced

android

Q. What is assert? Where will you use it? – Assertion is a statement in java. It can be used to test your assumptions about the program. While executing assertion, it is believed to be true. If it fails, JVM will throw an error named AssertionError. It is mainly used for testing purpose.for Exampleassert value>=18:” Not valid”;Q. How do you ... Read More »

Essential Android Interview Question & Answer

android

Q.1 There are four Java classes related to the use of sensors on the Android platform. List them and explain the purpose of each. – The four Java classes related to the use of sensors on the Android platform are: Sensor: Provides methods to identify which capabilities are available for a specific sensor. SensorManager: Provides methods for registering sensor event ... Read More »

Android Interview Questions & Answer

android

Q.1 Explain in brief about the important file and folder when you create new android application. When you create android application the following folders are created in the package explorer in eclipse which are as follows: src: Contains the .java source files for your project. You write the code for your application in this file. This file is available under ... Read More »

Using the Android NDK

android

Create a regular Android project Add a new folder to your project – <project>/JNI Write a native (C/C++) code and place the files under <project>/JNI. You should follow the JNI rules when writing your native code. Example: #include <string.h> #include <jni.h>   jstring Java_com_mypackage_helloworld_HelloWorld_getNativeString( JNIEnv* env, jobject obj ) {     return (*env)->NewStringUTF(env, "Hello World"); } Create a Android.mk file and ... Read More »

What is Android NDK?

android

What is Android NDK? NDK (Native Development Kit) is a set of tools that enables you to easily include native code written in C or C++ in your Android applications. The NDK uses the JNI mechanism to call functions from Java to C and C++. The NDK was introduced with Android version 1.5. In version 2.3 some major improvements were ... Read More »

Android Chronometer

android

Chronometer Class that implements a simple timer You can give it a start time in the elapsedRealtime() timebase, and it counts up from that, or if you don’t give it a base time, it will use the time at which you call start(). The timer can also count downward towards the base time by setting setCountDown(boolean) to true. By default ... Read More »

Android – WebView

android

WebView is a view that display web pages inside your application. You can also specify HTML string and can show it inside your application using WebView. WebView makes turns your application to a web application. In order to add WebView to your application, you have to add element to your xml layout file. Its syntax is as follows – <webview ... Read More »

Android Widget – Spinner

android

Android spinners are not nothing but the dropdownlist seen in other programming languages. It provides a easy way to select value from list. Clicking spinner will display a dropdownlist with the available values. In this tutorial, we show you how to do the following tasks : 1.Render a Spinner in XML, and load the selection items via XML file also. ... Read More »

Android Widget – Rating Bar

android

In Android, you can use “android.widget.RatingBar” to display rating bar component in stars icon. The user is able to touch,drag or click on the stars to set the rating value easily. In this tutorial, we show you how to use XML to display a rating bar, few textviews and a button. When user click onthe rating bar’s star,the selected rating ... Read More »