I want, when u press my button video, he randomly takes a url from my string list and goes to the url. How i can do this, i really dont know.
public class Easy extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_easy);
final String[] vList = {"https://www.google.com",
"https://www.youtube.com"};
findViewById(R.id.video).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(vList));
startActivity(i);
}
});
Aucun commentaire:
Enregistrer un commentaire