android - passing null value as a parameter in java -
i have method insert datas sq-lite db
public long insertdetails(int id,string batchname,double weight, double yield) { contentvalues insertcontentvalues = assesmentinsertvalues(id,batchname,weight,yield); return this.data.insert("tb_labassessment", null, insertcontentvalues); }
from main class m passing values parameter above function, in cases want pass weight , yield null values.
string batchname; double weight; double yield; dbadapter.insertassesmentdetails(objclsproduct.getid(),batchname,weight,yield)
how can pass values of weight , yield null here.
you can't pass primitive null. there's 2 ways this- first make function take double- class version of double. other pass in unused value, such -1, mean null. requires there reasonable default value though.
Comments
Post a Comment