2

I have more than one leaderboard so on clicking Grid Item I want to launch different leader board for each level.

but when I am trying to launch Leaderboard from onItemClick Leaderboard is not getting launched

my code goes as below

    @Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

    if (mActivityType == ACTIVITY_LEADERBOARD_SELECT) {
        if (isSignedIn()) {
            Intent intent = getGamesClient().getLeaderboardIntent(Util.getLeaderBoardId(LevelSelectActivity.this, position));
            startActivityForResult(intent, 143);
            GoogleAnalyics.addView(LevelSelectActivity.this.getApplicationContext(), "LeaderBoardActivity:" + (position + 1));
            finish();
        } else {
            if (Util.isWifiConnected(LevelSelectActivity.this)) {
                beginUserInitiatedSignIn();
            } else {
                new CustomToastSystem(LevelSelectActivity.this).toast(R.string.noInternet, Toast.LENGTH_LONG);
            }
        }
    }
}

I get this log when I click on grid Item

I/ActivityManager( 2305): START u0 {act=com.google.android.gms.games.VIEW_LEADERBOARD_SCORES flg=0x4000000 cmp=com.google.android.gms/.games.ui.client.leaderboards.ClientLeaderboardScoreListActivity (has extras)} from pid 32406
W/ActivityManager( 2305): Activity is launching as a new task, so cancelling activity result.
D/dalvikvm( 2305): GC_FOR_ALLOC freed 522K, 32% free 22502K/33080K, paused 61ms, total 61ms
W/ContextImpl( 2305): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1084 com.android.server.am.ActivityStack.finishActivityLocked:3814 com.android.server.am.ActivityStack.finishActivityLocked:3796 com.android.server.am.ActivityStack.requestFinishActivityLocked:3712 com.android.server.am.ActivityManagerService.finishActivity:2843 
E/ClientUiFragAct(32292): Client UI activities must be started with startActivityForResult
E/GamesFragmentActivity(32292): Unable to instantiate GoogleApiClient; bailing out...
W/ContextImpl( 2305): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1084 com.android.server.am.ActivityStack.finishActivityLocked:3814 com.android.server.am.ActivityStack.finishActivityLocked:3796 com.android.server.am.ActivityStack.requestFinishActivityLocked:3712 com.android.server.am.ActivityManagerService.finishActivity:2843 
V/PhoneStatusBar( 2478): setLightsOn(true)
D/audio_hw_primary( 1944): select_output_device: AUDIO_DEVICE_OUT_SPEAKER
D/dalvikvm(32292): GC_EXPLICIT freed 8875K, 72% free 3997K/13816K, paused 2ms+3ms, total 32ms

but same thing works fine i.e Leader board gets launched if I launch from button click

Please any suggestions

Sharanabasu Angadi
  • 4,304
  • 8
  • 43
  • 67

0 Answers0