如何在小窗口链接的图像指定网址是什么?图像、窗口、链接、网址

2023-09-04 23:15:44 作者:老夫的仙女梦

你知道如何从当前的小窗口链接的图像并将其链接到指定的网址是什么?

Do you know on how to link an image from current widget and link it to specified url?

我一直在寻找的谷歌的解决方案,无法找到确切的解决方案。

I've been searching for the solution in Google, could not found the exact solution.

林正在开发一个简单的小工具。它的真正的新我而言,我并不真正了解如何使用AppWidgetProvider

Im now developing a simple widget.. Its really new for me, Im not really understand on how to use the AppWidgetProvider

我的当前控件只显示图像,该图像将直接链接到一个网站,当用户点击它..

My current widget is only displaying image which it will directly link to a website when user click it..

所以,我的问题是,它的这些,我应该在AppWidgetProvider使用?

So, my question is, which of these should I use in AppWidgetProvider ?

正如我们知道的有4人。

As we know there are 4 of them..

onDeleted(上下文) onDisabled(上下文) onUpdated(上下文) onReceived(上下文)

u能解释多一点呢?和步骤为我做code的图像链接到网站。

can u explain a bit more about it? and the steps for me to make the code for linking the image to website.

感谢朋友

推荐答案

事实上,这不会对 AppWidgets 工作。你应该叫 setOnClickPendingIntent() RemoteViews 实例,它传递了的ImageView ID和以下 PendingIntent 目标:

Indeed this won't work for AppWidgets. You should call setOnClickPendingIntent() on your RemoteViews instance, passing it the ImageView id and the following PendingIntent object:

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
PendingIntent pi = PendingIntent.getActivity(context, 0, i, 0);

下面是,在方法的文档。希望这有助于。

Here's the documentation for the method. Hope this helps.

 
精彩推荐
图片推荐