android - Convert String to Boolean and insert in external database via `BasicNameValuePair` -


i need insert spinner selected users external database has column datatype of bit believe boolean.

i'm taking spinner user selection string converting boolean below spinner contains yes or n/a. however, researched , found out string "yes" returns boolean value of false therefore converted true first , boolean below:

spinnertext1 = spinner.getselecteditem().tostring();         if (spinnertext1.equals("yes"))         {             string convspinnertext1 = "true";               spinnerboo1 = boolean.parseboolean(convspinnertext1);         }         if(spinnertext1.equals("n/a"))         {             spinnerboo1 = boolean.parseboolean(spinnertext1);         } 

inserting boolean value in basicnamevaluepair accept strings in it:

list<namevaluepair> params = new arraylist<namevaluepair>();         params.add(new basicnamevaluepair("orders_certs_gas_svc_rec_fl_atms_fan_assst_fan_diltn_chk",string.valueof(spinnerboo1))); 

but it's not working. can please tell going wrong ? appreciated.

spinnertext1 = spinner.getselecteditem().tostring();     if (spinnertext1.equals("yes"))        spinnerboo1 = true;    if(spinnertext1.equals("n/a"))        spinnerboo1 = false; 

you cant convert string boolean.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -