public final class ContentValues extends Object implements Parcelable
ContentResolver
can process.Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>| Modifier and Type | Field and Description |
|---|---|
static Parcelable.Creator<ContentValues> |
CREATOR |
static String |
TAG |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE| Constructor and Description |
|---|
ContentValues()
Creates an empty set of values using the default initial size
|
ContentValues(ContentValues from)
Creates a set of values copied from the given set
|
ContentValues(int size)
Creates an empty set of values using the given initial size
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all values.
|
boolean |
containsKey(String key)
Returns true if this object has the named value.
|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
|
boolean |
equals(Object object)
Compares this instance with the specified object and indicates if they
are equal.
|
Object |
get(String key)
Gets a value.
|
Boolean |
getAsBoolean(String key)
Gets a value and converts it to a Boolean.
|
Byte |
getAsByte(String key)
Gets a value and converts it to a Byte.
|
byte[] |
getAsByteArray(String key)
Gets a value that is a byte array.
|
Double |
getAsDouble(String key)
Gets a value and converts it to a Double.
|
Float |
getAsFloat(String key)
Gets a value and converts it to a Float.
|
Integer |
getAsInteger(String key)
Gets a value and converts it to an Integer.
|
Long |
getAsLong(String key)
Gets a value and converts it to a Long.
|
Short |
getAsShort(String key)
Gets a value and converts it to a Short.
|
String |
getAsString(String key)
Gets a value and converts it to a String.
|
ArrayList<String> |
getStringArrayList(String key)
Deprecated.
|
int |
hashCode()
Returns an integer hash code for this object.
|
Set<String> |
keySet()
Returns a set of all of the keys
|
void |
put(String key,
Boolean value)
Adds a value to the set.
|
void |
put(String key,
Byte value)
Adds a value to the set.
|
void |
put(String key,
byte[] value)
Adds a value to the set.
|
void |
put(String key,
Double value)
Adds a value to the set.
|
void |
put(String key,
Float value)
Adds a value to the set.
|
void |
put(String key,
Integer value)
Adds a value to the set.
|
void |
put(String key,
Long value)
Adds a value to the set.
|
void |
put(String key,
Short value)
Adds a value to the set.
|
void |
put(String key,
String value)
Adds a value to the set.
|
void |
putAll(ContentValues other)
Adds all values from the passed in ContentValues.
|
void |
putNull(String key)
Adds a null value to the set.
|
void |
putStringArrayList(String key,
ArrayList<String> value)
Deprecated.
|
void |
remove(String key)
Remove a single value.
|
int |
size()
Returns the number of values.
|
String |
toString()
Returns a string containing a concise, human-readable description of this object.
|
Set<Map.Entry<String,Object>> |
valueSet()
Returns a set of all of the keys and values
|
void |
writeToParcel(Parcel parcel,
int flags)
Flatten this object in to a Parcel.
|
public static final String TAG
public static final Parcelable.Creator<ContentValues> CREATOR
public ContentValues()
public ContentValues(int size)
size - the initial size of the set of valuespublic ContentValues(ContentValues from)
from - the values to copypublic boolean equals(Object object)
Objecto must represent the same object
as this instance using a class-specific comparison. The general contract
is that this comparison should be reflexive, symmetric, and transitive.
Also, no object reference other than null is equal to null.
The default implementation returns true only if this ==
o. See Writing a correct
equals method
if you intend implementing your own equals method.
The general contract for the equals and Object.hashCode() methods is that if equals returns true for
any two objects, then hashCode() must return the same value for
these objects. This means that subclasses of Object usually
override either both methods or neither of them.
equals in class Objectobject - the object to compare this instance with.true if the specified object is equal to this Object; false otherwise.Object.hashCode()public int hashCode()
ObjectObject.equals(java.lang.Object) returns true must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCode method
if you intend implementing your own hashCode method.
hashCode in class ObjectObject.equals(java.lang.Object)public void put(String key, String value)
key - the name of the value to putvalue - the data for the value to putpublic void putAll(ContentValues other)
other - the ContentValues from which to copypublic void put(String key, Byte value)
key - the name of the value to putvalue - the data for the value to putpublic void put(String key, Short value)
key - the name of the value to putvalue - the data for the value to putpublic void put(String key, Integer value)
key - the name of the value to putvalue - the data for the value to putpublic void put(String key, Long value)
key - the name of the value to putvalue - the data for the value to putpublic void put(String key, Float value)
key - the name of the value to putvalue - the data for the value to putpublic void put(String key, Double value)
key - the name of the value to putvalue - the data for the value to putpublic void put(String key, Boolean value)
key - the name of the value to putvalue - the data for the value to putpublic void put(String key, byte[] value)
key - the name of the value to putvalue - the data for the value to putpublic void putNull(String key)
key - the name of the value to make nullpublic int size()
public void remove(String key)
key - the name of the value to removepublic void clear()
public boolean containsKey(String key)
key - the value to check fortrue if the value is present, false otherwisepublic Object get(String key)
key - the value to getpublic String getAsString(String key)
key - the value to getpublic Long getAsLong(String key)
key - the value to getpublic Integer getAsInteger(String key)
key - the value to getpublic Short getAsShort(String key)
key - the value to getpublic Byte getAsByte(String key)
key - the value to getpublic Double getAsDouble(String key)
key - the value to getpublic Float getAsFloat(String key)
key - the value to getpublic Boolean getAsBoolean(String key)
key - the value to getpublic byte[] getAsByteArray(String key)
key - the value to getpublic Set<Map.Entry<String,Object>> valueSet()
public Set<String> keySet()
public int describeContents()
ParcelabledescribeContents in interface Parcelablepublic void writeToParcel(Parcel parcel, int flags)
ParcelablewriteToParcel in interface Parcelableparcel - The Parcel in which the object should be written.flags - Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.@Deprecated public void putStringArrayList(String key, ArrayList<String> value)
@Deprecated public ArrayList<String> getStringArrayList(String key)