Intent click = new Intent();
click.setAction(ACTION_CLICK);
PendingIntent pengingitent = PendingIntent.getService(this, 0, click, 0);
到底是怎么样运行的,麻烦哪位告诉下,主要是:PendingIntent pengingitent = PendingIntent.getService(this, 0, click, 0);
到底是怎么一个运行步骤,因为不知道这到底是怎么运行,谁能详细讲解下

解决方案 »

  1.   

    转自eoe
    Intent 表示一个目的,第一个参数表示所在类,第二个参数表示目标类
    PendingIntent 即是一个Intent的描述
    PendingIntent和Intent的区别:
    PendingIntent就是一个Intent的描述,我们可以把这个描述交给别的程序,别的程序根据这个描述在后面的别的时间做你安排做的事情
    换种说法Intent 字面意思是意图,即我们的目的,我们想要做的事情,在activity中,我们可以立即执行它
    PendingIntent 相当于对intent执行了包装,我们不一定一定要马上执行它,我们将其包装后,传递给其他activity或application
    这时,获取到PendingIntent  的application 能够根据里面的intent 来得知发出者的意图,选择拦击或者继续传递或者执行http://blog.sina.com.cn/s/blog_4a6c59d60100qzyf.html
    http://www.devdiv.com/home.php?mod=space&uid=1&do=blog&id=2644很多解释 不复述了
      

  2.   

    说的简单点Intent是一个意图,可以通过这个意图启动一个Activity或者Service,往往是调用对应的start方法,立即启动。
    而PendingIntent是对Intent的一个包装,可以理解成一个延迟意图,或者将来的意图,不是立即启动一个Activity或者Service。最典型用到PendingIntent的地方就是在通知栏上,例如来了一个短信,你点击通知栏后他会打开短信程序(Activity),这里就是对短信的Intent进行了包装,包装成一个PendingIntent。
      

  3.   

    我想说的是:PendingIntent.getService(this, 0, click, 0);
    具体是什么意思,
      

  4.   

    public static PendingIntent getService (Context context, int requestCode, Intent intent, int flags)Since: API Level 1
    Retrieve a PendingIntent that will start a service, like calling Context.startService(). The start arguments given to the service will come from the extras of the Intent.
    Parameterscontext The Context in which this PendingIntent should start the service.
    requestCode Private request code for the sender (currently not used).
    intent An Intent describing the service to be started.
    flags May be FLAG_ONE_SHOT, FLAG_NO_CREATE, FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, or any of the flags as supported by Intent.fillIn() to control which unspecified parts of the intent that can be supplied when the actual send happens.
    ReturnsReturns an existing or new PendingIntent matching the given parameters. May return null only if FLAG_NO_CREATE has been supplied.