创建Android的定位对象 [英] Creating Android Location Object
本文介绍了创建Android的定位对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我现在用的是地缘codeR类来获取通过以下code的多个位置的对象:
I am using the Geocoder class to fetch multiple location objects by using the following code:
Geocoder geocoder = new Geocoder(this, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 3);
Address[] addresses_array = new Address[addresses.size()];
addresses.toArray(addresses_array);
for( int i = 0; i < addresses_array.length; i++ ){
//create location object here
locOBJ.setLatitude(LATITUDE);
locOBJ.setLongitude(LONGITUDE);
}
此外,forloop里面,我想dymanically创建位置对象添加到一个数组;
In addition, inside the forloop, I am trying to dymanically create location objects to add to an array;
我怎样才能创建空白位置对象?
How can I create blank location objects ?
推荐答案
假设你指的 android.location.Location
用这需要一个提供字符串的构造函数,并将其设置到任何你想要的。
Assuming you refer to android.location.Location
use the constructor which takes a provider string and set it to whatever you want.
这篇关于创建Android的定位对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文