當前位置: 首頁>>代碼示例>>Java>>正文


Java GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED屬性代碼示例

本文整理匯總了Java中com.google.android.gms.games.GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED屬性的典型用法代碼示例。如果您正苦於以下問題:Java GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED屬性的具體用法?Java GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED怎麽用?Java GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.android.gms.games.GamesActivityResultCodes的用法示例。


在下文中一共展示了GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onActivityResult

@Override
public void onActivityResult(int request, int response, Intent intent) {
    super.onActivityResult(request, response, intent);

    if (request == SEND_GIFT) {
        if (response == GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED) {
            Toast.makeText(this, "Failed to send gift!", Toast.LENGTH_LONG).show();
        }
    }

    else if (request == SHOW_INBOX) {
        if (response == Activity.RESULT_OK && intent != null) {
            handleGiftRequest(Games.Requests.getGameRequestsFromInboxResponse(intent));
        } else {
            Toast.makeText(this, "Error receiving gift!", Toast.LENGTH_LONG).show();
        }
    }
}
 
開發者ID:googlesamples,項目名稱:io2014-codelabs,代碼行數:18,代碼來源:SquashActivity.java

示例2: onActivityResult

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
        case SEND_REQUEST_CODE:
            if (resultCode == GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED) {
                Toast.makeText(this, "FAILED TO SEND REQUEST!",
                        Toast.LENGTH_LONG).show();
            }
            break;
        case SEND_GIFT_CODE:
            if (resultCode == GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED) {
                Toast.makeText(this, "FAILED TO SEND GIFT!", Toast.LENGTH_LONG)
                        .show();
            }
            break;
        case SHOW_INBOX:
            if (resultCode == Activity.RESULT_OK && data != null) {
                handleRequests(Games.Requests
                        .getGameRequestsFromInboxResponse(data));
            } else {
                Log.e(TAG, "Failed to process inbox result: resultCode = "
                        + resultCode + ", data = "
                        + (data == null ? "null" : "valid"));
            }
            break;
        case RC_SIGN_IN:
            Log.d(TAG, "onActivityResult with requestCode == RC_SIGN_IN, responseCode="
                    + resultCode + ", intent=" + data);
            mSignInClicked = false;
            mResolvingConnectionFailure = false;
            if (resultCode == RESULT_OK) {
                mGoogleApiClient.connect();
            } else {
                BaseGameUtils.showActivityResultError(this, requestCode, resultCode, R.string.signin_other_error);
            }
            break;
    }
    super.onActivityResult(requestCode, resultCode, data);
}
 
開發者ID:NahroTo,項目名稱:Fruit-Destroyer,代碼行數:39,代碼來源:BeGenerousActivity.java

示例3: onActivityResult

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
        case SEND_REQUEST_CODE:
            if (resultCode == GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED) {
                Toast.makeText(this, R.string.error_send_request, Toast.LENGTH_LONG).show();
            }
            break;
        case SEND_GIFT_CODE:
            if (resultCode == GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED) {
                Toast.makeText(this, getString(R.string.error_send_gift), Toast.LENGTH_LONG).show();
            }
            break;
        case SHOW_INBOX:
            if (resultCode == Activity.RESULT_OK && data != null) {
                handleInboxResult(Games.Requests
                        .getGameRequestsFromInboxResponse(data));
            } else {
                // handle failure to process inbox result
                if(resultCode != Activity.RESULT_CANCELED)
                    Toast.makeText(this, getString(R.string.error_claim_gift), Toast.LENGTH_LONG).show();
            }
            break;
        case QUEST_CODE:
            if (resultCode == Activity.RESULT_OK && data != null) {
                Quest quest = data.getParcelableExtra(Quests.EXTRA_QUEST);

                if(quest.getState() == Quest.STATE_COMPLETED)
                    onQuestCompleted(quest);
            }
            break;
    }
    super.onActivityResult(requestCode, resultCode, data);
}
 
開發者ID:TylerCarberry,項目名稱:2048-Battles,代碼行數:34,代碼來源:MainActivity.java


注:本文中的com.google.android.gms.games.GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。