本文整理匯總了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);
}