Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
filipkis committed Feb 10, 2014
1 parent a3f4385 commit 84d8fb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ and then in your *view class*, you have a component you want to pass the image t

```Java
ImageView img = //You either create new or find from layout
int drawableResId = DinnerPlannerApplication.getDrawable(view,"drawable_name_without_extension");
int drawableResId = DinnerPlannerApplication.getDrawable(view.getContext(),"drawable_name_without_extension");
img.setImageResource(drawableResId);
```

*Note:* be sure to not have extension in the drawable name. If you are using the `getImage()` from the [DinnerModel](https://github.com/kth-csc-iprog/dinnerplanner-android/tree/master/src/se/kth/csc/iprog/dinnerplanner/model) this will give you the image name with `.jpg` extension. So either modify the model, or be sure to remove the extension before you pass it to the `getDrawable()` method.

0 comments on commit 84d8fb5

Please sign in to comment.