Mobile Development Articles

Page 91 of 156

How to change font color of textView in android?

Azhar
Azhar
Updated on 02-Aug-2019 5K+ Views

This example demonstrates how do I change font color of TextView 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.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       TextView textView1 = findViewById(R.id.textView1);       textView1.setTextColor(Color.BLUE); ...

Read More

How to change the font size of textView in android?

Azhar
Azhar
Updated on 02-Aug-2019 16K+ Views

This example demonstrates how do I change the font size of TextView 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; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    } }Step 4 − Add the following code to androidManifest.xml ...

Read More

How to change font Family of textView In Android?

Azhar
Azhar
Updated on 02-Aug-2019 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.        

Read More

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

Azhar
Azhar
Updated on 02-Aug-2019 4K+ 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
Azhar
Updated on 02-Aug-2019 6K+ 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
Azhar
Updated on 02-Aug-2019 1K+ 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 detect user pressing Home Key in an Activity on Android?

Azhar
Azhar
Updated on 02-Aug-2019 629 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
Azhar
Updated on 02-Aug-2019 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
Azhar
Updated on 02-Aug-2019 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
Azhar
Updated on 02-Aug-2019 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
Showing 901–910 of 1,551 articles
« Prev 1 89 90 91 92 93 156 Next »
Advertisements