//主要活动
gameListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){ @Override public void onItemClick(AdapterView adapterView,View view,int position,long l){
// Find the current game that was clicked on
Games currentGame = mAdapter.getItem(position);
// Convert the String URL into a URI object (to pass into the Intent constructor)
Uri gameUri = Uri.parse(currentGame.getUrl());
// Create a new intent to view the game URI
Intent i = new Intent(GamesActivity.this,PreviewActivity.class);
i.putExtra("value",gameUri);
startActivity(i);
}
});
//第二活动
公共类PreviewActivity扩展了AppCompatActivity {
ImageView img;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preview);
img = findViewById(R.id.imagePreview);
Uri i = getIntent().getData();
Picasso.with(this).load(i).into(img);
}
}