Found 1957 Articles for Mobile Development

How does Constraint Layout works in android?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24
In simple words, constraint layout is an advanced version of a Relative layout. It is used to reduce the child view hierarchies and improve the performance.Properties of constraint layout as shown below -Wrap Content –It wrap the view size according to data. Any Size – This is very similar to match parent. Fixed Size – This allows standard height and width(fixed sizes). In the above example we have shown the button with all properties, now look into code level as shown below -In the above, we have declare layout margin-top, bottom, start and end. those are the standard distance (Similar ... Read More

How to use RatingBar in android?

Ankith Reddy
Updated on 30-Jul-2019 22:30:24
Before getting into an example, we should know what is rating bar in android. Rating bar is a subclass of absSeekbar class in android. It is used to show the rating on view Group or window manager.This example demonstrates how to use the rating bar in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         In the above code, we have declared Rating bar and set numStars as 5 means ... Read More

How to share app data with other applications in android?

George John
Updated on 30-Jul-2019 22:30:24
In android using implicit intent, we can send data with other applications using ACTION_SEND action. We have to call Intent.createChooser() to open default chooser of android mobile to send the data. it may same or different in Android mobiles.This example demonstrates how to share app data with other applications in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, it contains textview, when user clicks on text view ... Read More

How to make a countdown timer in Android?

Chandu yadav
Updated on 30-Jul-2019 22:30:24
Before getting into an example, we should know what is a countdown timer in android. Count down timer as simple as we see in watches and mobile phones. we can set count down time after completion of time it will stop and get 0 values.There are four methods are available to use countdown timer as shown below -onTick(long millisUntilFinished ) - In this method we have to pass countdown mill seconds after done countdown it will stop Ticking.onFinish() - After finish ticking, if you want to call any methods or callbacks we can do in onFinish().start() - It is used ... Read More

How to use View Stub in android?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24
Before getting into example, we should know what is view stub in android. It is a zero-sized lazy inflate view. it going to inflate at runtime. Using inflate() method, it going to inflate at runtime and append to window manager or view group. using setVisibility(int). we can show and hide view stub in android.This example demonstrates how to use view stub in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.       ... Read More

How to implement HorizontalScrollView like Gallery in Android?

Ankith Reddy
Updated on 30-Jul-2019 22:30:24
Before getting into an example, we should know what is Horizontal Scroll View. Horizontal Scrollview provides by android.widget.HorizontalScrollView class. It is used to scroll child views in a horizontal direction.This example demonstrates how to use horizontal Scroll view.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                                                       ... Read More

How can I make my layout scroll vertically in Android?

George John
Updated on 30-Jul-2019 22:30:24
Before getting into example, we should know what is vertical Scroll View(Scroll View). Vertical Scroll view provide by android.widget.ScrollView class. It is used to scroll child views in a vertical direction.This example demonstrates how to use Vertical Scroll view.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                                                     ... Read More

How to use android date change listener ?

Chandu yadav
Updated on 30-Jul-2019 22:30:24
Before getting into the example, we should know what is date picker and how does it work in android. The date picker is a subclass of frame layout and it allows to select the date, month and year.This example demonstrates how to use android date change listener.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have declare date picker to select the date. when you select the ... Read More

How to integrate Android Snackbar?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24
Snackbar is just like Toast in android but it going to interact with action. It going to show the message at the bottom of the screen without any interaction with other views and close automatically after a time-out.This example demonstrates how to integrate Android Snackbar.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Open build.gradle and add design support library dependency.apply plugin: 'com.android.application' android {    compileSdkVersion 28    defaultConfig {       applicationId "com.example.andy.myapplication"       minSdkVersion 19 ... Read More

Get current time and date on Android

Ankith Reddy
Updated on 30-Jun-2020 05:28:09
As per Oracle documentation, SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner. In this example, we have imported simple date format class from java as shown below -import java.text.SimpleDateFormat; import java.util.Date;Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have given text view, it going to print the current date on the window manager.Step 3 − Add the following code to ... Read More
Advertisements