Found 1966 Articles for Apps/Applications

How to work with Camera in an Android App?

Azhar
Updated on 03-Jul-2020 06:39:09

304 Views

This example demonstrates how to work with Camera 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.javapackage com.example.myapplication; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends AppCompatActivity {    private static final int CAMERA_REQUEST=1888;    ImageView imageView;    @Override   ... Read More

How to get the device’s IMEI/ESN number programmatically in android?

Azhar
Updated on 03-Jul-2020 06:41:27

3K+ Views

This example demonstrates how do I get the device’s IMEI/ESN number programmatically 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.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.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    Button button;    TextView textView;    String IMEINumber;   ... Read More

How to create text file and insert data to that file on Android?

Azhar
Updated on 03-Jul-2020 06:40:02

7K+ Views

This example demonstrates how to create text file and insert data to that file on 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.javapackage com.example.sample; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import android.app.Activity; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    EditText ... Read More

How to use InputFilter to limit characters in an editText in Android?

Azhar
Updated on 03-Jul-2020 06:42:29

1K+ Views

This example demonstrates how do I use inputfilter to limit characters in an editText 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.text.InputFilter; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    EditText editText;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       editText = ... Read More

Add and Remove Views in Android Dynamically?

Azhar
Updated on 03-Jul-2020 06:43:35

3K+ Views

This example demonstrates how to Add and Remove Views in Android Dynamically.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 2 − Add the following code to res/layout/field.xml             Step 3 − Add the following code to res/values/strings.xml    Sample           Mobile       ... Read More

How to start service using Alarm Manager in android?

Azhar
Updated on 03-Jul-2020 06:44:23

1K+ Views

This example demonstrates how do I start a service using alarm manager 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.javapackage app.com.sample; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; import java.util.Calendar; public class MainActivity extends AppCompatActivity {    Button btnStart, btnStop;    PendingIntent pendingIntent;    @Override    protected void onCreate(Bundle savedInstanceState) ... Read More

How to put a ListView into a ScrollView without it collapsing on Android?

Azhar
Updated on 03-Jul-2020 06:47:44

2K+ Views

This example demonstrates how to put a ListView into a ScrollView without it collapsing on 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.javapackage com.example.sample; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends AppCompatActivity {    private String listview_array[]={ "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN" ... Read More

How to download and save an image from a given URL in android?

Azhar
Updated on 03-Jul-2020 06:48:26

3K+ Views

This example demonstrates how do I download and save an image from a given URL 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.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.support.design.widget.CoordinatorLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import ... Read More

How can I get android device screen height, width?

Azhar
Updated on 03-Jul-2020 06:49:03

1K+ Views

This example demonstrates how do I get android device screen height, width.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.util.DisplayMetrics; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView height, width, inches;    DisplayMetrics displayMetrics;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);     ... Read More

How do I load an ImageView by URL on Android?

Azhar
Updated on 03-Jul-2020 06:26:41

6K+ Views

This example demonstrates how to load an ImageView by URL 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.javapackage com.example.sample; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.ImageView; import android.widget.Toast; import java.io.InputStream; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);     ... Read More

Advertisements