第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

我想在 oncreate() 活動(dòng)之外從另一個(gè)類(lèi)中提取我在 exoplayer 中的

我想在 oncreate() 活動(dòng)之外從另一個(gè)類(lèi)中提取我在 exoplayer 中的

九州編程 2023-03-23 13:51:02
從我的 recyclerview 適配器類(lèi)到 intent put extra 我正在傳遞視頻的 URL,我想在 oncreate() 活動(dòng)之外獲取 getintent。在我的 oncreate() 之外的另一個(gè)字符串中傳遞 URL。是否有可能在 oncreate 之外訪問(wèn) getintent 字符串?在這個(gè)類(lèi)中,我想在 ONCREATE() 之前獲取視頻 URL 的意圖以傳遞 URL 而不是靜態(tài) URL;package com.example.movies.uis;import androidx.annotation.NonNull;import androidx.appcompat.app.AppCompatActivity;import android.annotation.SuppressLint;import android.content.pm.ActivityInfo;import android.content.res.Configuration;import android.os.Bundle;import android.util.Log;import android.util.SparseArray;import android.view.View;import android.view.WindowManager;import android.widget.ImageButton;import android.widget.LinearLayout;import android.widget.TextView;import android.widget.Toast;import com.example.movies.R;import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;import com.google.android.exoplayer2.ui.SimpleExoPlayerView;import at.huber.youtubeExtractor.Format;import at.huber.youtubeExtractor.VideoMeta;import at.huber.youtubeExtractor.YouTubeExtractor;import at.huber.youtubeExtractor.YtFile;public class PlayerActivity extends AppCompatActivity {    SimpleExoPlayerView simpleExoPlayerView;    private String GRID_YOUTUBE_ID = "s9-Id1WJQyo";    private String BASE_URL = "https://www.youtube.com";    private String youtubeLink = BASE_URL + "/watch?v=" + GRID_YOUTUBE_ID;//hello    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_player);        extractYoutubeUrl();        simpleExoPlayerView = findViewById(R.id.player);                        String title = getIntent().getExtras().getString("title");        String urlYoutube = getIntent().getExtras().getString("videourl");                        TextView tv_name = findViewById(R.id.txt_title);        tv_name.setText(title);    }
查看完整描述

2 回答

?
汪汪一只貓

TA貢獻(xiàn)1898條經(jīng)驗(yàn) 獲得超8個(gè)贊

您可以使用具有特定結(jié)構(gòu)的深層鏈接


追加吹線清單


定義 ACTION_VIEW 意圖操作,以便可以從 Google 搜索訪問(wèn)意圖過(guò)濾器


<action android:name="android.intent.action.VIEW" />

并添加 BROWSABLE 類(lèi)別以便可以從 out off app 訪問(wèn)


<category android:name="android.intent.category.DEFAULT" />

<category android:name="android.intent.category.BROWSABLE" />

添加您的鏈接結(jié)構(gòu)


<data android:host="youtube" android:pathPattern=".*" android:scheme="https"/>

有意獲取數(shù)據(jù)


Intent intent = getIntent();

Uri data = intent.getData();

發(fā)送數(shù)據(jù)到應(yīng)用程序


Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://youtube"));

startActivity(launchIntent);


查看完整回答
反對(duì) 回復(fù) 2023-03-23
?
慕萊塢森

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊

您需要使 String title 和 urlYoutube 全局化(即在 onCreate 之外)。然后通過(guò)這種方式在 onCreate 內(nèi)部初始化,您可以在 onCreate 方法之外使用意圖數(shù)據(jù)


例如


public class PlayerActivity extends AppCompatActivity {

    SimpleExoPlayerView simpleExoPlayerView;

    private String GRID_YOUTUBE_ID = "s9-Id1WJQyo";

    private String BASE_URL = "https://www.youtube.com";

    private String youtubeLink = BASE_URL + "/watch?v=" + GRID_YOUTUBE_ID;

    public String title,urlYoutube; 

//hello



    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_player);

        extractYoutubeUrl();

        simpleExoPlayerView = findViewById(R.id.player);



        title = getIntent().getExtras().getString("title");

        urlYoutube = getIntent().getExtras().getString("videourl");



    }

我希望這能解決你的問(wèn)題。


查看完整回答
反對(duì) 回復(fù) 2023-03-23
  • 2 回答
  • 0 關(guān)注
  • 146 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)