- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2041 Articles for Mobile Development
653 Views
This example demonstrates how do I obtain the phone number of the android phone programmatically.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. Step 3 − Add the following code to src/MainActivity.javaimport android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.telephony.TelephonyManager; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { TextView textView; private static final int REQUEST_CODE = 101; @Override protected ... Read More
187 Views
This example demonstrates how do I send an object from one android activity to another using intents.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. Step 3 – Create an object from a java class (Message.java)import java.io.Serializable; public class Message implements Serializable { private static final long serialVersionUID = 1L; private String message; public String getMessage(){ return message; } public void setMessage(String ... Read More
645 Views
This example demonstrates how do I get fling gesture detection working in an android app.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. Step 3 − Add the following code to src/MainActivity.javaimport android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.GestureDetector; import android.view.MotionEvent; import android.widget.Toast; public class MainActivity extends AppCompatActivity { GestureDetector gestureDetector; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); gestureDetector = new ... Read More
3K+ Views
This example demonstrates how do I write files to asset folder 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. Step 3 – Create a new Assets folder and write a new text file in it.To write a text file, Right click, select New >> file (Quote.txt)Step 4 − Add the following code to src/MainActivity.javaimport android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.io.IOException; import java.io.InputStream; public ... Read More
3K+ Views
This example demonstrates how do I pass a variable from activity to Fragment 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. Step 3 − Add the following code to src/MainActivity.javaimport android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity { EditText editText; Button button; @Override protected void onCreate(Bundle savedInstanceState) { ... Read More
1K+ Views
This example demonstrates how do I get the action bar height 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. Step 3 − Add the following code to src/MainActivity.javaimport android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.support.v7.widget.Toolbar; public class MainActivity extends AppCompatActivity { Toolbar toolbar; Button button; TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { ... Read More
1K+ Views
UDID(Unique Device Identifier) − A sequence of 40 hexadecimal characters that uniquely identify an iOS device.Since from iOS 5, Apple has deprecated the UIDevice unique identifier, that means the traditional way of getting the unique id. Apple removed the truly unique identifier and introduced an identifier for each vendor i.e UUID that's the same for all apps for a given developer for each user, but varies between developers and between devices.Apple has defined an instance property identifier for the vendor, which is an alphanumeric string that uniquely identifies a device to the app’s vendor.You can read more about it here: ... Read More
129 Views
A Date value encapsulates a single point in time, independent of any particular calendrical system or time zone. Date values represent a time interval relative to an absolute reference date.Here we will be seeing how to add 1 day to date,For this, we will be using Playground, Copy the below code in Playground,let date = Date() let addedDate = Calendar.current.date(byAdding: .day, value: 1, to: date) print(addedDate ?? "")
2K+ Views
A picker view displays one or more wheels that the user manipulates to select items. Each wheel—known as a component—has a series of indexed rows representing the selectable items.UIPicker is one of the important components and almost used in most of the applications. You’ll see them mostly in form-based applications.You can read more about it here: https://developer.apple.com/documentation/uikit/uipickerviewIn this post, we will be seeing how to create UIPicker programmatically from and array and load array values into it.So let’s get started, Step 1 − Open Xcode and create a single view application and name it PickerSample.Step 2 − Open ViewController.swift, Since ... Read More
2K+ Views
Understanding and implementing UIAlert can be tricky especially if you’re new to iOS Development, In this post, we will be seeing how we can dismiss the alert when the user taps outside the alert box.For this demo, we will be using UIAlert class, to configure alerts and action sheets with the message that you want to display and the actions from which to choose. After configuring the alert controller with the actions and style you want, present it using the present(_:animated: completion:) method. UIKit displays alerts and action sheets modally over your app's content.You can read more about it: https://developer.apple.com/documentation/uikit/uialertcontrollerSo ... Read More