當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。