当前位置: 首页>>代码示例>>Java>>正文


Java AsyncQueryHandler.startUpdate方法代码示例

本文整理汇总了Java中android.content.AsyncQueryHandler.startUpdate方法的典型用法代码示例。如果您正苦于以下问题:Java AsyncQueryHandler.startUpdate方法的具体用法?Java AsyncQueryHandler.startUpdate怎么用?Java AsyncQueryHandler.startUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.AsyncQueryHandler的用法示例。


在下文中一共展示了AsyncQueryHandler.startUpdate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateItemValue

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
private void updateItemValue(long id, boolean value) {
    ContentValues values = new ContentValues();
    values.put(MultimaniaContract.TalkEntry.IS_FAVORITE, value ? 1 : 0);
    AsyncQueryHandler handler = new MyScheduleAsyncQueryHandler(getActivity().getContentResolver());
    handler.startUpdate(
            0,
            null,
            MultimaniaContract.TalkEntry.CONTENT_URI,
            values,
            MultimaniaContract.TalkEntry._ID + "=?",
            new String[]{"" + id}
    );
    if (mAccountName != null) {
        if (value) {
            ApiActions.postFavoriteTalk(getActivity(), mAccountName, id);
        } else {
            ApiActions.deleteFavoriteTalk(getActivity(), mAccountName, id);
        }
    }
}
 
开发者ID:SNiels,项目名称:Multi-Mania-app,代码行数:21,代码来源:MyScheduleFragment.java

示例2: updateItemValue

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
private void updateItemValue(long id, boolean value) {
    ContentValues values = new ContentValues();
    values.put(MultimaniaContract.TalkEntry.IS_FAVORITE, value ? 1 : 0);
    AsyncQueryHandler handler = new SuggestionAsyncQueryHandler(getActivity().getContentResolver());
    handler.startUpdate(
            0,
            null,
            MultimaniaContract.TalkEntry.CONTENT_URI,
            values,
            MultimaniaContract.TalkEntry._ID + "=?",
            new String[]{"" + id}
    );
    if (mAccountName != null) {
        if (value) {
            ApiActions.postFavoriteTalk(getActivity(), mAccountName, id);
        } else {
            ApiActions.deleteFavoriteTalk(getActivity(), mAccountName, id);
        }
    }
}
 
开发者ID:SNiels,项目名称:Multi-Mania-app,代码行数:21,代码来源:SuggestionFragment.java

示例3: onStop

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
@Override
protected void onStop() {
	//TODO: Archive of our own & FictionPress
	if (mData != null && mData.isInLibrary()) {
		ContentResolver resolver = getContentResolver();
		AsyncQueryHandler handler = new AsyncQueryHandler(resolver){};
		
		int offset = getOffset();
		
		ContentValues values = new ContentValues(1);
		values.put(SqlConstants.KEY_LAST, mCurrentPage);
		values.put(SqlConstants.KEY_OFFSET, offset);
		values.put(SqlConstants.KEY_LAST_READ, System.currentTimeMillis());
		handler.startUpdate(0, null, StoryProvider.FF_CONTENT_URI, values,
				SqlConstants.KEY_STORY_ID + " = ?",
				new String[] { String.valueOf(mStoryId) });
		
		SharedPreferences preference = getSharedPreferences(MainActivity.EXTRA_PREF,MODE_PRIVATE);
		SharedPreferences.Editor editor = preference.edit();
		editor.putLong(MainActivity.EXTRA_RESUME_ID, mStoryId);
		editor.commit();
	}
	super.onStop();
}
 
开发者ID:genious7,项目名称:FanFictionReader,代码行数:25,代码来源:StoryDisplayActivity.java

示例4: setSessionStarred

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public void setSessionStarred(Uri sessionUri, boolean starred, String title) {
    LOGD(TAG, "setSessionStarred uri=" + sessionUri + " starred=" +
            starred + " title=" + title);
    sessionUri = ScheduleContract.addCallerIsSyncAdapterParameter(sessionUri);
    final ContentValues values = new ContentValues();
    values.put(ScheduleContract.Sessions.SESSION_STARRED, starred);
    AsyncQueryHandler handler =
            new AsyncQueryHandler(mActivity.getContentResolver()) {
            };
    handler.startUpdate(-1, null, sessionUri, values, null, null);

    EasyTracker.getTracker().sendEvent(
            "Session", starred ? "Starred" : "Unstarred", title, 0L);

    // Because change listener is set to null during initialization, these
    // won't fire on pageview.
    mActivity.sendBroadcast(ScheduleWidgetProvider.getRefreshBroadcastIntent(mActivity, false));

    // Sync to the cloudz.
    uploadStarredSession(mActivity, sessionUri, starred);
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:22,代码来源:SessionsHelper.java

示例5: updateEntityInAsync

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public void updateEntityInAsync(final ContentResolver contentResolver, ContentValues content) {
    final int DUMMY_TOKEN = -1;

    AsyncQueryHandler handler =
            new AsyncQueryHandler(contentResolver) {
                @Override
                protected void onUpdateComplete(int token, Object cookie, int result) {
                    super.onUpdateComplete(token, cookie, result);
                }
            };

    // We are using a "LIKE" to compare the ID because it's a string
    handler.startUpdate(DUMMY_TOKEN, null, this.getProviderUri(),
            content, DB.ID + " LIKE ?", new String[]{this.id});
}
 
开发者ID:tipz,项目名称:tipz-android,代码行数:16,代码来源:TipEntity.java

示例6: onOptionsItemSelected

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()){
        case R.id.action_favorite:{
            mIsFavorite=!mIsFavorite;
            ContentValues values = new ContentValues();
            values.put(MultimaniaContract.TalkEntry.IS_FAVORITE,mIsFavorite);
            AsyncQueryHandler handler = new TalkAsyncQueryHandler(getActivity().getContentResolver());
            handler.startUpdate(
                    0,
                    null,
                    MultimaniaContract.TalkEntry.CONTENT_URI,
                    values,
                    MultimaniaContract.TalkEntry._ID+"=?",
                    new String[]{""+ mTalkId}
            );
            if(mAccountName!=null){
                ApiActions.postFavoriteTalk(getActivity(), mAccountName, mTalkId);
            }
            setActionIcon();
            break;
        }
        case R.id.action_share: {
            Intent sendIntent = new Intent();
            sendIntent.setAction(Intent.ACTION_SEND);
            sendIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.imattending) + mTitle + " @multimania. " + getString(R.string.readmoreatmm)+ ". " + getString(R.string.hashtag_mm));
            sendIntent.setType("text/plain");
            startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.share_with)));
        }
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:SNiels,项目名称:Multi-Mania-app,代码行数:33,代码来源:TalkFragment.java

示例7: changeServingState

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
void changeServingState(Context context, String truckId, boolean isServing, Location location) {
    ContentValues values = new ContentValues();
    values.put(PublicContract.Truck.LATITUDE, location.getLatitude());
    values.put(PublicContract.Truck.LONGITUDE, location.getLongitude());
    values.put(PublicContract.Truck.IS_SERVING, isServing);
    values.put(Contract.TruckState.IS_DIRTY, true);

    Uri uri = Contract.syncToNetwork(Contract.TRUCK_STATE_URI);
    WhereClause whereClause = new WhereClause.Builder()
            .where(PublicContract.Truck.ID, EQUALS, truckId)
            .build();

    AsyncQueryHandler queryHandler = new SimpleAsyncQueryHandler(context.getContentResolver());
    queryHandler.startUpdate(0, null, uri, values, whereClause.selection, whereClause.selectionArgs);
}
 
开发者ID:TruckMuncher,项目名称:TruckMuncher-Android,代码行数:16,代码来源:VendorHomeServiceHelper.java

示例8: updateTeamMatch

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
/**
 * Update a single team's record in the database. This method is asynchronous.
 */
public static void updateTeamMatch(Context ctx, long teamMatchId, ContentValues values) {
  AsyncQueryHandler handler = new AsyncQueryHandler(ctx.getContentResolver()) {
  };
  handler.startUpdate(-1, null, TeamMatches.CONTENT_URI, values, TeamMatches._ID + "=?",
      new String[] { "" + teamMatchId });
}
 
开发者ID:alexjlockwood,项目名称:scouting-manager-2013,代码行数:10,代码来源:StorageUtil.java

示例9: setSessionStarred

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public void setSessionStarred(Uri sessionUri, boolean starred, String title) {
    LOGD(TAG, "setSessionStarred uri=" + sessionUri + " starred=" +
            starred + " title=" + title);
    sessionUri = ScheduleContract.addCallerIsSyncAdapterParameter(sessionUri);
    final ContentValues values = new ContentValues();
    values.put(ScheduleContract.Sessions.SESSION_STARRED, starred);
    AsyncQueryHandler handler =
            new AsyncQueryHandler(mActivity.getContentResolver()) {
            };
    handler.startUpdate(-1, null, sessionUri, values, null, null);

    EasyTracker.getTracker().trackEvent(
            "Session", starred ? "Starred" : "Unstarred", title, 0L);

    // Because change listener is set to null during initialization, these
    // won't fire on pageview.
    final Intent refreshIntent = new Intent(mActivity, MyScheduleWidgetProvider.class);
    refreshIntent.setAction(MyScheduleWidgetProvider.REFRESH_ACTION);
    mActivity.sendBroadcast(refreshIntent);

    // Sync to the cloud.
    final Intent updateServerIntent = new Intent(mActivity, ScheduleUpdaterService.class);
    updateServerIntent.putExtra(ScheduleUpdaterService.EXTRA_SESSION_ID,
            ScheduleContract.Sessions.getSessionId(sessionUri));
    updateServerIntent.putExtra(ScheduleUpdaterService.EXTRA_IN_SCHEDULE, starred);
    mActivity.startService(updateServerIntent);
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:28,代码来源:SessionsHelper.java

示例10: updateTeam

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
/**
 * Update a single team's record in the database. This method is asynchronous.
 */
public static void updateTeam(Context ctx, long teamId, ContentValues values) {
  AsyncQueryHandler handler = new AsyncQueryHandler(ctx.getContentResolver()) {
  };
  handler.startUpdate(-1, null, Teams.teamIdUri(teamId), values, null, null);
}
 
开发者ID:alexjlockwood,项目名称:scouting-manager-2013,代码行数:9,代码来源:StorageUtil.java


注:本文中的android.content.AsyncQueryHandler.startUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。