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


Java AsyncQueryHandler.startInsert方法代码示例

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


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

示例1: savePayment

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public static void savePayment(Payment payment, final Handler handler) {
    final ContentValues values = getContentValuesFromPaymentInstance(payment);

    AsyncQueryHandler insertPaymentHandler = new AsyncQueryHandler(mContentResolver) {
        @Override
        protected void onInsertComplete(int token, Object cookie, Uri uri) {
            if (handler != null) {
                Message message = Message.obtain();
                message.what = MESSAGE_WHAT_SAVED_PAYMENT_URL;
                message.obj = uri;
                handler.sendMessage(message);
            }
        }
    };

    insertPaymentHandler.startInsert(0, null, paymentsUri, values);
}
 
开发者ID:Ericliu001,项目名称:SharedBillHelper2015,代码行数:18,代码来源:PaymentDAO.java

示例2: savePaymentInfo

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public static void savePaymentInfo(PaymentInfo paymentInfo, final Handler handler) {
    final ContentValues values = getContentValuesFromPaymentInfoInstance(paymentInfo);

    AsyncQueryHandler insertPaymentInfoHandler = new AsyncQueryHandler(mContentResolver) {
        @Override
        protected void onInsertComplete(int token, Object cookie, Uri uri) {
            if (handler != null) {
                Message message = Message.obtain();
                message.what = MESSAGE_WHAT_SAVED_PAYMENTINFO_URL;
                message.obj = uri;
                handler.sendMessage(message);
            }
        }
    };

    insertPaymentInfoHandler.startInsert(0, null, paymentInfosUri, values);
}
 
开发者ID:Ericliu001,项目名称:SharedBillHelper2015,代码行数:18,代码来源:PaymentInfoDAO.java

示例3: addFavorite

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public static void addFavorite(Context context, Movie movie) {
    Log.d(TAG, "Inserting favorite: " + movie.getTitle());

    ContentValues values = new ContentValues();
    values.put(MovieContract.MovieEntry.COLUMN_MOVIE_ID, movie.getId());
    values.put(MovieContract.MovieEntry.COLUMN_TITLE, movie.getTitle());
    values.put(MovieContract.MovieEntry.COLUMN_ORIGINAL_TITLE, movie.getOriginalTitle());
    values.put(MovieContract.MovieEntry.COLUMN_RELEASE_DATE, movie.getReleaseDate());
    values.put(MovieContract.MovieEntry.COLUMN_OVERVIEW, movie.getOverview());
    values.put(MovieContract.MovieEntry.COLUMN_VOTE_AVERAGE, movie.getVoteAverage());
    values.put(MovieContract.MovieEntry.COLUMN_VOTE_COUNT, movie.getVoteCount());
    values.put(MovieContract.MovieEntry.COLUMN_POSTER_PATH, movie.getPosterPath());
    values.put(MovieContract.MovieEntry.COLUMN_BACKDROP_PATH, movie.getBackdropPath());
    values.put(MovieContract.MovieEntry.COLUMN_POPULARITY, movie.getPopularity());
    values.put(MovieContract.MovieEntry.COLUMN_FAVORITE, 1);
    values.put(MovieContract.MovieEntry.COLUMN_LANGUAGE, movie.getOriginalLanguage());
    values.put(MovieContract.MovieEntry.COLUMN_VIDEO, movie.isVideo());
    values.put(MovieContract.MovieEntry.COLUMN_ADULT, movie.isAdult());

    final AsyncQueryHandler handler = new AsyncCrudHandler(context.getContentResolver());
    handler.startInsert(2, null, MovieContract.MovieEntry.CONTENT_URI, values);

    // update genres
    insertGenres(context, movie.getId(), movie.getGenreIds());
}
 
开发者ID:bdiegel,项目名称:android-tmdb,代码行数:26,代码来源:MovieFavorites.java

示例4: setReservationStatus

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public void setReservationStatus(Uri sessionUri,
                                 @ScheduleContract.MyReservations.ReservationStatus int reservationStatus,
                                 String title) {
    LOGD(TAG, "setReservationStatus session uri=" + sessionUri + " reservationStatus=" +
            reservationStatus + " title=" + title);
    String accountName = AccountUtils.getActiveAccountName(mContext);
    String sessionId = ScheduleContract.Sessions.getSessionId(sessionUri);
    Uri myReservationsUri = ScheduleContract.MyReservations.buildMyReservationUri(accountName);

    @SuppressLint("HandlerLeak") // this is short-lived
            AsyncQueryHandler handler = new AsyncQueryHandler(mContext.getContentResolver()) {
    };
    final ContentValues values = new ContentValues();
    values.put(ScheduleContract.MyReservations.SESSION_ID, sessionId);
    values.put(ScheduleContract.MyReservations.MY_RESERVATION_STATUS, reservationStatus);
    values.put(ScheduleContract.MyReservations.MY_RESERVATION_ACCOUNT_NAME, accountName);
    int offset = SyncUtils.getServerTimeOffset(mContext);
    values.put(ScheduleContract.MyReservations.MY_RESERVATION_TIMESTAMP,
            System.currentTimeMillis() + offset);
    handler.startInsert(-1, null, myReservationsUri, values);
}
 
开发者ID:google,项目名称:iosched,代码行数:22,代码来源:SessionsHelper.java

示例5: requestModelUpdate

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
@Override
public boolean requestModelUpdate(UserActionEnum action, @Nullable Bundle args) {
    // If the action is a VIDEO_VIEWED we save the information that the video has been viewed by
    // the user in AppData.
    if (action.equals(VideoLibraryUserActionEnum.VIDEO_PLAYED)) {
        if (args != null && args.containsKey(KEY_VIDEO_ID)) {
            String playedVideoId = args.getString(KEY_VIDEO_ID);

            LOGD(TAG, "setVideoViewed id=" + playedVideoId);
            Uri myPlayedVideoUri = ScheduleContract.MyViewedVideos.buildMyViewedVideosUri(
                    AccountUtils.getActiveAccountName(mActivity));

            AsyncQueryHandler handler =
                    new AsyncQueryHandler(mActivity.getContentResolver()) {};
            final ContentValues values = new ContentValues();
            values.put(ScheduleContract.MyViewedVideos.VIDEO_ID, playedVideoId);
            handler.startInsert(-1, null, myPlayedVideoUri, values);

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

            // Request an immediate user data sync to reflect the viewed video in the cloud.
            SyncHelper.requestManualSync(AccountUtils.getActiveAccount(mActivity), true);
        } else {
            LOGE(TAG, "The VideoLibraryUserActionEnum.VIDEO_VIEWED action was called without a "
                    + "proper Bundle.");
            return false;
        }
    }
    return true;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:34,代码来源:VideoLibraryModel.java

示例6: setSessionStarred

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public void setSessionStarred(Uri sessionUri, boolean starred, String title) {
    LOGD(TAG, "setSessionStarred uri=" + sessionUri + " starred=" +
            starred + " title=" + title);
    String sessionId = ScheduleContract.Sessions.getSessionId(sessionUri);
    Uri myScheduleUri = ScheduleContract.MySchedule.buildMyScheduleUri(
            AccountUtils.getActiveAccountName(mActivity));

    AsyncQueryHandler handler =
            new AsyncQueryHandler(mActivity.getContentResolver()) {
            };
    final ContentValues values = new ContentValues();
    values.put(ScheduleContract.MySchedule.SESSION_ID, sessionId);
    values.put(ScheduleContract.MySchedule.MY_SCHEDULE_IN_SCHEDULE, starred?1:0);
    handler.startInsert(-1, null, myScheduleUri, values);

    // ANALYTICS EVENT: Add or remove a session from the schedule
    // Contains: Session title, whether it was added or removed (starred or unstarred)
    AnalyticsHelper.sendEvent(
            "Session", starred ? "Starred" : "Unstarred", title);

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

    // Request an immediate user data sync to reflect the starred user sessions in the cloud
    SyncHelper.requestManualSync(AccountUtils.getActiveAccount(mActivity), true);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:28,代码来源:SessionsHelper.java

示例7: saveBill

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public static void saveBill(final Bill bill, final Handler handler) {
    long id = bill.getId();
    final ContentValues values = getContentValuesFromBillInstance(bill);

    if (id >= 0) { // this is an update
        final Uri billUriWithId = BillContract.Bills.buildBillUri(String.valueOf(id));

        new AsyncQueryHandler(mContentResolver) {
        }.startUpdate(0, null, billUriWithId, values, null, null);
        return;
    }


    AsyncQueryHandler insertBillHandler = new AsyncQueryHandler(mContentResolver) {
        @Override
        protected void onInsertComplete(int token, Object cookie, Uri uri) {
            if (handler != null) {

                Message message = Message.obtain();
                message.what = MESSAGE_WHAT_SAVED_BILL_URL;
                message.obj = uri;
                handler.sendMessage(message);
            }
        }
    };

    insertBillHandler.startInsert(0, null, billsUri, values);


}
 
开发者ID:Ericliu001,项目名称:SharedBillHelper2015,代码行数:31,代码来源:BillDAO.java

示例8: saveMember

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public static void saveMember(Member member, final Handler handler) {
    long id = member.getId();
    final ContentValues values = getContentValuesFromMemberInstance(member);

    if (id >= 0) {
        // This is an update
        final Uri memberUriWithId = BillContract.Members.buildMemberUri(String.valueOf(id));

        new AsyncQueryHandler(mContentResolver) {
        }.startUpdate(0, null, memberUriWithId, values, null, null);

        return;
    }

    AsyncQueryHandler insertMemberHandler = new AsyncQueryHandler(mContentResolver) {
        @Override
        protected void onInsertComplete(int token, Object cookie, Uri uri) {
            if (handler != null) {
                Message message = Message.obtain();
                message.what = MESSAGE_WHAT_SAVED_MEMBER_URL;
                message.obj = uri;
                handler.sendMessage(message);
            }
        }
    };

    insertMemberHandler.startInsert(0, null, membersUri, values);
}
 
开发者ID:Ericliu001,项目名称:SharedBillHelper2015,代码行数:29,代码来源:MemberDAO.java

示例9: setSessionStarred

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public void setSessionStarred(Uri sessionUri, boolean starred, String title) {
    LogUtils.LOGD(TAG, "setSessionStarred uri=" + sessionUri + " starred=" +
            starred + " title=" + title);
    String sessionId = ScheduleContract.Sessions.getSessionId(sessionUri);
    Uri myScheduleUri = ScheduleContract.MySchedule.buildMyScheduleUri(mActivity);

    AsyncQueryHandler handler =
            new AsyncQueryHandler(mActivity.getContentResolver()) {
            };
    final ContentValues values = new ContentValues();
    values.put(ScheduleContract.MySchedule.SESSION_ID, sessionId);
    values.put(ScheduleContract.MySchedule.MY_SCHEDULE_IN_SCHEDULE, starred?1:0);
    handler.startInsert(-1, null, myScheduleUri, values);

    /* [ANALYTICS:EVENT]
     * TRIGGER:   Add or remove a session from the schedule.
     * CATEGORY:  'Session'
     * ACTION:    'Starred' or 'Unstarred'
     * LABEL:     session title/subtitle
     * [/ANALYTICS]
     */
    AnalyticsManager.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));

    // Request an immediate user data sync to reflect the starred user sessions in the cloud
    SyncHelper.requestManualSync(AccountUtils.getActiveAccount(mActivity), true);

}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:33,代码来源:SessionsHelper.java

示例10: setSessionStarred

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public void setSessionStarred(Uri sessionUri, boolean starred, String title) {
    LOGD(TAG, "setSessionStarred uri=" + sessionUri + " starred=" +
            starred + " title=" + title);
    String sessionId = ScheduleContract.Sessions.getSessionId(sessionUri);
    Uri myScheduleUri = ScheduleContract.MySchedule.buildMyScheduleUri(mActivity);

    AsyncQueryHandler handler =
            new AsyncQueryHandler(mActivity.getContentResolver()) {
            };
    final ContentValues values = new ContentValues();
    values.put(ScheduleContract.MySchedule.SESSION_ID, sessionId);
    values.put(ScheduleContract.MySchedule.MY_SCHEDULE_IN_SCHEDULE, starred?1:0);
    handler.startInsert(-1, null, myScheduleUri, values);

    /* [ANALYTICS:EVENT]
     * TRIGGER:   Add or remove a session from the schedule.
     * CATEGORY:  'Session'
     * ACTION:    'Starred' or 'Unstarred'
     * LABEL:     session title/subtitle
     * [/ANALYTICS]
     */
    AnalyticsManager.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));

    // Request an immediate user data sync to reflect the starred user sessions in the cloud
    SyncHelper.requestManualSync(AccountUtils.getActiveAccount(mActivity), true);

}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:33,代码来源:SessionsHelper.java

示例11: setSessionStarred

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
public void setSessionStarred(Uri sessionUri, boolean starred, String title) {
    LOGD(TAG, "setSessionStarred uri=" + sessionUri + " starred=" +
            starred + " title=" + title);
    String sessionId = ScheduleContract.Sessions.getSessionId(sessionUri);
    Uri myScheduleUri = ScheduleContract.MySchedule.buildMyScheduleUri(
            AccountUtils.getActiveAccountName(mContext));

    @SuppressLint("HandlerLeak") // this is short-lived
            AsyncQueryHandler handler = new AsyncQueryHandler(mContext.getContentResolver()) {
    };
    final ContentValues values = new ContentValues();
    values.put(ScheduleContract.MySchedule.SESSION_ID, sessionId);
    values.put(ScheduleContract.MySchedule.MY_SCHEDULE_IN_SCHEDULE, starred ? 1 : 0);
    int offset = SyncUtils.getServerTimeOffset(mContext);
    values.put(ScheduleContract.MySchedule.MY_SCHEDULE_TIMESTAMP, new Date().getTime() +
            offset);
    handler.startInsert(-1, null, myScheduleUri, values);

    // ANALYTICS EVENT: Add or remove a session from the schedule
    // Contains: Session title, whether it was added or removed (starred or unstarred)
    AnalyticsHelper.sendEvent("Session", starred ? "Starred" : "Unstarred", "Session: " + title);

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

    // Request an immediate user data sync to reflect the starred user sessions in the cloud
    SyncHelper.requestManualSync(true);

    // No need to manually setup calendar or notifications so they happen on sync
}
 
开发者ID:google,项目名称:iosched,代码行数:32,代码来源:SessionsHelper.java

示例12: insertTeam

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

示例13: insertTeamMatch

import android.content.AsyncQueryHandler; //导入方法依赖的package包/类
/**
 * Insert a single team match into the database. This method is asynchronous.
 */
public static void insertTeamMatch(Context ctx, ContentValues values) {
  AsyncQueryHandler handler = new AsyncQueryHandler(ctx.getContentResolver()) {
  };
  handler.startInsert(-1, null, TeamMatches.CONTENT_URI, values);
}
 
开发者ID:alexjlockwood,项目名称:scouting-manager-2013,代码行数:9,代码来源:StorageUtil.java


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