As you seem to have strings that need to be (optionally) padded with zeros, you can use a different approach than generally used to pad integers:
public String addPadding(int length, String text) {
StringBuilder sb = new StringBuilder();
// First, add (length - 'length of text') number of '0'
for (int i = length - text.length(); i > 0; i--) {
sb.append('0');
}
// Next, add string itself
sb.append(text);
return sb.toString();
}
so you can use:
"B-" + // prefix
addPadding(2, LoginActivity.strEventID) + "-" + // eventID
addPadding(2, LoginActivity.strOperativeID) + "-" + // operativeID
getNextNumber() + // counter
".jpg"
There are lots of other possibilities to pad a String, see this question for more details/possibilities.
solved show 0 as prefix if value is less than 9