Methods Summary |
---|
public void | clear()Removes all values.
mValues.clear();
|
public boolean | containsKey(java.lang.String key)Returns true if this object has the named value.
return mValues.containsKey(key);
|
public int | describeContents()
return 0;
|
public boolean | equals(java.lang.Object object)
if (!(object instanceof ContentValues)) {
return false;
}
return mValues.equals(((ContentValues) object).mValues);
|
public java.lang.Object | get(java.lang.String key)Gets a value. Valid value types are {@link String}, {@link Boolean}, and
{@link Number} implementations.
return mValues.get(key);
|
public java.lang.Boolean | getAsBoolean(java.lang.String key)Gets a value and converts it to a Boolean.
Object value = mValues.get(key);
try {
return (Boolean) value;
} catch (ClassCastException e) {
if (value instanceof CharSequence) {
return Boolean.valueOf(value.toString());
} else if (value instanceof Number) {
return ((Number) value).intValue() != 0;
} else {
Log.e(TAG, "Cannot cast value for " + key + " to a Boolean: " + value, e);
return null;
}
}
|
public java.lang.Byte | getAsByte(java.lang.String key)Gets a value and converts it to a Byte.
Object value = mValues.get(key);
try {
return value != null ? ((Number) value).byteValue() : null;
} catch (ClassCastException e) {
if (value instanceof CharSequence) {
try {
return Byte.valueOf(value.toString());
} catch (NumberFormatException e2) {
Log.e(TAG, "Cannot parse Byte value for " + value + " at key " + key);
return null;
}
} else {
Log.e(TAG, "Cannot cast value for " + key + " to a Byte: " + value, e);
return null;
}
}
|
public byte[] | getAsByteArray(java.lang.String key)Gets a value that is a byte array. Note that this method will not convert
any other types to byte arrays.
Object value = mValues.get(key);
if (value instanceof byte[]) {
return (byte[]) value;
} else {
return null;
}
|
public java.lang.Double | getAsDouble(java.lang.String key)Gets a value and converts it to a Double.
Object value = mValues.get(key);
try {
return value != null ? ((Number) value).doubleValue() : null;
} catch (ClassCastException e) {
if (value instanceof CharSequence) {
try {
return Double.valueOf(value.toString());
} catch (NumberFormatException e2) {
Log.e(TAG, "Cannot parse Double value for " + value + " at key " + key);
return null;
}
} else {
Log.e(TAG, "Cannot cast value for " + key + " to a Double: " + value, e);
return null;
}
}
|
public java.lang.Float | getAsFloat(java.lang.String key)Gets a value and converts it to a Float.
Object value = mValues.get(key);
try {
return value != null ? ((Number) value).floatValue() : null;
} catch (ClassCastException e) {
if (value instanceof CharSequence) {
try {
return Float.valueOf(value.toString());
} catch (NumberFormatException e2) {
Log.e(TAG, "Cannot parse Float value for " + value + " at key " + key);
return null;
}
} else {
Log.e(TAG, "Cannot cast value for " + key + " to a Float: " + value, e);
return null;
}
}
|
public java.lang.Integer | getAsInteger(java.lang.String key)Gets a value and converts it to an Integer.
Object value = mValues.get(key);
try {
return value != null ? ((Number) value).intValue() : null;
} catch (ClassCastException e) {
if (value instanceof CharSequence) {
try {
return Integer.valueOf(value.toString());
} catch (NumberFormatException e2) {
Log.e(TAG, "Cannot parse Integer value for " + value + " at key " + key);
return null;
}
} else {
Log.e(TAG, "Cannot cast value for " + key + " to a Integer: " + value, e);
return null;
}
}
|
public java.lang.Long | getAsLong(java.lang.String key)Gets a value and converts it to a Long.
Object value = mValues.get(key);
try {
return value != null ? ((Number) value).longValue() : null;
} catch (ClassCastException e) {
if (value instanceof CharSequence) {
try {
return Long.valueOf(value.toString());
} catch (NumberFormatException e2) {
Log.e(TAG, "Cannot parse Long value for " + value + " at key " + key);
return null;
}
} else {
Log.e(TAG, "Cannot cast value for " + key + " to a Long: " + value, e);
return null;
}
}
|
public java.lang.Short | getAsShort(java.lang.String key)Gets a value and converts it to a Short.
Object value = mValues.get(key);
try {
return value != null ? ((Number) value).shortValue() : null;
} catch (ClassCastException e) {
if (value instanceof CharSequence) {
try {
return Short.valueOf(value.toString());
} catch (NumberFormatException e2) {
Log.e(TAG, "Cannot parse Short value for " + value + " at key " + key);
return null;
}
} else {
Log.e(TAG, "Cannot cast value for " + key + " to a Short: " + value, e);
return null;
}
}
|
public java.lang.String | getAsString(java.lang.String key)Gets a value and converts it to a String.
Object value = mValues.get(key);
return value != null ? value.toString() : null;
|
public java.util.ArrayList | getStringArrayList(java.lang.String key)Unsupported, here until we get proper bulk insert APIs.
{@hide}
return (ArrayList<String>) mValues.get(key);
|
public int | hashCode()
return mValues.hashCode();
|
public java.util.Set | keySet()Returns a set of all of the keys
return mValues.keySet();
|
public void | put(java.lang.String key, java.lang.Short value)Adds a value to the set.
mValues.put(key, value);
|
public void | put(java.lang.String key, java.lang.Integer value)Adds a value to the set.
mValues.put(key, value);
|
public void | put(java.lang.String key, java.lang.Long value)Adds a value to the set.
mValues.put(key, value);
|
public void | put(java.lang.String key, java.lang.Float value)Adds a value to the set.
mValues.put(key, value);
|
public void | put(java.lang.String key, java.lang.Double value)Adds a value to the set.
mValues.put(key, value);
|
public void | put(java.lang.String key, java.lang.Boolean value)Adds a value to the set.
mValues.put(key, value);
|
public void | put(java.lang.String key, byte[] value)Adds a value to the set.
mValues.put(key, value);
|
public void | put(java.lang.String key, java.lang.String value)Adds a value to the set.
mValues.put(key, value);
|
public void | put(java.lang.String key, java.lang.Byte value)Adds a value to the set.
mValues.put(key, value);
|
public void | putAll(android.content.ContentValues other)Adds all values from the passed in ContentValues.
mValues.putAll(other.mValues);
|
public void | putNull(java.lang.String key)Adds a null value to the set.
mValues.put(key, null);
|
public void | putStringArrayList(java.lang.String key, java.util.ArrayList value)Unsupported, here until we get proper bulk insert APIs.
{@hide}
mValues.put(key, value);
|
public void | remove(java.lang.String key)Remove a single value.
mValues.remove(key);
|
public int | size()Returns the number of values.
return mValues.size();
|
public java.lang.String | toString()Returns a string containing a concise, human-readable description of this object.
StringBuilder sb = new StringBuilder();
for (String name : mValues.keySet()) {
String value = getAsString(name);
if (sb.length() > 0) sb.append(" ");
sb.append(name + "=" + value);
}
return sb.toString();
|
public java.util.Set | valueSet()Returns a set of all of the keys and values
return mValues.entrySet();
|
public void | writeToParcel(android.os.Parcel parcel, int flags)
parcel.writeMap(mValues);
|