我有这个:
<h4 class="modal-title" id="exampleModalLabel"> hello </h4>
Run Code Online (Sandbox Code Playgroud)
并且我想使用它提取问候词并将其id分配给php var,但我不知道。如果是输入,会更容易,但是我必须使用其他元素。
我具有以下函数,可向我返回设备的当前位置:
void getCurrentLocation()
{
Location myLocation = map.getMyLocation();
if(myLocation!=null)
{
double dLatitude = myLocation.getLatitude();
double dLongitude = myLocation.getLongitude();
map.addMarker(new MarkerOptions().position(new LatLng(dLatitude, dLongitude))
.title("My Location").icon(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(dLatitude, dLongitude), 8));
}
else
{
Toast.makeText(this, "Unable to fetch the current location", Toast.LENGTH_SHORT).show();
}
}
Run Code Online (Sandbox Code Playgroud)
如您所见,这些方法与map有关,可以在onMapReady()函数中使用,但无法显示它。这是为什么?我必须添加哪些库?我这样声明地图:
private MapFragment map;
Run Code Online (Sandbox Code Playgroud) 我正在尝试索引很多记录,但是在索引publish_up字段时遇到了一些麻烦。默认情况下,我将该字段映射为日期和格式,但出现此错误:
错误:400 {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"未能解析 [date]"} 类型的字段 [publish_up]],"type":"mapper_parsing_exception ","reason":"无法解析 [date] 类型的字段 [publish_up]","caused_by":{"type":"illegal_argument_exception","reason":"无效格式:\"2015-02-11 00 :00:00\" 格式错误于 \" 00:00:00\""}},"status":400}
这是我配置索引的方式:
$params = [
'index' => 'attachments',
'body' => [
'settings' => [
'number_of_shards' => 1,
'analysis' => [
'analyzer' => [
'custom_analizer_texto_sub' => [
'type' => 'custom',
'tokenizer' => 'keyword',
'filter' => ['lowercase']
]
]
]
],
'mappings' => [
'article' => [
'_source' => [
'enabled' => true
],
'properties' => [
'iddoc' => [ 'type' => 'integer'],
'publish_up' => [ …Run Code Online (Sandbox Code Playgroud) 我找到了一些方法来做到这一点,但已被弃用或无效.我想从设备获得当前的经度和经度.
以下是我获取当前位置的getMyLocation()方法,但不推荐使用 GoogleMap 方法:
void getCurrentLocation()
{
Location myLocation = map.getMyLocation();
if(myLocation!=null)
{
double dLatitude = myLocation.getLatitude();
double dLongitude = myLocation.getLongitude();
map.addMarker(new MarkerOptions().position(new LatLng(dLatitude, dLongitude))
.title("My Location").icon(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(dLatitude, dLongitude), 8));
}
else
{
Toast.makeText(this, "Unable to fetch the current location", Toast.LENGTH_SHORT).show();
}
}
Run Code Online (Sandbox Code Playgroud)