How to Check if String Array Contains a Specific String in Android

Here is how to get a specific value or String from Array in Android

To check if a string array contains a specific string, you can use this code, this is a simple code and very useful

First, let’s create a string array

String[] myStrings={

So we created a string array called “myStrings”. Now let’s find if we can get a specific string from it.

 if (Arrays.asList(myString).contains("beeran")){
 Toast.makeText(mContext, "succcess", Toast.LENGTH_SHORT).show();
Toast.makeText(mContext, "fail", Toast.LENGTH_SHORT).show();

This is it.

If you need any help related to android development, create android apps, fix issues in your android projects etc, you can contact me

Related Posts

How to Export Project Zip from Android Studio

How to Export Source Code ZIP in Android Studio Sometimes, you will need export the source code of your android studio app project, to share it with…

Fix Plugin [id: ‘’, version: ‘7.1.3’, apply: false] was not found in any of the following sources

Here is how to fix Plugin [id: ‘’, version: ‘7.1.3’, apply: false] was not found in any of the following sources This error is caused by mismatching…

Get Age from Date of Birth in Java Android

Here is how to get a user’s age from date of birth If you need get a user’s age from a given date of birth string, this…

Make Android WebView Support Razorpay Payment

How to Support Razorpay Payment and UPI in Android WebView? Android webview is inexpensive and easy way to make apps for websites. But to support some specific…

Make Android Webview Support PayTM Google Pay PhonePe UPI

GooglePay, Phonpe and PayTM support in Android WebView If you have built an android app for your new ecommerce website or any other website that needs accept…

Leave a Reply

Your email address will not be published. Required fields are marked *