Found 1966 Articles for Apps/Applications

How to use SearchView in Toolbar Android?

Azhar
Updated on 01-Jul-2020 06:00:38

2K+ Views

This example demonstrates how do I use searchView in Toolbar 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.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.SearchView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    Toolbar toolbar;    ArrayAdapter adapter;    ListView listView;    TextView emptyView; ... Read More

How to play audio file from the assets directory in Android?

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

2K+ Views

This example demonstrates how do I play audio file from the assets directory 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 asset folder, Right click on the project → New → Folder → Asset Folder.Copy and paste the audio file into the assets folder.Step 4 − Add the following code to src/MainActivity.javaimport android.content.res.AssetFileDescriptor; import android.media.MediaPlayer; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; ... Read More

How to add shadow on a text in Android?

Azhar
Updated on 01-Jul-2020 06:05:41

163 Views

This example demonstrates how do I add shadow on a text 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 textView = findViewById(R.id.textView);       textView.setTextColor(Color.MAGENTA);     ... Read More

How to restart an Activity in Android?

Azhar
Updated on 01-Jul-2020 06:08:07

2K+ Views

This example demonstrates how do I restart an Activity 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.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.util.Random; public class MainActivity extends AppCompatActivity {    TextView textView;    Button button;    Random random = new Random();    @Override    protected void onCreate(Bundle savedInstanceState) {       ... Read More

How to use viewFlipper in Android?

Azhar
Updated on 01-Jul-2020 06:09:31

565 Views

This example demonstrates how do I use viewFlipper 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.Gravity; import android.view.View; import android.widget.TextView; import android.widget.ViewFlipper; public class MainActivity extends AppCompatActivity {    private ViewFlipper viewFlipper;    @Override    protected void onCreate(Bundle savedInstanceState) {     ... Read More

How to use SearchView in Android?

Azhar
Updated on 01-Jul-2020 06:10:17

2K+ Views

This example demonstrates how do I use SearchView 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 projectStep 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; import android.widget.SearchView; import android.widget.Toast; import java.util.ArrayList; public class MainActivity extends AppCompatActivity {    SearchView searchView;    ListView listView;    ArrayList list;    ArrayAdapter adapter;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState); ... Read More

How to use Radio button in Android?

Azhar
Updated on 05-Aug-2019 10:45:02

2K+ Views

This example demonstrates how do I use Radio button 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.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    RadioGroup radioGroup;    RadioButton radioButton;    Button button;    @Override    protected void onCreate(Bundle savedInstanceState) { ... Read More

How can I set a Border for an ImageView in Android?

Azhar
Updated on 05-Aug-2019 10:32:52

3K+ Views

This example demonstrates how do I can I set a border for an ImageView 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 projectStep 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 − Create a layout from in res/layout and add the ... Read More

How do I create a listView with rounded corners in Android?

Azhar
Updated on 05-Aug-2019 10:29:11

649 Views

This example demonstrates how do I create a listView with rounded corners 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.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       ListView listView = findViewById(R.id.listView);       ... Read More

How to open a website in Android’s web browser from any application?

Azhar
Updated on 05-Aug-2019 10:22:30

1K+ Views

This example demonstrates how do I open a website in Android’s web browser from any application.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.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       Button button = ... Read More

Advertisements