Found 2041 Articles for Mobile Development

How to make a smooth image rotation in Android?

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

991 Views

This example demonstrates how to make a smooth image rotation 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 taken a text view and image view. When you click on text view, Image will get rotate in anti clock direction.Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.animation.Animation; import android.view.animation.LinearInterpolator; ... Read More

How to get battery level and state in Android?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

1K+ Views

This example demonstrates how to get battery level and state 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 taken a text view. it contains battery percentage.Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.BatteryManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    int view = R.layout.activity_main;    TextView text;    @RequiresApi(api = ... Read More

How to Counting Chars in EditText Changed Listener in Android?

Chandu yadav
Updated on 30-Jul-2019 22:30:24

754 Views

Some situations, we have to restrict an edit text for some characters. To solve this situation, in this example demonstrate how to Counting Chars in Edit Text Changed 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 taken one edit text. It going to check the length of the entered characters, if it exceeds 5 then it shows an error message.Step 3 - Add the following ... Read More

How to check if android application is running background?

George John
Updated on 30-Jul-2019 22:30:24

2K+ Views

There are so many situations, that we should find android application is running background or not. This example demonstrates how to check if an android application is running background.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 layout, it contains text view, when the application is in foreground mode, it shows text view else you will get information in a log.Step 3 - Add the following code to src/MainActivity.javapackage ... Read More

How to change position of Toast in Android?

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

2K+ Views

Before getting into an example, we should know what is toast in android. Toast is subclass for  java.lang.Object and used to show a short message for a short period of time after that is going to disappear.This example demonstrates how to change the position of Toast 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 taken a text view. when the user clicks on text ... Read More

How do I make a dotted/dashed line in Android?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

2K+ Views

This example demonstrates how do I make a dotted/dashed line 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 text view with image view. Image view contains a dotted background. So create dotted.xml in drawable as shown below -             Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import ... Read More

Can an Android Toast be longer than Toast.LENGTH_LONG?

Chandu yadav
Updated on 30-Jul-2019 22:30:24

136 Views

Sometimes we need to display more time then LENGTH_LONG. This example demonstrates how to show toast longer than Toast.LENGTH_LONG.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 taken a text view. when a user clicks on text view, it will show toast for 1000 ms.Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.Gravity; ... Read More

How to remove border in navigationBar in swift?

karthikeya Boyini
Updated on 30-Jun-2020 06:01:47

2K+ Views

To remove the border from a navigation bar in swift, we just need to add a few lines of code. Let’s see how the navigation bar looks when we run it without changing anything.Now let’s try to hide the line/ border shown in the above result.The navigation bar has two things that give it the default view of a grey shadow along with bottom line as shown above. One is the background image, and the other is the shadow image.First, we’ll hide the shadow image, by setting it to empty image and see how it looks.In your viewDidLoad add the ... Read More

How to detect swipe vertically on a ScrollView using Swift?

Samual Sam
Updated on 30-Jul-2019 22:30:24

600 Views

To detect swipe in scrollView we will need to make use of some tricks as scroll view does not natively give the directions of scroll made on it. We’ll see this with help of an example.Create an empty project, add scroll view to the view as per your requirement.Give them constraint as required in the application.From the object library, drag and drop a swipe gesture recognizer right above the Scroll View.Select the gesture recognizer, go to its attribute inspector and from there, select the swipe option and set the value as “up”.When you do this, now your gesture recognizer can ... Read More

How to add a Submit button after the end of the tableview using Swift?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

1K+ Views

To add a submit button at the end of a table view, we can make use of table view footers. Let’s see this with help of an example where we’ll add a footer view to our table, and inside the table, we will add code for adding button at the bottom of the table view.Create a new project first, then inside the view controller add the following code which will initialize the table, add a section and a few rows to the table.func initTableView() {    let tableView = UITableView()    tableView.frame = self.view.frame    tableView.dataSource = self    tableView.delegate ... Read More

Advertisements