现在扑克牌无法启动所需的活动

时间:2015-05-05 12:54:19

标签: android android-pendingintent android-tv

我无法通过正在播放的卡片开始活动。我使用以下代码,但NowPlayingActivity永远不会被调用。

    Intent intent = new Intent(getApplicationContext(), NowPlayingCardActivity.class);
    PendingIntent pi = PendingIntent.getActivity(getApplicationContext(), 99, intent, 
    PendingIntent.FLAG_UPDATE_CURRENT);

    mSession.setSessionActivity(pi);

并在清单文件中:

<activity android:name=".NowPlayingCardActivity" />


当我点击正在播放的牌时,我被带到主要活动,并且没有调用NowPlayingCardActivity。

NowPlayingActivity:

public class NowPlayingCardActivity extends Activity {

    public static final String TAG = "NowPlayingCardActivity";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(TAG, "onCreate");
        Intent newIntent;

        newIntent = new Intent(this, ChannelDetailsActivity.class);
        startActivity(newIntent);
        finish();
    }
}

提前感谢您的帮助......


编辑: 我将以下代码添加到NowPlayingCardActivity,但无济于事......

@Override
public void onResume() {
    super.onResume();
    Log.d(TAG, "onResume");

}

@Override
public void onStart() {
    super.onStart();
    Log.d(TAG, "onStart");
}

0 个答案:

没有答案