本文整理汇总了Java中com.sonyericsson.extras.liveware.extension.util.ExtensionUtils.INVALID_ID属性的典型用法代码示例。如果您正苦于以下问题:Java ExtensionUtils.INVALID_ID属性的具体用法?Java ExtensionUtils.INVALID_ID怎么用?Java ExtensionUtils.INVALID_ID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sonyericsson.extras.liveware.extension.util.ExtensionUtils
的用法示例。
在下文中一共展示了ExtensionUtils.INVALID_ID属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerOrUpdateWidgetRegistration
/**
* Register or update widget registration.
*
* @param apiRegistrationId The API registration ID.
* @param values The content values to register.
* @return True if the registration was successful.
*/
private boolean registerOrUpdateWidgetRegistration(long apiRegistrationId, ContentValues values) {
if (ExtensionUtils.getRegistrationVersion(mContext) < 3) {
// Widget registration only possible if Registration API version 3 or later.
return false;
}
values.put(Registration.WidgetRegistrationColumns.API_REGISTRATION_ID, apiRegistrationId);
long widgetRegistrationId = getWidgetRegistrationId(apiRegistrationId,
values.getAsString(Registration.WidgetRegistrationColumns.KEY));
if (widgetRegistrationId != ExtensionUtils.INVALID_ID) {
return mContext.getContentResolver().update(Registration.WidgetRegistration.URI,
values, Registration.WidgetRegistrationColumns._ID + " = ?", new String[] {
Long.toString(widgetRegistrationId)
}) > 0;
} else {
return mContext.getContentResolver()
.insert(Registration.WidgetRegistration.URI, values) != null;
}
}
示例2: getWidgetRegistrationId
/**
* Get the widget registration id from a widget registration key.
*
* @param apiRegistrationId The API registration id.
* @param key The key.
* @return The widget registration id.
*/
private long getWidgetRegistrationId(long apiRegistrationId, String key) {
if (ExtensionUtils.getRegistrationVersion(mContext) < 3) {
// Widget registration only possible if Registration API version 3 or later.
return ExtensionUtils.INVALID_ID;
}
Cursor cursor = null;
try {
cursor = mContext.getContentResolver().query(
Registration.WidgetRegistration.URI,
new String[] {
Registration.WidgetRegistrationColumns._ID
}
,Registration.WidgetRegistrationColumns.API_REGISTRATION_ID + " = ? AND "
+ Registration.WidgetRegistrationColumns.KEY + " = ?", new String[] {
Long.toString(apiRegistrationId), key
}, null);
if (cursor != null && cursor.moveToFirst()) {
return cursor.getLong(cursor.getColumnIndexOrThrow(Registration.WidgetRegistrationColumns._ID));
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return ExtensionUtils.INVALID_ID;
}
示例3: isRegistered
/**
* Find out if this extension is registered or not
*
* @return True if registered
*/
private boolean isRegistered() {
return ExtensionUtils.getExtensionId(mContext) != ExtensionUtils.INVALID_ID;
}
示例4: isRegistered
/**
* Find out if this extension is registered or not
*
* @return True if registered
*/
private boolean isRegistered() {
return ExtensionUtils.getExtensionId(mContext) != ExtensionUtils.INVALID_ID;
}