Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

在weex页面中通过 navigator.push的方式跳转页面,而在android端是通过startActivity方法隐式跳转页面;所有展示weex页面的activity的intent-filter中都得有如下配置

            <action android:name="com.taobao.android.intent.action.WEEX" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="com.taobao.android.intent.category.WEEX" />
            <action android:name="android.intent.action.VIEW" />

而真正区分是目标activity的是data标签
<data android:scheme="http" android:host="192.168.2.31" android:path="/dist/modules/mymessage.js"/>
那么问题来了是不是我有多少个navigator.push,android端就得有多少个activity?怎样来实现activity复用?
比如 push 的uri地址分别为
http ://192.168.2.31:8080/dist/modules/1
http ://192.168.2.31:8080/dist/modules/2
安照前面的思路 android就得注册两个activity,还有这个最大的缺陷就是你必须提前知道uri参数,如果是weex页面从服务器后台拿的;android就无能为力了。该怎么避免这种情况 ,各位大神请不吝赐教


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
392 views
Welcome To Ask or Share your Answers For Others

1 Answer

你可以参考下这个项目的实现思路
https://github.com/hanliuxin5...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...