Found 1631 Articles for Android

How to add a button to PreferenceScreen in Android?

Azhar
Updated on 07-Jul-2020 09:14:41

1K+ Views

This example demonstrates how do I add a button to PreferenceScreen in android.Step 1 − Create a new project in Android Studio, go to File rArr; 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.widget.Toast; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.main_activity);       getSupportFragmentManager().beginTransaction().replace(R.id.settings, new SettingsFragment()).commit();       ... Read More

Work with google docs offline using android

Samual Sam
Updated on 23-Oct-2019 06:33:14

107 Views

In many places; airplane, café, ships, etc…. you don’t get proper internet connection, but for many people work become necessary wherever they are. Google Docs helps those kinds of people through Offline mode feature. Using Google Drive, you can edit documents, spreadsheets, and presentations offline, you can access files on your mobile devices and whenever you come back online, your changes on the Docs will be synced to the cloud.Before using Google Docs offline, the question comes in mind that how do we implement this?It is very simple, just install Google Docs and Google Sheets on your Android device and ... Read More

How to upgrade your smartphone to android m

Samual Sam
Updated on 13-May-2022 07:21:27

74 Views

The latest version of Android, Android Marshmallow, is often referred to as Android M. Android M comes with a lot of new cosmetic upgrades for the phones along with many bug fixes. Android M comes with new features like refined permissions, simplified volume controls, improved copy and paste function, Google Now on Tap, and Android Pay.Not only that, it also has an built-in fingerprint scanning support and many other new enhancements which makes it a highly desired smartphone OS in 2016. Android M, being the desired smartphone OS used by the majority of the community, is almost a must-have for ... Read More

How do you animate the change of background color of a view on Android?

Azhar
Updated on 03-Jul-2020 13:22:59

1K+ Views

This example demonstrates how do I animate the change of background color of a View 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 androidx.appcompat.app.AppCompatActivity; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.TransitionDrawable; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView textView;    Button button;    @Override    protected void onCreate(Bundle savedInstanceState) {   ... Read More

How to change font face of Webview in Android?

Azhar
Updated on 03-Jul-2020 13:22:13

1K+ Views

This example demonstrates how do I change font face of WebView 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 an assets folder. Right click asset folder >> Create a new file (webView1.html) and the following code: WebView9    @font-face {       font-family: 'Font';       src:url("file:///android_asset/Font.otf")    }    body {       font-family: 'Font', serif;       ... Read More

Subscript and SuperScript a string in Android?

Azhar
Updated on 03-Jul-2020 13:24:32

895 Views

This example demonstrates how do I Subscript and SuperScript a string 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 androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.style.RelativeSizeSpan; import android.text.style.SubscriptSpan; import android.text.style.SuperscriptSpan; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView textView;    String strText;    SpannableStringBuilder spannableStringBuilder;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState); ... Read More

Working with Recycler View in Android App

Azhar
Updated on 03-Jul-2020 13:23:47

518 Views

This example demonstrates about Working with Recycler View 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.javapackage app.com.sample; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity {    private List movieList = new ArrayList();    private MoviesAdapter mAdapter;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState); ... Read More

Sending an Intent to browser to open specific URL in Android?

Azhar
Updated on 03-Jul-2020 13:25:15

5K+ Views

This example demonstrates how do I send an Intent to browser to open specific 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 androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    }    public void GetUrlFromIntent(View view) ... Read More

How can I save a HashMap to Shared Preferences in Android?

Azhar
Updated on 03-Jul-2020 13:25:51

1K+ Views

This example demonstrates about How can I save a HashMap to Shared Preferences 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.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import org.json.JSONObject; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Objects; public class MainActivity extends AppCompatActivity {    final String ... Read More

Create Left to Right slide animation in Android?

Azhar
Updated on 03-Jul-2020 13:16:09

2K+ Views

This example demonstrates how do I create left to right side animation 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 androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.transition.Slide; import android.transition.TransitionManager; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    Button btnSlideLeft, btnSlideRight;    TextView textView, textView1;    RelativeLayout relativeLayout;   ... Read More

Advertisements