Monday, 7 January 2013

Check Special Character Exist,Is Null,Is empty in android


Here Are Some Function for validation


if value has any special character in that function return value "true" otherwise "false"

       public booleanHasSpecialCharacter(String value)

       {
              for (int i = 0; i < value.length(); i++) {
                     if (!Character.isLetterOrDigit(value.charAt(i)))
                           return true;
              }
              return false;
       }


==============================================
if value has NULL function return value "true" otherwise "false"


        public boolean IsNull(Object value) {
         if (value != null)
          return true;

         return false;
        }



Note:- You can pass any object in this function (eg. TextView,EditText,....)
===================================================
if value has no data & null value in that  function return value "true" otherwise "false"

        public static boolean IsEmpty(String value)

        {
         if (IsNull(value)) {
          return true;
         } else {
          if (value.trim().length() <= 0) {
           return true;
          }
         }
         return false;
        }


3 comments:

  1. Hello Sunil Suthar,
    Sneha Here. I am also Android Developer. I am stuck on one point in my project.

    I want to apply Liquify Effect ( Wrapping ) on image into imageview. For that i have done get image
    using bitmap and set it into image view.

    Now image is just displayed not wrapping when i touch on it.

    If i am not using imageview then its working fine but with imageview its not working.

    Can you please help me with Demo App ASAP Please?

    ReplyDelete
  2. Hello Sunil Suthar,

    You can see demo for above query from following link.
    Link: ...\sdk\samples\android-17\ApiDemos\src\com\example\android\apis\graphics\BitmapMesh.java

    In this link imageview is not available.

    Please reply me asap.

    Thanks in Advance

    ReplyDelete
  3. hi was just seeing if you minded a comment. i like your website and the thme you picked is super. I will be back. ecommerce development salt lake city

    ReplyDelete

Call web services easily

get source code from here, Download