当我们为Google Maps Direction Api 设置Key限制为NONE时,它运行正常.
但是当我们为Android应用程序设置密钥限制并提供正确的软件包名称和SHA-1证书时 - 它表示请求已从Google Api响应中拒绝.
任何已知的解决方案?
android google-maps google-maps-api-2 google-maps-android-api-2 google-maps-direction-api
我正在为GoogleMaps V2创建MarkerDemo的自定义实现.我有一个奇怪的错误,我将LatLng值提供给LatLngBounds.Builder实例,然后将其作为变量传递给.build.当我通过Eclipse在调试模式下运行应用程序时,Map会加载.当我通过Eclipse正常运行时,会抛出一个带有"no included points"的IllegalStateException作为消息.有人可以帮忙吗?
这是一些协助的代码.
public class MyActivity extends android.support.v4.app.FragmentActivity
implements OnMarkerClickListener, OnInfoWindowClickListener,
OnMarkerDragListener {
private HashMap<DataItem, ArrayList<DataItem>> mUserLocations = new
HashMap<DataItem, ArrayList<DataItem>>();
private ArrayList<DataItem> mFeedData;
private NetworkingHandler mHandler = new NetworkingHandler("tag");
private GoogleMap mMap;
private final String DOWNLOAD_USER_LOCATIONS_URL =
"http://www.myfeedurllocation.com/page.php";
@Override
public void onCreate(Bundle savedBundleInstance) {
super.onCreate(savedBundleInstance);
setContentView(R.layout.activity_myactivitylayout);
downloadUserLocations();
setUpMapIfNeeded();
}
@Override
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
}
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the
// map. …Run Code Online (Sandbox Code Playgroud) java android android-sdk-2.3 illegalstateexception google-maps-android-api-2
这是我的代码:
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for(int x = firstVisibleItem; x < lastVisibleItem; x++){
builder.include(temp.getPosition());
}
Run Code Online (Sandbox Code Playgroud)
但是这行引发了一个错误(java.lang.IllegalStateException: no included points
:
double north = builder.build().northeast.latitude;
Run Code Online (Sandbox Code Playgroud)
这是因为上面的循环根本没有运行所以没有包括在内builder.
如何检查构建器是否至少有一个点?
我尝试过builder.build()!=null抛出上面的错误,builder!=null并且始终为True.
try{}catch(IllegalStateException e){ } 作品.问一个!=null方法是愚蠢的吗?美高科技管理?谢谢