Skip to content

Commit f2b7649

Browse files
committed
End of video 5
1 parent e5aaa4b commit f2b7649

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

.idea/workspace.xml

Lines changed: 25 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/teamtreehouse/cameraworkshop/MainActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
4343
super.onActivityResult(requestCode, resultCode, data);
4444

4545
if (resultCode == RESULT_OK) {
46-
46+
if (requestCode == REQUEST_TAKE_PHOTO) {
47+
Intent intent = new Intent(this, ViewImageActivity.class);
48+
intent.setData(mMediaUri);
49+
startActivity(intent);
50+
}
4751
}
4852
else if (resultCode != RESULT_CANCELED) {
4953
Toast.makeText(this, "Sorry, there was an error!", Toast.LENGTH_LONG).show();

app/src/main/java/com/teamtreehouse/cameraworkshop/ViewImageActivity.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package com.teamtreehouse.cameraworkshop;
22

3+
import android.content.Intent;
4+
import android.net.Uri;
35
import android.os.Bundle;
46
import android.support.v7.app.AppCompatActivity;
57
import android.widget.ImageView;
68

9+
import com.squareup.picasso.Picasso;
10+
711
public class ViewImageActivity extends AppCompatActivity {
812

913
public static final String TAG = ViewImageActivity.class.getSimpleName();
@@ -15,6 +19,8 @@ protected void onCreate(Bundle savedInstanceState) {
1519

1620
ImageView imageView = (ImageView)findViewById(R.id.imageView);
1721

18-
22+
Intent intent = getIntent();
23+
Uri imageUri = intent.getData();
24+
Picasso.with(this).load(imageUri).into(imageView);
1925
}
2026
}

0 commit comments

Comments
 (0)