Found 1631 Articles for Android

How to change font Family of textView In Android?

Azhar
Updated on 02-Aug-2019 08:55:34

2K+ Views

This example demonstrates how do I change the font family of textView in AndroidStep 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.        

How to click camera programmatically in android?

Azhar
Updated on 02-Aug-2019 08:50:38

684 Views

This example demonstrates how do I click camera 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.ContentValues; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.provider.MediaStore; import android.support.annotation.NonNull; 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; public class MainActivity extends AppCompatActivity {    private static final int PERMISSION_CODE = ... Read More

How to send an email with a file attachment in Android?

Azhar
Updated on 02-Aug-2019 08:35:59

3K+ Views

This example demonstrates how do I send an email with a file attachment 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.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity {    EditText etEmail; ... Read More

How to make a specific text on TextView bold in Android?

Azhar
Updated on 02-Aug-2019 08:24:31

5K+ Views

This example demonstrates how do I make a specific text on TextView bold 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.graphics.Typeface; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.SpannableString; import android.text.Spanned; import android.text.style.StyleSpan; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView textView;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);     ... Read More

How can I generate random number in a given range in Android?

Azhar
Updated on 02-Aug-2019 08:19:13

963 Views

This example demonstrates how do I generate random number in a given range 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.javaimport android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.util.Random; public class MainActivity extends AppCompatActivity {    EditText et_min, et_max;    Button btn_generate;    TextView tv_output;    Random r;    int ... Read More

How to use ArrayAdapter in android to create simple ListView?

Azhar
Updated on 02-Aug-2019 08:13:25

548 Views

This example demonstrates how do I detect user pressing home key in an activity 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.javaimport android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends AppCompatActivity {    ListView simpleList;    String playersList[] = {"Ronaldo", "Messi", "Neymar", "Isco", "Hazard"};    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);     ... Read More

How to detect user pressing Home Key in an Activity on Android?

Azhar
Updated on 02-Aug-2019 08:08:34

421 Views

This example demonstrates how do I detect user pressing home key in an activity 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.javaimport android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    TextView textView;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       textView = ... Read More

How to close all activities at once in android?

Azhar
Updated on 02-Aug-2019 08:03:06

2K+ Views

This example demonstrates how do I close all activities at once in 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.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity {    Button button;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       button = ... Read More

How to pick an image from image gallery in Android?

Azhar
Updated on 02-Aug-2019 07:56:39

4K+ Views

This example demonstrates how do I pick an image from image gallery in android appStep 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.content.Intent; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends Activity {    ImageView imageView;    Button button;    private static final int PICK_IMAGE = 100;    Uri imageUri; ... Read More

How to create a scrollable textView Android app?

Azhar
Updated on 02-Aug-2019 07:48:11

2K+ Views

This example demonstrates how do I create a scrollable textView in 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 app.com.sample; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.method.ScrollingMovementMethod; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       TextView textView = (TextView) findViewById(R.id.textView);       ... Read More

Advertisements