0
我有如下一個GeoPoint數組列表:打印/調試的GeoPoint陣列
ArrayList<GeoPoint> listOfPoints = new ArrayList<GeoPoint>();
,我想將其打印出來,以檢查它正確包含我已經解析到它的點。 我只能找到如何打印非GeoPoint數組, 有什麼想法? 感謝
我有如下一個GeoPoint數組列表:打印/調試的GeoPoint陣列
ArrayList<GeoPoint> listOfPoints = new ArrayList<GeoPoint>();
,我想將其打印出來,以檢查它正確包含我已經解析到它的點。 我只能找到如何打印非GeoPoint數組, 有什麼想法? 感謝
要做到這一點,使用以下行:
System.out.println(array)
讓我們假設你已經插入值如下
ArrayList<GeoPoint> listOfPoints = new ArrayList<GeoPoint>();
Double latitude = Double.parseDouble("48.89364");
Double longitude = Double.parseDouble("2.33623");
GeoPoint oneP = new GeoPoint((int)(latitude*1e6),(int)(longitude*1e6));
listOfPoints.add(oneP);
...
,或者你把值從diferents Location
對象。
GeoPoint oneP = new GeoPoint((int) (loc.getLatitude() * 1e6), (int) (loc.getLongitude() * 1e6));
listOfPoints.add(oneP);
...
的方式進行迭代,並在日誌打印是:
for(GeoPoint gp:listOfPoints){
Log.w(this.getClass().getName()+", Latitude", String.valueOf(gp.getLatitudeE6()/1e6));
Log.w(this.getClass().getName()+", Longitude", String.valueOf(gp.getLongitudeE6()/1e6));
}
Log.w
是打印,使其作爲logcat的一個警告。
意味着你要登出把它 – 2013-04-09 11:33:48
我已經試過Log.i和log.println – user2076033 2013-04-09 11:40:32
System.pot.println( 「」 + LST ); – 2013-04-09 11:41:47