Found 1966 Articles for Apps/Applications

How to start an android application at boot time?

Azhar
Updated on 03-Jul-2020 09:00:11

3K+ Views

This example demonstrates how do I start an android application at boot time.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 Java class (StartAppOnBoot.java) and add the following code −import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class StartAppOnBoot extends BroadcastReceiver {    @Override    public void onReceive(Context context, Intent intent) {       if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {          Intent i = new Intent(context, ... Read More

How to get a list of installed android Applications?

Azhar
Updated on 07-Jul-2020 13:54:23

795 Views

This example demonstrates how do I get a list of installed android applications.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.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.List; public class MainActivity extends AppCompatActivity {    ListView listView;    ArrayAdapter arrayAdapter;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       ... Read More

How to obtain the phone number of the android phone programmatically?

Azhar
Updated on 03-Jul-2020 08:39:23

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

How to send an object one Android activity to another using Intents?

Azhar
Updated on 03-Jul-2020 08:40:13

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

How to get fling gesture detection working in an android app?

Azhar
Updated on 03-Jul-2020 08:40:51

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

How to write files to asset folder in android?

Azhar
Updated on 03-Jul-2020 08:41:35

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

How to pass a variable from Activity to Fragment in Android?

Azhar
Updated on 03-Jul-2020 08:42:40

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

How to get the Action bar height in android?

Azhar
Updated on 03-Jul-2020 08:44:49

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

How to generate Unique ID of device for iPhone/iPad using Swift?

Mohtashim M
Updated on 30-Aug-2019 11:44:07

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

How to add 1 day to a Date in iOS/iPhone?

Mohtashim M
Updated on 30-Aug-2019 11:40:21

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 ?? "")

Advertisements