java - always printing "println needs a message during " -
java - always printing "println needs a message during " -
public class info { private static string product; public static string getdata() { homecoming product; } public static void setdata(string data) { product = data; log.d("data", product.tostring()); } }
i getting object in below class:
public class contact_details_tab extends fragment { textview hostel_name; jsonobject product; @override public view oncreateview(layoutinflater inflater, viewgroup container,bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.contact_details_tab, container, false); hostel_name = (textview) rootview.findviewbyid(r.id.hostel_name); product = data.getdata(); seek { hostel_name.settext(product.getstring("h_name")); } grab (jsonexception e) { log.d("data", e.getmessage()); } homecoming rootview; } }
and when view log "println needs message"
, during info class result correctly when access string info got error
you not using log methods in recommended way, can lead failure of println() mechanism used in implementation when null argument passed log method gets passed through println().
normally, first argument, or tag should indicate name of component doing logging, illustration name of activity.
the sec argument should consist of string explaining logging, followed value itself.
the sound practice first declare tag component near start of class:
private static final string tag = "dataclass";
and log messages explanation
log.d(tag, "set info " + product);
this way, if product
null appending string, legitimate operation producing informative output.
java android android-layout static-methods
Comments
Post a Comment