想点击通知栏后进入一个Activity的同时传人一个int数。是点击才会传。

解决方案 »

  1.   

    Android中使用Notification并通过点击Notification重新启动Activity
    需要传参数就把参数put到intent里面,这样activity就能从这个intent里获取到参数。
      

  2.   

    你给的链接,看不懂啊
    就是实现点击通知栏的通知跳转到activity。
    如果需要一个int参数,就把它放到intent里。
      

  3.   

    就是普通的Intent传值..
    intent.putExtra("intnumber", 值);在activity里面取这个intnumber就行了
      

  4.   

    你给的链接,看不懂啊
    就是实现点击通知栏的通知跳转到activity。
    如果需要一个int参数,就把它放到intent里。
    是这样,我这个程序吧,在我运行的时候就启动LoginActivity,在LoginActivity中设置通知,而且启动MainActivity,点通知后还进入MainActivity,我只是想在点通知时往MainActivity传人一个int值,点通知时才传。
      

  5.   

    你给的链接,看不懂啊
    是这样,我这个程序吧,在我运行的时候就启动LoginActivity,在LoginActivity中设置通知,而且启动MainActivity,点通知后还进入MainActivity,我只是想在点通知时往MainActivity传人一个int值,点通知时才传。
      

  6.   

    在MainActivity中
    Intent intent = getIntent();
    int tab = Integer.parseInt(intent.getStringExtra("tab").toString());
    不点通知会报空指针错啊
      

  7.   

    使用PaddingIntent就可以 intent = new Intent(Consts.getActionNotificationOpened(client.getService()));
    Bundle bund = new Bundle();
    bund.putString(Consts.NOTIFICATION_FLAG_BUNDLE,flag );
    intent.putExtras(bund);
    // pendingIntent = PendingIntent.getService(client.getService(), 0,
    // intent, 0);
    pendingIntent = PendingIntent.getBroadcast(client.getService(), getNotifyID(),
    intent, 0);
    在广播接收机接收下这个广播,在广播接收器中,进行跳转activity