博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
android mvp示例_Android深层链接示例
阅读量:2526 次
发布时间:2019-05-11

本文共 2965 字,大约阅读时间需要 9 分钟。

android mvp示例

In this tutorial you will learn about android deep linking with an example.

在本教程中,您将通过示例了解android深度链接。

In deep linking first we have to understand what does an URI means. Let us consider an example of URI,

首先,在深层链接中,我们必须了解URI的含义。 让我们考虑一个URI的例子,

https://www.example.com/demo?userid=100&client=android

https://www.example.com/demo?userid=100&client=android

Here,

这里,

  • https is a scheme

    https是一个方案

  • www.example.com is a host

    www.example.com是房东

  • /demo is a path, directing the specific resource

    / demo是用于引导特定资源的路径

  • ?userid=100&client=android is a query string with key-value pairs like the hashmap in java.

    ?userid = 100&client = android是具有键值对的查询字符串,例如java中的hashmap。

Deeplink is defined as a source of content to content web to your android application and in deeplink whenever user opens an URI and if that URI is deep link with any application then it opens a dialog prompt that open with that app or open with browser only.

深度链接被定义为内容网络到您的android应用程序的内容源,并且在深度链接中,只要用户打开URI,并且该URI是与任何应用程序的深度链接,则它会打开一个对话框提示,该对话框随该应用程序打开或仅通过浏览器打开。

We can create deeplink over network that is connecting website directly to the application or we can create custom deplink also like myApplication://….

我们可以创建将网站直接连接到应用程序的网络深层链接,也可以创建自定义的deplink,例如myApplication://…。

Android深层链接示例 (Android Deep Linking Example)

First of all create a new android project to understand deeplink in android app.

首先创建一个新的android项目,以了解android应用中的Deeplink。

Now make intent filter in the activity that you want to open when user click on weblink.

现在,在用户单击Weblink时要打开的活动中进行意图过滤。

What we are doing in this project is when we are clicking on weblink then we are opening the app and showing the weblink in the text view.

在此项目中,我们要做的是单击Weblink,然后打开应用程序并在文本视图中显示该Weblink。

activity_main.xml

activity_main.xml

     
 

Now we are designing its java class to represent weblink when user click on it on textview.

现在,我们正在设计其java类,以在用户在textview上单击它时代表Weblink。

MainActivity.java

MainActivity.java

package com.example.deeplinkdemo; import android.content.Intent;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.widget.TextView; public class MainActivity extends AppCompatActivity {     @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);         Intent intent=getIntent();         if(intent!=null&&intent.getData()!=null){            ((TextView)findViewById(R.id.deepLinkText)).setText(intent.getData().toString());        }    }}

Build app for about project and install it in your mobile device.

为项目构建应用程序并将其安装在您的移动设备中。

Below we are designing a custom html file when user open that html file and click on the link on that html file then our app will open.

下面,我们在用户打开html文件并单击该html文件上的链接时设计一个自定义html文件,然后我们的应用程序将打开。

  	myapp://myhost/help   

Now you can run and test your application.

现在,您可以运行和测试您的应用程序。

Android Deep Linking ExampleAndroid Deep Linking Example

翻译自:

android mvp示例

转载地址:http://wtggb.baihongyu.com/

你可能感兴趣的文章
sort_buffer_size:
查看>>
mojo 关闭utf8
查看>>
数据库外连接简介
查看>>
Django搭建网站笔记
查看>>
设计模式的总结
查看>>
eclipse里面配置热部署
查看>>
Linq 根据list属性去重复
查看>>
201521123045 《JAVA程序设计》第1周学习总结 1
查看>>
PW试验-----verilog
查看>>
10本最热门科普书免费送!人工智能数学物理获奖经典佳作!
查看>>
创建一个django项目,基本配置及运行流程
查看>>
页面跳转的方法
查看>>
C#三层ATM-10.改密码
查看>>
mysql-sql高级应用
查看>>
(1.1)MPLS定义
查看>>
Building a Android Development Environment
查看>>
JS中null与undefined的区别
查看>>
java 泛型详解(普通泛型、 通配符、 泛型接口,泛型数组,泛型方法,泛型嵌套)...
查看>>
C# DateTime时间格式转换为Unix时间戳格式
查看>>
Java调用本地方法总结
查看>>