需要应用程序启用索引样本code部分样本、应用程序、索引、部分

2023-09-07 08:45:12 作者:学不会伪装

我在我的应用程序工作在App索引功能和之后的谷歌开发者指南。从指南我已经粘在下面。

I have working on App Indexing feature in my app and following the Google Developers guide. From the guide I have sticking on the following.

// Create App Indexing Link objects
AppIndexingLink item1 = new AppIndexingLink(appUri1, webUrl1, this.findViewById(R.id.btn1));
AppIndexingLink item2 = new AppIndexingLink(appUri2, webUrl2, this.findViewById(R.id.btn2)); 

从上面的语句,我们可以看到的参数。

From the above statements we can notice the parameters.

我对这个查询:

在文档他们提到该网页的网址是可选的。但是,当我删除,让编译错误,如果我让它空()给出NullPointerException异常(不知道空导致NullPointerException异常)

2,BTN1和BTN2,我们应该在哪里得到这些的?为什么我们有给他们? 。如果我给任何视图从我的项目产生NullPointerException异常(这是一个让我在第一个不能确定的情况)。

2.The btn1 and btn2, where should we get those from? Why we have give them there? . If I give any view from my project yields NullPointerException(This is the situation which makes me not sure on the first one).

如果任何一个有教程和样本codeS,以使应用程序索引,请提供。它可以帮助我们。

If any one have tutorial AND sample codes to enable the App Indexing , kindly provide it. Its may help us.

推荐答案

1,webUrl1是URI类型的对象,你需要解析某些URL前使用谷歌Play网址

1-webUrl1 is a object of Uri type you need to parse some url ex use your google play url

2 BTN1和BTN2可以任意查看用户正在观看例如图像视图或文本视图containign一些文本

2-btn1 and btn2 can be any view the user is viewing example a image view or a text view containign some text