- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试学习 geofire 我尝试实现 SFVehicle 应用程序,但它显示错误,你能帮忙吗这是我项目的关键部分
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private static final GeoLocation INITIAL_CENTER = new GeoLocation(37.7789, -122.4017);
private static final int INITIAL_ZOOM_LEVEL = 14;
private static String GEO_FIRE_DB = "https://learngoef.firebaseio.com";
private static String GEO_FIRE_REF = GEO_FIRE_DB+ "/_geofire";
private Circle searchCircle;
private GeoFire geoFire;
private GeoQuery mGeoQuery;
private Map<String,Marker> markers;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
FirebaseDatabase database = FirebaseDatabase.getInstance();
geoFire = new GeoFire(database.getReference().child("geofire_location"));
String key = geoFire.getDatabaseReference().push().getKey();
geoFire.setLocation(key,new GeoLocation(37.7789, -122.4017));
}
这是我遇到的错误:
java.lang.NoSuchMethodError: No virtual method setValue(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/firebase/tasks/Task; in class Lcom/google/firebase/database/DatabaseReference; or its super classes (declaration of 'com.google.firebase.database.DatabaseReference' appears in /data/app/com.myapps.learninggeofire-2/split_lib_dependencies_apk.apk)
最佳答案
如果你在它的参数中添加一个监听器就可以正常工作。作为
geoFire = new GeoFire(database.getReference().child("geofire_location"));
String key = geoFire.getDatabaseReference().push().getKey();
geoFire.setLocation(key,new GeoLocation(37.7789, -122.4017)),new
GeoFire.CompletionListener(){
@Override
public void onComplete(String key, DatabaseError error) {
//Do some stuff if you want to
}
});
我想这可能对你有帮助。
关于java - setLocation 的 Geofire 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48930447/
阅读了一些内容,但我正在努力解决这个问题。基本上,必须将 Setlocal 与启用和禁用延迟扩展一起使用才能使用和操作带有感叹号的变量。以下代码示例。代码部分可以在一个 session 中循环多次,在
是否可以在浏览器不刷新页面的情况下更改位置 url? 想象一下,我希望用户更改某些字段的某些值,因此要更新的是url(问号后面) 所以 www.mysite.com/mypage?level=1&fa
我正处于创建运算符(operator)工/客户系统的程序的开始阶段,现在我刚刚创建了登录 GUI,但我在使用 setLocation(); 方法。我将它设置为 250、250,但它使我的 GUI 的高
对于批处理新手而言,“变量延迟”这个概念很可能闻所未闻,但是,它却像一堵横亘在你前进道路上的无形高墙,你感受不到它的存在,但当你试图往前冲时,它会把你狠狠地弹回来,让你无法逾越、无功而返;而一旦找到
我正在尝试在批处理脚本中一起使用setlocal enabledelayedexpansion和cd,这似乎无法将更改持久化回shell。 我需要setlocal enabledelayedexpan
你怎么用setlocal在批处理文件中?我只是在学习脚本,并希望用非常简单的术语向我解释。 我有一个脚本停止并说 c:\superapp.out endlocal start notepad c:\s
这个问题已经有答案了: how to draw multiple rectangles (1 个回答) 已关闭 6 年前。 目前,此代码段通过鼠标单击移动已在框架上绘制的当前矩形。该点击的坐标转到变量
我有以下代码,我尝试将 JLabel 放置在 JFrame 上的自定义位置。 public class GUI extends JFrame { /** * * @para
使用 SSCCE 和变通方法编辑 我想以编程方式更改 JDialog 的位置。 public class SSCCE { public static void main(String[] pArg
我是 Java 新手。我正在尝试移动当前居中的 JButton,因此我将位置更改为静态位置但它没有移动。任何想法? public Main(BufferedImage image) { thi
在我的应用程序中,我使用 gps 获取地址、纬度和经度。我们还需要捕获视频并将该位置设置为视频。因此可以在视频-> 详细信息选项中看到这一点。 我用照片成功完成了,但无法用视频完成。 我为此使用 Me
这是我写的代码: super("Add contact"); setLayout(new FlowLayout()); IPAddress = new JLabel("IP Address"); IP
我不明白我做错了什么,输出始终是整个脚本,带有 Invalid parameter to setlocal 错误!这可能只是一个愚蠢的错误,但它让我发疯。 SETLOCAL ENABLEDELAYED
在 Windows 批处理文件中编写脚本时,有时脚本的正确执行需要使用 setlocal 命令。我对使用 setlocal 的主要提示是,我经常执行复杂的 for & if 语句,在这些语句中我在该代
我有一个带有一些功能的批处理文件。每个函数都使用 setlocal,这样它的变量就不会污染主批处理脚本。我注意到我第一次在主批处理脚本中而不是在每个嵌套的 setlocal 中只需要参数 ENABLE
我有以下代码,我尝试将 JLabel 放在 JFrame 上的自定义位置。 public class GUI extends JFrame { /** * * @param
试图在变量中保留感叹号。下面是一个简化的说明性脚本: echo off set testvar="C:\Windows\TestOfIllegals[!]" echo Pre-
我正在尝试制作一个简单的批处理文件(“javapath.bat”)以在需要时将 Java 编译器添加到路径中,这样它就不会一直在路径上。我还希望能够在其他构建脚本中执行类似 @call javapat
嘿,这是我的第二篇文章,所以不要生我的气,但我在使用 java 中的 JPanel 时遇到了问题。我正在尝试设置大小和位置,但它不起作用,我尝试过 repaint();但这不起作用。有什么帮助吗? 这
如何在 LWUIT 中设置按钮位置? public void error() { error = new Dialog(); e = new Label("EMPTY
我是一名优秀的程序员,十分优秀!