java - If statement trouble on static variable -
this question has answer here:
- how compare strings in java? 23 answers
guys i'm working on android , , have static variable , lets "var" , if it's null if statement executed or else executed , thing , after "var" not null , if restart tab works expected , enlighten me .
**protected static string ipath="" , ipath1;** protected onclicklistener selimg = new onclicklistener() // first image { @override public void onclick(view vw) { // todo auto-generated method stub intent = new intent( intent.action_pick, android.provider.mediastore.images.media.internal_content_uri); startactivityforresult(i, result_load_image); } }; protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (requestcode == result_load_image && resultcode == result_ok && null != data) { uri selectedimage = data.getdata(); string[] filepathcolumn = { mediastore.images.media.data }; cursor cursor = getcontentresolver().query(selectedimage, filepathcolumn, null, null, null); cursor.movetofirst(); int columnindex = cursor.getcolumnindex(filepathcolumn[0]); string picturepath = cursor.getstring(columnindex); cursor.close(); imageview imageview = (imageview) findviewbyid(r.id.imageview1); imageview imageview1 = (imageview) findviewbyid(r.id.imageview2); **if(ipath == "") { ipath=picturepath; imageview.setimagebitmap(bitmapfactory.decodefile(picturepath)); } else { ipath1=picturepath; imageview1.setimagebitmap(bitmapfactory.decodefile(picturepath)); }** } }
change if(ipath == "")
if(ipath.isempty())
or can change if(ipath.equals(""))
, suggest reading this
Comments
Post a Comment