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


Java Firebase.removeValue方法代碼示例

本文整理匯總了Java中com.firebase.client.Firebase.removeValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Firebase.removeValue方法的具體用法?Java Firebase.removeValue怎麽用?Java Firebase.removeValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.firebase.client.Firebase的用法示例。


在下文中一共展示了Firebase.removeValue方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onActionItemClicked

import com.firebase.client.Firebase; //導入方法依賴的package包/類
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    if (item.getItemId() == R.id.menu_item_delete) {
        for (int key :
                (List<Integer>) mAdapter.getSelectedItems()) {
            ReminderItem reminderItem = (ReminderItem) mAdapter.getItem(key);

            Utils.disableAlarmGeofence(mContext, reminderItem);
            Firebase ref = mAdapter.getRef(key);
            ref.removeValue();
        }
        mode.finish();
        return true;
    }
    return false;
}
 
開發者ID:trigor74,項目名稱:travelers-diary,代碼行數:17,代碼來源:ReminderListFragment.java

示例2: resetDevice

import com.firebase.client.Firebase; //導入方法依賴的package包/類
public static void resetDevice() {
    // Delete entries from Firebase
    String firebaseUid = PreferencesUtils.getString(mActivity, R.string.key_firebase_uid, "");

    LogUtils.LOGE("***> reset device", firebaseUid);
    Firebase deviceRef = new Firebase(Constants.FIREBASE_URL_DEVICES).child(firebaseUid);
    deviceRef.removeValue();

    Firebase userRef = new Firebase(Constants.FIREBASE_URL_USERS).child(firebaseUid);
    userRef.removeValue();

    PreferencesUtils.setString(mActivity, R.string.key_firebase_uid, "");
    PreferencesUtils.setInt(mActivity, R.string.key_device_number, 0);
    PreferencesUtils.setBoolean(mActivity, R.string.key_is_connected, false);
    PreferencesUtils.setInt(mActivity, R.string.key_total_devices, 0);
    PreferencesUtils.setBoolean(mActivity, R.string.key_message_received, false);

    hide();

    PreferencesUtils.setBoolean(mActivity, R.string.key_device_reset_done, true);

    Intent intent = new Intent(mActivity, MainActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    mActivity.startActivity(intent);
    mActivity.finish();
}
 
開發者ID:kyleparker,項目名稱:io16experiment-master,代碼行數:27,代碼來源:MainActivity.java

示例3: onActionItemClicked

import com.firebase.client.Firebase; //導入方法依賴的package包/類
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    if (item.getItemId() == R.id.menu_item_delete) {
        for (Firebase ref :
                (List<Firebase>) mAdapter.getSelectedItemsRef()) {
            ref.removeValue();
        }
        mode.finish();
        return true;
    }
    return false;
}
 
開發者ID:trigor74,項目名稱:travelers-diary,代碼行數:13,代碼來源:DiaryListFragment.java

示例4: delete

import com.firebase.client.Firebase; //導入方法依賴的package包/類
private void delete() {
    Firebase firebaseRef = (new Firebase(Utils.getFirebaseUserReminderUrl(mUserUID))).child(mItemKey);
    firebaseRef.removeValue();
    Utils.disableAlarmGeofence(getActivity().getApplicationContext(), mRemindItem);
    getActivity().finish();
    Toast.makeText(getContext(), R.string.deleted, Toast.LENGTH_SHORT).show();
}
 
開發者ID:trigor74,項目名稱:travelers-diary,代碼行數:8,代碼來源:ReminderItemFragment.java

示例5: deleteTable

import com.firebase.client.Firebase; //導入方法依賴的package包/類
/**
 * Delete specific table from the database
 * @param table
 */
public void deleteTable(Firebase table){
	table.removeValue(new Firebase.CompletionListener() {

		@Override
		public void onComplete(FirebaseError arg0, Firebase arg1) {
			//System.out.println("Table deleted");

		}
	});
}
 
開發者ID:torch2424,項目名稱:CECS343JavaResturant,代碼行數:15,代碼來源:ConnectFirebase.java

示例6: handleIncomingMessage

import com.firebase.client.Firebase; //導入方法依賴的package包/類
/**
 * Handle the incoming message from the nearby device. Parse the message to retrieve the appropriate data.
 */
private void handleIncomingMessage(Message message) {
    LogUtils.LOGE("***> message", DeviceMessage.fromNearbyMessage(message).getMessageBody());

    String[] messageParts = DeviceMessage.fromNearbyMessage(message).getMessageBody().split(Pattern.quote("|"));

    if (messageParts.length == 0) {
        LogUtils.LOGE("***> error", "error parsing message");
        return;
    }

    mFirebaseUid = messageParts[0];
    mDeviceNum = Integer.valueOf(messageParts[1]);
    mTotalDevices = Integer.valueOf(messageParts[2]);
    String deviceId = messageParts[3];

    if (!PreferencesUtils.getBoolean(mActivity, R.string.key_is_connected, false)) {
        // Update Firebase and remove the old FirebaseUid
        String currentFirebaseUid = PreferencesUtils.getString(mActivity, R.string.key_firebase_uid, "");
        LogUtils.LOGE("***> handleIncomingMessage", "remove firebase uid:" + currentFirebaseUid);
        Firebase userChallengeRef = new Firebase(Constants.FIREBASE_URL_USERS).child(currentFirebaseUid);
        userChallengeRef.removeValue();
    }

    // Update the shared preferences
    PreferencesUtils.setString(mActivity, R.string.key_firebase_uid, mFirebaseUid);
    PreferencesUtils.setInt(mActivity, R.string.key_total_devices, mTotalDevices);
    PreferencesUtils.setInt(mActivity, R.string.key_device_number, mDeviceNum);
    PreferencesUtils.setBoolean(mActivity, R.string.key_is_connected, true);

    // Display the message
    displayMessage();

    // Update the background color
    setInitialValues();

    // Generate next message, based on Firebase
    getNextDeviceFirebase();

    // Update connected status on Firebase
    Map<String, Object> device = new HashMap<>();
    device.put(Constants.FIREBASE_PROPERTY_CONNECTED, true);

    Firebase deviceRef = new Firebase(Constants.FIREBASE_URL_DEVICES).child(mFirebaseUid).child(deviceId);
    deviceRef.updateChildren(device);
    deviceRef.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            Device d = dataSnapshot.getValue(Device.class);
            LogUtils.LOGE("***> deviceRef", "here");
            if (d == null) {
                LogUtils.LOGE("***> setupFirebase", "reset device");
                MainActivity.resetDevice();
            }
        }

        @Override
        public void onCancelled(FirebaseError firebaseError) {

        }
    });

    if (mDeviceNum < mTotalDevices) {
        // Change the display text
        mIntroConnectDevice.setText(mActivity.getString(R.string.text_connect_device, mDeviceNum + 1));

        // Change text/button action
        mDiscover.setOnClickListener(mConnectedClickListener);
    } else {
        mIntroConnectDevice.setVisibility(View.GONE);
        mDiscover.setVisibility(View.GONE);
    }

    unsubscribe();
}
 
開發者ID:kyleparker,項目名稱:io16experiment-master,代碼行數:78,代碼來源:MessageFragment.java


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