Home > Android (page 3)

Android

Android Gestures

android

Android provides special types of touch screen events such as pinch , double tap, scrolls , long presses and flinch. These are all known as gestures. Android provides GestureDetector class to receive motion events and tell us that these events correspond to gestures or not. To use it, you need to create an object of GestureDetector and then extend another ... Read More »

Android Creating links using Linkfy

android

Linkfy is a class that lets you create links from TextViews. You can create links not just to web sites, but to also map addresses, emails and even phone numbers. Linking to a web address TextView myWebSite = (TextView) findViewById(R.id.my_web_site); myWebSite.setText("http://http://www.google.com/"); Linkify.addLinks(myWebSite , Linkify.WEB_URLS); Linking to a phone number TextView myPhone = (TextView) findViewById(R.id.my_web_site); myPhone .setText("9999590698"); Linkify.addLinks(myPhone  , Linkify.PHONE_NUMBERS); //map ... Read More »

Android Resource images

android

Resource images are placed under <project_dir>/res/drawable Using a resource image in an image view – XML example Using a resource image in an image view – Code Example Turning the resource image to a Bitmap object Drawing the bitmap on a canvas object Clearing the bitmap data from the memory Read More »

Android Status-Bar Notifications

android

One of the ways to notify the Android user is by displaying notifications in the status bar. You can show a message, play sound add icon and more. Creating a status bar notification Read More »

Android Alerts/Dialogs

android

Toast A toast notification is a message that pops up on the surface of the window. AlertDialog AlertDialog with a List Creating Custom Dialog using layout XML file As a developer you can also create customized alert dialogs. Step 1 – Creating the Dialog XML * The dialog layout xml file is placed together with all the layout xml files ... Read More »

Android Global Strings

android

A global string, or array of strings are declared in an external xml file in the resource folder:<project>/res/values/strings.xml Declaring a global string Using a global string while creating a TextView XML example: Code example: Getting a global string Global String Array Declaration in a Global String Array Code usage Read More »

Android Layouts

android

Layout is a type of a GroupView. It holds views in a certain layout on the screen. Layouts can be declared in two ways: Declare UI elements in XML –Android provides a straightforward XML vocabulary that corresponds to the View classes and subclasses, such as those for widgets and layouts. Instantiate layout elements at runtime –your application can create View ... Read More »

Android View Groups

android

A ViewGroup is a special view that can contain other views. List view Spinner (drop-down list) Read More »

User Interface – Views

android

Creating and adding a new View to a LayoutXML example – Adding to a view in a layout XML file Code example – Creating and adding a new view to a Layout (implemented in an Activity class). Read More »

Android Fragment

android

A Fragment is a piece of an activity which enable more modular activity design. It will not be wrong if we say, a fragment is a kind of sub-activity. If you want to create multi-UI pane than you should use fragment . Fragment Overview * A fragment has its own layout and its own behaviour with its own life cycle ... Read More »