Valentino Ru
Valentino Ru

Reputation: 5052

Android: load, manipulate and use Image

I have a value in my Activity which represents the "progress" of a certain player in context of a goal to achieve (e.g., a player needs 10 wins, he got 3 wins -> progress = 30%).

What I want now is to load an "empty" Image and fill it relative to the progress value.

E.g.

enter image description here

is manipulated to

enter image description here

But now I absolutely don't know how to achieve this. I had in mind that the easiest way would be a Java-function with parameter progress that loads that empty image and draws x vertical lines (whereby x is = progress as int) on that image and returns it.

Now I've read some Tutorials, but I still don't get how I can load that png, draw some stuff on it and return it whitout saving the drawings in it. Has anyone an idea how to perform this?

Upvotes: 1

Views: 104

Answers (1)

deefactorial
deefactorial

Reputation: 323

You can use the Android progress bar feature. http://developer.android.com/reference/android/widget/ProgressBar.html

If you don't want it in a dialog then you can embed it directly.

Here is a another answer that may help: Android progress bar embedded in ui and not in dialog

Here is how to create a custom progress dialog: Custom Drawable for ProgressBar/ProgressDialog

Hope that helps.

Upvotes: 1

Related Questions