當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueEventListener類代碼示例

本文整理匯總了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);
                        }
                    });
                }
            }
        }
    });
}
 
開發者ID:WildDogTeam,項目名稱:lib-android-wildgeo,代碼行數:26,代碼來源:GeoQuery.java

示例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
        }
    });
}
 
開發者ID:WildDogTeam,項目名稱:demo-android-chat,代碼行數:35,代碼來源:MainActivity.java

示例3: getAllSegmentList

import com.wilddog.client.ValueEventListener; //導入依賴的package包/類
public static void getAllSegmentList(ValueEventListener valueEventListener) {
    new Wilddog(WILDDOG_SEGMENT).addListenerForSingleValueEvent(valueEventListener);
}
 
開發者ID:luania,項目名稱:witchpot,代碼行數:4,代碼來源:DataService.java


注:本文中的com.wilddog.client.ValueEventListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。