0

同じビューでビデオと 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);
    }
}

ビデオ ボタンは正常に機能しますが、リンク ボタンはまったく機能しません。実行するとこんな感じです。

リンク 助けてください!

4

1 に答える 1

2

これに合わせて openWebUrl() メソッドを変更すると、問題が解決します。

public void openWebURL(String fullUrl){
    Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(fullUrl));
    startActivity(intent);
}
于 2011-09-07T14:33:34.773 に答える