同じビューでビデオと Web サイトにリンクするアプリに取り組んでいます。私が抱えている問題は、ビデオとリンクを同時にリンクして別々のビューにする方法です。これは私がこれまでに持っているものです:
private String videoUrl;
private String fullUrl;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.details);
TextView detailsTitle = (TextView)findViewById(R.id.detailstitle);
TextView detailsDescription = (TextView)findViewById(R.id.detailsdescription);
TextView detailsPubdate = (TextView)findViewById(R.id.detailspubdate);
TextView detailsLink = (TextView)findViewById(R.id.detailslink);
TextView detailsEnclosure = (TextView)findViewById(R.id.detailsenclosure);
Button linkButton = (Button)findViewById(R.id.linkButton);
View VideoPlay = findViewById(R.id.videoButton);
VideoPlay.setOnClickListener(this);
Bundle bundle = this.getIntent().getExtras();
detailsTitle.setText(bundle.getString("keyTitle"));
detailsDescription.setText(bundle.getString("keyDescription"));
detailsPubdate.setText(bundle.getString("keyPubdate"));
detailsLink.setText(bundle.getString("keyLink"));
linkButton.setText("View this in full website");
videoUrl = bundle.getString("keyEnclosure");
fullUrl = bundle.getString("keyLink");
}
//Process the button click events
public void onClick(View videoplayer) {
Intent VideoPlay = new Intent(this, VideoPlayer.class);
VideoPlay.putExtra("url",videoUrl);
startActivity(VideoPlay);
}
public void openWebURL(String fullUrl){
Intent Browse = new Intent(Intent.ACTION_VIEW, Uri.parse (fullUrl));
Browse.putExtra(com.CalvaryChapelMelbourne.CCM.Webscreen.URL,
"fullUrl");
startActivity(Browse);
}
}
ビデオ ボタンは正常に機能しますが、リンク ボタンはまったく機能しません。実行するとこんな感じです。