1 package com.example.photoviewersample; 2 3 import android.app.Activity; 4 import android.os.Bundle; 5 import android.view.View; 6 import android.view.View.OnClickListener; 7 8 import com.android.ex.photo.Intents; 9 import com.android.ex.photo.Intents.PhotoViewIntentBuilder; 10 11 public class MainActivity extends Activity implements OnClickListener { 12 13 @Override 14 public void onCreate(Bundle savedInstanceState) { 15 super.onCreate(savedInstanceState); 16 setContentView(R.layout.activity_main); 17 View b = findViewById(R.id.button); 18 b.setOnClickListener(this); 19 } 20 21 @Override 22 public void onClick(View v) { 23 final PhotoViewIntentBuilder builder = 24 Intents.newPhotoViewActivityIntentBuilder(this); 25 builder 26 .setPhotosUri("content://com.example.photoviewersample.SampleProvider/photos"); 27 28 startActivity(builder.build()); 29 } 30 } 31