Found 1631 Articles for Android

How to make surfaceview transparent in an Android App?

Azhar
Updated on 15-Nov-2019 11:28:08

698 Views

This example demonstrates how to make surfaceview transparent 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.app.sample; import androidx.appcompat.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 Manifests/AndroidManifest.xml     ... Read More

How to change colors of a Drawable in Android?

Azhar
Updated on 15-Nov-2019 11:24:26

2K+ Views

This example demonstrates how to change the colors of a Drawable 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.app.sample; import androidx.appcompat.app.AppCompatActivity; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; import android.widget.LinearLayout; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       LinearLayout your_Layout = (LinearLayout) findViewById(R.id.activity_main);       AnimationDrawable animationDrawable ... Read More

How to set Android Toast duration longer than Toast.LENGTH_LONG?

Azhar
Updated on 15-Nov-2019 11:11:12

902 Views

This example demonstrates how to set Android Toast duration longer than Toast.LENGTH_LONG.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.app.sample; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.os.CountDownTimer; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    }    private Toast mToastToShow;    public ... Read More

How to use Material Design components in an Android App?

Azhar
Updated on 15-Nov-2019 11:06:29

471 Views

This example demonstrates how to use Material Design components 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.app.sample; import androidx.appcompat.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 ... Read More

How to create transparent statusbar and ActionBar in Android?

Azhar
Updated on 15-Nov-2019 11:00:11

2K+ Views

This example demonstrates how to create a transparent statusbar and ActionBar 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.app.sample; import androidx.appcompat.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 res/values/styles.xml         ... Read More

How to filter a RecyclerView with a SearchView on Android?

Azhar
Updated on 15-Nov-2019 10:55:38

6K+ Views

This example demonstrates how to filter a RecyclerView with a SearchView 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.app.sample; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.inputmethod.EditorInfo; import android.widget.SearchView; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity {    private ExampleAdapter adapter;    private List exampleList;    @Override    protected void ... Read More

How do I change the background color of the ActionBar of an ActionBarActivity?

Azhar
Updated on 15-Nov-2019 10:43:40

894 Views

This example demonstrates how to change the background color of the ActionBar of an ActionBarActivityStep 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.app.sample; import androidx.appcompat.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 Manifests/AndroidManifest.xml ... Read More

How to change color and font of Android ListView?

Azhar
Updated on 15-Nov-2019 10:34:56

1K+ Views

This example demonstrates how to change the color and font of Android ListView.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.javaStep 4 − Add the following code to Manifests/AndroidManifest.xml                                                             ... Read More

How ListView's recycling mechanism works on Android?

Azhar
Updated on 15-Nov-2019 10:28:16

76 Views

This example demonstrates how ListView's recycling mechanism works 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 res/layout/card_row.xml.     Step 4 − Add the following code to src/MainActivity.javapackage com.app.sample; import android.os.Bundle; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity {    private ArrayList cities;    @Override ... Read More

How to answer in incoming call programmatically in Android?

Azhar
Updated on 15-Nov-2019 10:20:59

2K+ Views

This example demonstrates how to answer in incoming call 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.javapackage com.app.sample; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    }    public void acceptCall() {       ... Read More

Advertisements