本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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();
}
示例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");
}
});
}
示例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();
}