首先建立一個(gè)activity,在里面輸出各種類(lèi)型的數(shù)據(jù)。為了測(cè)試Inner class和Object的效果,我專(zhuān)門(mén)建立了一個(gè)很簡(jiǎn)單的內(nèi)部類(lèi)User:
class User {
private String name;
private String sex;
User(String name, String sex) {
this.name = name;
this.sex = sex;
}
public void log() {
show();
}
private void show() {
L.d("user");
}
}
激動(dòng)人心的測(cè)試開(kāi)始了:
// string
String str = fromIntent("key");
L.d(str != null ? str : "hello world");
// json
L.json("[{\"CityId\":18,\"CityName\":\"西安\",\"ProvinceId\":27,\"CityOrder\":1},{\"CityId\":53,\"CityName\":\"廣州\",\"ProvinceId\":27,\"CityOrder\":1}]'");
// object
L.Object(new User("jack", "f"));
// list
L.Object(TestUtil.getLongStringList(this));
// array
L.Object(TestUtil.getShortStringArr());
// arrays
double[][] doubles = {
{1.2, 1.6, 1.7, 30, 33},
{1.2, 1.6, 1.7, 30, 33},
{1.2, 1.6, 1.7, 30, 33},
{1.2, 1.6, 1.7, 30, 33}
};
L.Object(doubles);
// sub class
new User("name", "sex").log();
更多建議: