Start activity by clicking on widget

前端 未结 3 2085
梦如初夏
梦如初夏 2020-12-15 18:18

I newbie at programming Android and I try to do a widget which has be able get some data from ISP about my account. There are a lot of unknown things how to do it, but I hav

3条回答
  •  青春惊慌失措
    2020-12-15 18:38

    I don't know about "Creating widget from another widget". This is out of my knowledge but I suggest you to build your own widget.

    Apart from that, calling activity from widget should be using PendingIntent

    Here is simple example to do it

    Intent iSetting = new Intent(this, MyConfig.class);
    PendingIntent piSetting = PendingIntent.getActivity(this, 0, iSetting, 0);
    views.setOnClickPendingIntent(R.id.IdComponent, piSetting);
    

    Or you might need to see this link and this link

提交回复
热议问题