Blog Posts

Animation Resources

Android Animation Resource

An animation resource can define one of two types of animations: Property Animation Creates an animation by modifying an object’s property values over a set period of time with an Animator. View Animation There are two types of animations that you can do with the view animation framework: Tween animation: Creates an animation by performing a series of transformations on a single image with an Animation Frame animation: or creates an animation by showing a sequence of images in order with

Continue Reading

Android Buttons

android-buttons

Android buttons consists of text or an icon (or both text and an icon) that communicates what action occurs when the user touches it. Depending on whether you want a button with text, an icon, or both, you can create the button in your layout in three ways: With text, using the Button class: <Button     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/button_text"     ... /> With an icon, using the ImageButton class: <ImageButton     android:layout_width="wrap_content"  

Continue Reading

Android Text Fields

Android Text Fields

A text field allows the user to type text into your app. It can be either single line or multi-line. Touching a text field places the cursor and automatically displays the keyboard. In addition to typing, text fields allow for a variety of other activities, such as text selection (cut, copy, paste) and data look-up via auto-completion. You can add a text field to you layout with the EditText object. You should usually do so in your XML layout with

Continue Reading

Android TextView

Android TextView

The TextView view is used to display text to the user. This is the most basic view and one that you will frequently use when you develop Android applications.  If you need to allow users to edit the text displayed, you should use the subclass of TextView, EditText, which is discussed in the next chapter. When you create a new Android project, Android Studio always creates the content_main.xml file (located in the res/layout folder), which contains a <TextView> element: <?xml version="1.0" encoding="utf-8"?> <LinearLayout

Continue Reading

Supporting Different Devices

Supporting Different Devices

Android devices come in many shapes and sizes all around the world. With a wide range of device types, you have an opportunity to reach a huge audience with your app. In order to be as successful as possible on Android, your app needs to adapt to various device configurations. Some of the important variations that you should consider include different languages, screen sizes, and versions of the Android platform. This class teaches you how to use basic platform features

Continue Reading

Android Screen Orientation

Android Screen Orientation

The screenOrientation is the attribute of activity element. The orientation of android activity can be portrait, landscape, sensor, unspecified etc. You need to define it in the AndroidManifest.xml file. For example: <activity android:name=".MainActivity" android:label="@string/app_name" android:screenOrientation="portrait"> Value Description unspecified It is the default value. In such case, system chooses the orientation. portrait taller not wider landscape wider not taller sensor orientation is determined by the device orientation sensor. One of the key features of modern smartphones is their ability to switch

Continue Reading

Getting to Know the Android User Interface

View And ViewGroup

What You Will Learn In This Chapter The various ViewGroups you can use to layout your views How to adapt and manage changes in screen orientation How to create the UI programmatically How to listen for UI notifications In this chapter, you learn the details about creating user interface in Android, and how users interact with them. In addition, you will learn how to handle changes in screen orientation on your on your Android devices. Understanding The Components Of A

Continue Reading

Passing Data Between Activities

Passing Data Between Activities

Moving From One Activity to Another Activity Start Another Activity You can start another activity within the same application by calling startActivity(), passing it an Intent that describes the activity “class name” you want to start. An intent contains the action and optionally additional data. The data can be passed to other activity using intent putExtra() method. Intent intent = new Intent(MainActivity.this, SecondActivity.class); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); The complete sendMessage() method. /** Called when the user clicks the Send button */ public void

Continue Reading

Moving From One Activity To Another Activity

Starting Another Activity

Starting Another Activity In this tutorial I will be discussing about switching between one activity to another activities. First Method :- In Android Studio, from the res/layout directory, edit the content_my.xml file. Add the android:id="@+id/button" attribute to the <Button> element. <Button     android:id="@+id/button" android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/button_send" /> In the java/akraj.snow.test directory, open the MainActivity.java file. add the <Button> method, use findViewById() to get the Button element. Button button = (Button) findViewById(R.id.button); Add OnClickListener method. button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); Second

Continue Reading

Adding Action Buttons In Toolbar

Action Buttons In Toolbar

Now we need to add some action buttons in Toolbar, Let’s open menu_main.xml located under res ⇒ menu and add the search menu item as mentioned below. <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="akraj.snow.test.MainActivity"> <!-- Search --> <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" app:showAsAction="ifRoom"/> <!-- Settings, should always be in the overflow --> <item android:id="@+id/action_settings" android:title="@string/action_settings" app:showAsAction="never"/> </menu> The app:showAsAction attribute specifies whether the action should be shown as a button on the app bar. ifRoom The action is displayed as a button if there is room

Continue Reading

Sliding Sidebar

Subscribe For Latest Updates

Subscribe to our newsletter to get the latest scoop right to your inbox.