本文整理汇总了Java中com.wilddog.client.ValueEventListener类的典型用法代码示例。如果您正苦于以下问题:Java ValueEventListener类的具体用法?Java ValueEventListener怎么用?Java ValueEventListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValueEventListener类属于com.wilddog.client包,在下文中一共展示了ValueEventListener类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addValueToReadyListener
import com.wilddog.client.ValueEventListener; //导入依赖的package包/类
private void addValueToReadyListener(final Query wilddog, final GeoHashQuery query) {
wilddog.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
synchronized (GeoQuery.this) {
GeoQuery.this.outstandingQueries.remove(query);
GeoQuery.this.checkAndFireReady();
}
}
@Override
public void onCancelled(final SyncError syncError) {
synchronized (GeoQuery.this) {
for (final GeoQueryEventListener listener : GeoQuery.this.eventListeners) {
GeoQuery.this.wildGeo.raiseEvent(new Runnable() {
@Override
public void run() {
listener.onGeoQueryError(syncError);
}
});
}
}
}
});
}
示例2: onStart
import com.wilddog.client.ValueEventListener; //导入依赖的package包/类
@Override
public void onStart() {
super.onStart();
// Setup our view and list adapter. Ensure it scrolls to the bottom as data changes
final ListView listView = getListView();
// Tell our list adapter that we only want 50 messages at a time
mChatListAdapter = new ChatListAdapter(mWilddogRef.limitToLast(50), this, R.layout.chat_message, mUsername);
listView.setAdapter(mChatListAdapter);
mChatListAdapter.registerDataSetObserver(new DataSetObserver() {
@Override
public void onChanged() {
super.onChanged();
listView.setSelection(mChatListAdapter.getCount() - 1);
}
});
// Finally, a little indication of connection status
mConnectedListener = mWilddogRef.getRoot().child(".info/connected").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
boolean connected = (Boolean) dataSnapshot.getValue();
if (connected) {
Toast.makeText(MainActivity.this, "Connected to Wilddog", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, "Disconnected from Wilddog", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(SyncError wilddogError) {
// No-op
}
});
}
示例3: getAllSegmentList
import com.wilddog.client.ValueEventListener; //导入依赖的package包/类
public static void getAllSegmentList(ValueEventListener valueEventListener) {
new Wilddog(WILDDOG_SEGMENT).addListenerForSingleValueEvent(valueEventListener);
}