- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个视频流应用程序,可以与 ExoPlayer2 配合使用,但我的用户现在希望我添加一个在外部播放器中播放视频的选项,因此我试图编写一个 Intent ,但似乎无法做到。
我的适配器必须从其中获取链接:
public class ServerApater extends RecyclerView.Adapter<ServerApater.OriginalViewHolder> {
private List<CommonModels> items = new ArrayList<>();
private Context ctx;
private ServerApater.OnItemClickListener mOnItemClickListener;
private ServerApater.OriginalViewHolder viewHolder;
public interface OnItemClickListener {
void onItemClick(View view, CommonModels obj, int position, OriginalViewHolder holder);
}
public void setOnItemClickListener(ServerApater.OnItemClickListener mItemClickListener) {
this.mOnItemClickListener = mItemClickListener;
}
public ServerApater(Context context, List<CommonModels> items) {
this.items = items;
ctx = context;
}
@Override
public ServerApater.OriginalViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
ServerApater.OriginalViewHolder vh;
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_server, parent, false);
vh = new ServerApater.OriginalViewHolder(v);
return vh;
}
@Override
public void onBindViewHolder(final ServerApater.OriginalViewHolder holder, final int position) {
CommonModels obj = items.get(position);
holder.name.setText(obj.getTitle());
if (position==0){
viewHolder=holder;
new DetailsActivity().iniMoviePlayer(obj.getStremURL(),obj.getServerType(),ctx);
holder.name.setTextColor(ctx.getResources().getColor(R.color.colorPrimary));
}
holder.cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClick(v, items.get(position), position,holder);
}
}
});
}
@Override
public int getItemCount() {
return items.size();
}
public class OriginalViewHolder extends RecyclerView.ViewHolder {
public TextView name;
public CardView cardView;
public OriginalViewHolder(View v) {
super(v);
name = v.findViewById(R.id.name);
cardView=v.findViewById(R.id.card_view_home);
}
}
public void chanColor(ServerApater.OriginalViewHolder holder,int pos){
if (pos!=0){
viewHolder.name.setTextColor(ctx.getResources().getColor(R.color.grey_60));
}
if (holder!=null){
holder.name.setTextColor(ctx.getResources().getColor(R.color.grey_60));
}
}
}
现在的问题是,我不知道该怎么做。我的 Intent 中的“obj.getStremURL()”表示“无法解析符号‘obj’”
感谢任何帮助。
编辑:
我的 Activity :
public class DetailsActivity extends AppCompatActivity {
int i = 0;
private TextView tvName,tvDirector,tvRelease,tvCast,tvDes,tvGenre,tvRelated;
private RecyclerView rvDirector,rvServer,rvRelated,rvComment;
public static RelativeLayout lPlay;
private EpisodeAdapter episodeAdapter;
private HomePageAdapter relatedAdapter;
private LiveTvHomeAdapter relatedTvAdapter;
public static LinearLayout llBottom,llBottomParent,llcomment;
private SwipeRefreshLayout swipeRefreshLayout;
private String type="",id="";
private ImageView imgAddFav;
public static ImageView imgBack;
public static ImageView imgPlayer;
private String V_URL = "";
public static WebView webView;
public static ProgressBar progressBar;
private boolean isFav = false;
private ShimmerFrameLayout shimmerFrameLayout;
private Button btnComment;
private EditText etComment;
private CommentsAdapter commentsAdapter;
private String commentURl;
private AdView adView;
private InterstitialAd mInterstitialAd;
public static SimpleExoPlayer player;
public static PlayerView simpleExoPlayerView;
public static SubtitleView subtitleView;
public static ImageView imgFull;
public static ImageView imgfit;
public static boolean isPlaying,isFullScr;
public static View playerLayout;
private int playerHeight;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
imgPlayer=findViewById(R.id.img_player);
shimmerFrameLayout.startShimmer();
playerHeight = lPlay.getLayoutParams().height;
progressBar.setMax(100); // 100 maximum value for the progress value
progressBar.setProgress(50);
imgBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
imgPlayer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(obj.getStremURL()), "video/*");
startActivity(Intent.createChooser(intent, "Complete action using"));
}
});
type = getIntent().getStringExtra("vType");
id = getIntent().getStringExtra("id");
final SharedPreferences preferences=getSharedPreferences("user",MODE_PRIVATE);
if (preferences.getBoolean("status",false)){
imgAddFav.setVisibility(VISIBLE);
}else {
imgAddFav.setVisibility(GONE);
}
imgFull.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isFullScr){
isFullScr=false;
showSystemUI();
llBottomParent.setVisibility(VISIBLE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
lPlay.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, playerHeight));
imgfit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
}
});
}else {
hideSystemUI();
isFullScr=true;
llBottomParent.setVisibility(GONE);
lPlay.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
imgfit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
i++;
Runnable r = new Runnable() {
@Override
public void run() {
i = 0;
}
};
if (i == 1) {
//Single click
simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL);
} else if (i == 2) {
//Double click
i = 0;
simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_ZOOM);
} else if (i == 3) {
// Triple Click
i = 0;
simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
} else if (i == 4) {
// Fourth Click
i = 0;
simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL);
}
}
});
}
}
});
imgAddFav.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String url = new ApiResources().getAddFav()+"&&user_id="+preferences.getString("id","0")+"&&videos_id="+id;
if (isFav){
String removeURL = new ApiResources().getRemoveFav()+"&&user_id="+preferences.getString("id","0")+"&&videos_id="+id;
removeFromFav(removeURL);
}else {
addToFav(url);
}
}
});
if (!isNetworkAvailable()){
new ToastMsg(DetailsActivity.this).toastIconError(getString(R.string.no_internet));
}
initGetData();
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
initGetData();
}
});
}
private void initGetData(){
if (!type.equals("tv")){
//----related rv----------
relatedAdapter=new HomePageAdapter(this,listRelated);
rvRelated.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false));
rvRelated.setHasFixedSize(true);
rvRelated.setAdapter(relatedAdapter);
if (type.equals("tvseries")){
rvRelated.removeAllViews();
listRelated.clear();
rvServer.removeAllViews();
listDirector.clear();
listEpisode.clear();
episodeAdapter=new EpisodeAdapter(this,listDirector);
rvServer.setLayoutManager(new LinearLayoutManager(this));
rvServer.setHasFixedSize(true);
rvServer.setAdapter(episodeAdapter);
getSeriesData(type,id);
}else {
rvServer.removeAllViews();
listDirector.clear();
rvRelated.removeAllViews();
listRelated.clear();
serverApater=new ServerApater(this,listDirector);
rvServer.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false));
rvServer.setHasFixedSize(true);
rvServer.setAdapter(serverApater);
getData(type,id);
final ServerApater.OriginalViewHolder[] viewHolder = {null};
serverApater.setOnItemClickListener(new ServerApater.OnItemClickListener() {
@Override
public void onItemClick(View view, CommonModels obj, int position, ServerApater.OriginalViewHolder holder) {
iniMoviePlayer(obj.getStremURL(),obj.getServerType(),DetailsActivity.this);
serverApater.chanColor(viewHolder[0],position);
holder.name.setTextColor(getResources().getColor(R.color.colorPrimary));
viewHolder[0] =holder;
}
});
}
SharedPreferences sharedPreferences=getSharedPreferences("user",MODE_PRIVATE);
String url = new ApiResources().getFavStatusURl()+"&&user_id="+sharedPreferences.getString("id","0")+"&&videos_id="+id;
if (sharedPreferences.getBoolean("status",false)){
getFavStatus(url);
}
}else {
llcomment.setVisibility(GONE);
tvRelated.setText("All TV :");
rvServer.removeAllViews();
listDirector.clear();
rvRelated.removeAllViews();
listRelated.clear();
//----related rv----------
relatedTvAdapter=new LiveTvHomeAdapter(this,listRelated);
rvRelated.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false));
rvRelated.setHasFixedSize(true);
rvRelated.setAdapter(relatedTvAdapter);
imgAddFav.setVisibility(GONE);
serverApater=new ServerApater(this,listDirector);
rvServer.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false));
rvServer.setHasFixedSize(true);
rvServer.setAdapter(serverApater);
getTvData(type,id);
llBottom.setVisibility(GONE);
final ServerApater.OriginalViewHolder[] viewHolder = {null};
serverApater.setOnItemClickListener(new ServerApater.OnItemClickListener() {
@Override
public void onItemClick(View view, CommonModels obj, int position, ServerApater.OriginalViewHolder holder) {
iniMoviePlayer(obj.getStremURL(),obj.getServerType(),DetailsActivity.this);
serverApater.chanColor(viewHolder[0],position);
holder.name.setTextColor(getResources().getColor(R.color.colorPrimary));
viewHolder[0] =holder;
}
});
}
}
private void initWeb(String s){
if (isPlaying){
player.release();
}
progressBar.setVisibility(GONE);
webView.loadUrl(s);
webView.setVisibility(VISIBLE);
playerLayout.setVisibility(GONE);
}
public void iniMoviePlayer(String url,String type,Context context){
Log.e("vTYpe :: ",type);
if (type.equals("embed") || type.equals("vimeo") || type.equals("gdrive")){
initWeb(url);
}else {
initVideoPlayer(url,context,type);
}
}
public void initVideoPlayer(String url,Context context,String type){
progressBar.setVisibility(VISIBLE);
if (player!=null){
player.release();
}
webView.setVisibility(GONE);
playerLayout.setVisibility(VISIBLE);
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelection.Factory videoTrackSelectionFactory = new
AdaptiveTrackSelection.Factory(bandwidthMeter);
TrackSelector trackSelector = new
DefaultTrackSelector(videoTrackSelectionFactory);
player = ExoPlayerFactory.newSimpleInstance(context, trackSelector);
player.setPlayWhenReady(true);
simpleExoPlayerView.setPlayer(player);
simpleExoPlayerView.setControllerVisibilityListener(new PlayerControlView.VisibilityListener() {
@Override
public void onVisibilityChange(int visibility) {
Log.e("Visibil", String.valueOf(visibility));
if (visibility==0){
imgBack.setVisibility(VISIBLE);
imgFull.setVisibility(VISIBLE);
imgfit.setVisibility(VISIBLE);
}else {
imgBack.setVisibility(GONE);
imgFull.setVisibility(GONE);
imgfit.setVisibility(GONE);
}
}
});
Uri uri = Uri.parse(url);
MediaSource mediaSource = null;
if (type.equals("hls")){
mediaSource = hlsMediaSource(uri,context);
}else if (type.equals("youtube")){
Log.e("youtube url :: ",url);
extractYoutubeUrl(url,context);
}
else if (type.equals("rtmp")){
mediaSource=rtmpMediaSource(uri);
}else {
mediaSource=mediaSource(uri);
}
player.prepare(mediaSource, true, false);
player.addListener(new Player.DefaultEventListener() {
@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
if (playWhenReady && playbackState == Player.STATE_READY) {
isPlaying=true;
progressBar.setVisibility(View.GONE);
Log.e("STATE PLAYER:::", String.valueOf(isPlaying));
}
else if (playbackState==Player.STATE_READY){
progressBar.setVisibility(View.GONE);
isPlaying=false;
Log.e("STATE PLAYER:::", String.valueOf(isPlaying));
}
else if (playbackState==Player.STATE_BUFFERING) {
isPlaying=false;
progressBar.setVisibility(VISIBLE);
Log.e("STATE PLAYER:::", String.valueOf(isPlaying));
} else {
// player paused in any state
isPlaying=false;
Log.e("STATE PLAYER:::", String.valueOf(isPlaying));
}
}
});
}
private void extractYoutubeUrl(String url,Context context) {
new YouTubeExtractor(context) {
@Override
public void onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta vMeta) {
if (ytFiles != null) {
int itag = 18;
String downloadUrl = ytFiles.get(itag).getUrl();
Log.e("YOUTUBE::", String.valueOf(downloadUrl));
try {
MediaSource mediaSource = mediaSource(Uri.parse(downloadUrl));
player.prepare(mediaSource, true, false);
}catch (Exception e){
}
}
}
}.extract(url, true, true);
}
private MediaSource rtmpMediaSource(Uri uri){
MediaSource videoSource = null;
RtmpDataSourceFactory dataSourceFactory = new RtmpDataSourceFactory();
videoSource = new ExtractorMediaSource.Factory(dataSourceFactory)
.createMediaSource(uri);
return videoSource;
}
private MediaSource hlsMediaSource(Uri uri,Context context){
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context,
Util.getUserAgent(context, "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/JioTV/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"), bandwidthMeter);
MediaSource videoSource = new HlsMediaSource.Factory(dataSourceFactory)
.createMediaSource(uri);
return videoSource;
}
private MediaSource mediaSource(Uri uri){
return new ExtractorMediaSource.Factory(
new DefaultHttpDataSourceFactory("exoplayer")).
createMediaSource(uri);
}
private void addToFav(String url){
JsonObjectRequest jsonObjectRequest=new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
if (response.getString("status").equals("success")){
new ToastMsg(DetailsActivity.this).toastIconSuccess(response.getString("message"));
isFav=true;
imgAddFav.setBackgroundResource(R.drawable.outline_favorite_24);
}else {
new ToastMsg(DetailsActivity.this).toastIconError(response.getString("message"));
}
}catch (Exception e){
}finally {
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
new ToastMsg(DetailsActivity.this).toastIconError(getString(R.string.error_toast));
}
});
new VolleySingleton(DetailsActivity.this).addToRequestQueue(jsonObjectRequest);
}
private void getTvData(String vtype,String vId){
String type = "&&type="+vtype;
String id = "&id="+vId;
String url = new ApiResources().getDetails()+type+id;
JsonObjectRequest jsonObjectRequest=new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
swipeRefreshLayout.setRefreshing(false);
shimmerFrameLayout.stopShimmer();
shimmerFrameLayout.setVisibility(GONE);
try {
tvName.setText(response.getString("tv_name"));
tvDes.setText(response.getString("description"));
V_URL=response.getString("stream_url");
CommonModels model=new CommonModels();
model.setTitle("HD");
model.setStremURL(V_URL);
model.setServerType(response.getString("stream_from"));
listDirector.add(model);
JSONArray jsonArray = response.getJSONArray("all_tv_channel");
for (int i=0;i<jsonArray.length();i++){
JSONObject jsonObject=jsonArray.getJSONObject(i);
CommonModels models =new CommonModels();
models.setImageUrl(jsonObject.getString("poster_url"));
models.setTitle(jsonObject.getString("tv_name"));
models.setVideoType("tv");
models.setId(jsonObject.getString("live_tv_id"));
listRelated.add(models);
}
relatedTvAdapter.notifyDataSetChanged();
JSONArray serverArray = response.getJSONArray("additional_media_source");
for (int i = 0;i<serverArray.length();i++){
JSONObject jsonObject=serverArray.getJSONObject(i);
CommonModels models=new CommonModels();
models.setTitle(jsonObject.getString("label"));
models.setStremURL(jsonObject.getString("url"));
models.setServerType(jsonObject.getString("source"));
listDirector.add(models);
}
serverApater.notifyDataSetChanged();
}catch (Exception e){
}finally {
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
swipeRefreshLayout.setRefreshing(false);
}
});
new VolleySingleton(DetailsActivity.this).addToRequestQueue(jsonObjectRequest);
}
private void getSeriesData(String vtype,String vId){
String type = "&&type="+vtype;
String id = "&id="+vId;
String url = new ApiResources().getDetails()+type+id;
JsonObjectRequest jsonObjectRequest=new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
swipeRefreshLayout.setRefreshing(false);
shimmerFrameLayout.stopShimmer();
shimmerFrameLayout.setVisibility(GONE);
try {
tvName.setText(response.getString("title"));
tvRelease.setText("Release On "+response.getString("release"));
tvDes.setText(response.getString("description"));
//----realted post---------------
JSONArray relatedArray = response.getJSONArray("related_tvseries");
for (int i = 0;i<relatedArray.length();i++){
JSONObject jsonObject=relatedArray.getJSONObject(i);
CommonModels models=new CommonModels();
models.setTitle(jsonObject.getString("title"));
models.setImageUrl(jsonObject.getString("thumbnail_url"));
models.setId(jsonObject.getString("videos_id"));
models.setVideoType("tvseries");
listRelated.add(models);
}
relatedAdapter.notifyDataSetChanged();
//----episode------------
JSONArray mainArray = response.getJSONArray("season");
for (int i = 0;i<mainArray.length();i++){
//epList.clear();
JSONObject jsonObject=mainArray.getJSONObject(i);
CommonModels models=new CommonModels();
String season_name=jsonObject.getString("seasons_name");
models.setTitle(jsonObject.getString("seasons_name"));
Log.e("Season Name 1::",jsonObject.getString("seasons_name"));
JSONArray episodeArray=jsonObject.getJSONArray("episodes");
List<EpiModel> epList=new ArrayList<>();
for (int j=0;j<episodeArray.length();j++){
JSONObject object =episodeArray.getJSONObject(j);
EpiModel model=new EpiModel();
model.setSeson(season_name);
model.setEpi(object.getString("episodes_name"));
model.setStreamURL(object.getString("file_url"));
model.setServerType(object.getString("file_type"));
epList.add(model);
}
models.setListEpi(epList);
listDirector.add(models);
episodeAdapter=new EpisodeAdapter(DetailsActivity.this,listDirector);
rvServer.setAdapter(episodeAdapter);
episodeAdapter.notifyDataSetChanged();
}
}catch (Exception e){
}finally {
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
swipeRefreshLayout.setRefreshing(false);
}
});
new VolleySingleton(DetailsActivity.this).addToRequestQueue(jsonObjectRequest);
}
private void getData(String vtype,String vId){
String type = "&&type="+vtype;
String id = "&id="+vId;
String url = new ApiResources().getDetails()+type+id;
JsonObjectRequest jsonObjectRequest=new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
shimmerFrameLayout.stopShimmer();
shimmerFrameLayout.setVisibility(GONE);
swipeRefreshLayout.setRefreshing(false);
try {
tvName.setText(response.getString("title"));
tvRelease.setText("Released On "+response.getString("release"));
tvDes.setText(response.getString("description"));
//----realted post---------------
JSONArray relatedArray = response.getJSONArray("related_movie");
for (int i = 0;i<relatedArray.length();i++){
JSONObject jsonObject=relatedArray.getJSONObject(i);
CommonModels models=new CommonModels();
models.setTitle(jsonObject.getString("title"));
models.setImageUrl(jsonObject.getString("thumbnail_url"));
models.setId(jsonObject.getString("videos_id"));
models.setVideoType("movie");
listRelated.add(models);
}
relatedAdapter.notifyDataSetChanged();
}catch (Exception e){
}finally {
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
swipeRefreshLayout.setRefreshing(false);
}
});
new VolleySingleton(DetailsActivity.this).addToRequestQueue(jsonObjectRequest);
}
}
最佳答案
试试这个
// i have edit your adapter class
public class ServerApater extends RecyclerView.Adapter<ServerApater.OriginalViewHolder> {
private List<CommonModels> items = new ArrayList<>();
private Context ctx;
private View.OnClickListener onClickListener;
public ServerApater(Context context, List<CommonModels> items,View.OnClickListener onClickListener) {
this.items = items;
ctx = context;
this.onClickListener=onClickListener;
}
@Override
public ServerApater.OriginalViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
ServerApater.OriginalViewHolder vh;
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_server, parent, false);
v.findViewById(R.id.card_view_home).setOnClickListener(onClickListener);
vh = new ServerApater.OriginalViewHolder(v);
return vh;
}
@Override
public void onBindViewHolder(final ServerApater.OriginalViewHolder holder, final int position) {
CommonModels obj = items.get(position);
holder.name.setText(obj.getTitle());
if (position==0){
viewHolder=holder;
new DetailsActivity().iniMoviePlayer(obj.getStremURL(),obj.getServerType(),ctx);
holder.name.setTextColor(ctx.getResources().getColor(R.color.colorPrimary));
}
holder.cardView.setTag(obj);
}
@Override
public int getItemCount() {
return items.size();
}
public class OriginalViewHolder extends RecyclerView.ViewHolder {
public TextView name;
public CardView cardView;
public OriginalViewHolder(View v) {
super(v);
name = v.findViewById(R.id.name);
cardView=v.findViewById(R.id.card_view_home);
}
}
public void chanColor(ServerApater.OriginalViewHolder holder,int pos){
if (pos!=0){
viewHolder.name.setTextColor(ctx.getResources().getColor(R.color.grey_60));
}
if (holder!=null){
holder.name.setTextColor(ctx.getResources().getColor(R.color.grey_60));
}
}
}
// call Adapter from activity like this
ServerApater serverApater=new ServerApater(this,"pass here commonModel type
list",this);
// implement View.OnClickListener with Activity like this
AppActivity extends AppCompatActivity implements View.OnClickListener
// then implement onclick() method
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.card_view_home:
CommonModels obj = (CommonModels) v.getTag();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(obj.getStremURL()), "video/*");
startActivity(Intent.createChooser(intent, "Complete action using"));
break;
}
}
关于java - 从适配器获取链接到 Activity ,然后在外部播放器中打开链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56297562/
我有 3 个 AutoCompleteTextView,我想在它们上面注册 2 个 String[] 适配器。目前,我正在这样做: atw_from.setAdapter(new ArrayAdapt
我需要实现一个 recyclerView 来显示我对 Parse 的查询,所以我已经做到了: private class Pagination extends RecyclerView.OnScro
我对 BizTalk 相当陌生,目前我只是探索它的功能并了解不同部分(架构、编排、端口等)如何协同工作。我对其适配器有疑问: 不同的适配器是否已经随 BizTalk 服务器安装一起预装并准备好配置,或
我在 BizTalk 中测试 MQSC 适配器以与 Z/OS 主机上的队列通信时遇到问题。 测试场景:通过 Biztalk 发送消息时,我(强制)停止并启动主机 channel ,以模拟主机 IPL。
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
我想用我的音频单元在iPhone上录制一条音频信号,该信号来自一条普通的3.5毫米音频电缆(例如,另一部iPhone作为声源)。 由于iPhone具有4端口耳机插孔,因此无法直接插入。 我尝试了不同种
[请参阅下面的更新] 我很难定义模式。我的同事说这是适配器模式。我不知道。我们陷入困境主要是因为我们想要正确命名我们的组件。 问题:是适配器模式吗?如果不是的话是什么?如果是其他事情,这是实现这个想法
我有点不熟悉Java KeyAdapter有效,并且使用 KeyAdapter 使用以下代码得到了意想不到的结果。当按下一个键而另一个键已按下时,就会出现此问题,无论 isKeyPressed() 是
我想知道如何通过 ORM 适配器使用 Node.js 在 MySQL 中创建多个表。我通过模型创建了一个表,即“us.js” module.exports = { identity: 'us'
我有一个 JavaFx 客户端。我正在使用一个具有 ObservableSet 作为字段的 bean 作为模型。我想将这些数据显示到 ListView 中,但我无法将我的字段类型更改为 Observa
我正在尝试在 native iOS 应用程序中实现基于表单的身份验证,但我需要在没有收到质询的情况下登录,我想打开一个表单并登录。我实现了一个包含 isCustomResponse 函数的 Chall
我正在尝试为我的迭代器和 const_iterator 类实现反向迭代器适配器,但遇到了一些麻烦。如果有人可以指导我解决这个问题,将不胜感激! 我的想法是我应该能够从我的 rbegin() 和 ren
使用 spring-integration-sftp,创建任意数量的入站 channel 适配器对象的推荐方法是什么?我的应用程序需要监视多个远程目录(1 到 n),直到运行时才知道。 最佳答案 当前
我正在尝试为我们自己的框架创建适配器。我们的框架使用自己的断言机制,因此我需要编写适配器。 适配器类非常简单,如下所示: public class AllureReportListener {
有没有什么方法可以使用命令行而不是使用 Worklight 控制台来部署 Worklight 适配器? (因为我的 worklight 服务器安装在 WAS 上,wsadmin 命令或类似的命令...
我想构建自己的自定义 log4j(网络)适配器来解决我的问题 that I posted here. 我查看了 log4j 的文档,但看不到开发人员在哪里/是否讨论如何执行此操作。 有人能给我指出正确
我使用消息驱动 channel 适配器从 weblogic JMS 队列接收作为字符串的 xml 消息,然后将此消息传递到 spring 集成 channel 以存储到数据库中,转换为不同的 xml,
有没有什么方法可以使用命令行而不是使用 Worklight 控制台来部署 Worklight 适配器? (因为我的 worklight 服务器安装在 WAS 上,wsadmin 命令或类似的命令...
我试图为 Android 制作一个聊天应用程序,所以我使用了 RecyclerView 。我的适配器有问题,我的聊天室收到的 JSON 响应显示为空白。我的代码是否遗漏了某些内容? 这是我的适配器类
如果这是重复的,我提前道歉。我对 Android 开发还是新手,并尝试寻找解决方案,但找不到有效的解决方案。 我正在创建一个待办事项应用程序并在我的适配器中收到此错误。 java.lang.NullP
我是一名优秀的程序员,十分优秀!