我已经成功加载了网页视频中的视频,但它也正在播放,但我想将该链接传递给其他活动,该活动将使用androidYouTubePlayer播放视频,并且我还想显示下面的webview。
问题:
<android.support.v7.widget.CardView
android:id="@+id/cardViewDemo1"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_margin="5dp"
android:background="#00ff00"
android:elevation="3dp"
app:cardCornerRadius="5dp">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp" />
</android.support.v7.widget.CardView>
答案 0 :(得分:1)
将链接发送到新活动。
CardView cardView = (CardView) findViewById(R.id.cardViewDemo1);
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String linkVideo = "Here, you set this string with link your video ";
Bundle bundle = new Bundle();
//HERE, YOU SET YOUR LINK VIDEO, INSIDE KEY "myKeyForReciveLinkVideo";
bundle.putString("myKeyForReciveLinkVideo",linkVideo);
//START YOUR ACTIVITY
Intent i = new Intent(YourActivity,YourActivityGo.class);
//Send your bundle containing the string with the url link to the new activity.
startActivity(i,bundle);
}
});
在活动中恢复传递给您的活动的数据。
//Retrieve the arguments passed to new activity.
Bundle bundle = new Bundle(getArguments());
//Use the key you previously defined in the bundle to retrieve the url link string.
String urlLink = bundle.getString("myKeyForReciveLinkVideo");
我希望这会对你有所帮助。