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 84d8fb5 commit 03e6857
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public static int getDrawable(Context context, String name)
}
```

and then in your *view class*, you have a component you want to pass the image to (for instance [ImageView](http://developer.android.com/reference/android/widget/ImageView.html)) and you do:
and then in your **view class**, you have a component you want to pass the image to (for instance [ImageView](http://developer.android.com/reference/android/widget/ImageView.html)) and you do:

```Java
ImageView img = //You either create new or find from layout
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.
**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 03e6857

Please sign in to comment.