With this code (sbJava is a StringBuilder):
String androidFindLine = string.Format("Button _{0} = (Button) findViewById(R.id.{0});\"", btnId);
sbJava.Append(androidFindLine);
sbJava.Append(Environment.NewLine);
sbJava.Append(string.Format("_{0}.setOnClickListener(new View.OnClickListener() { ", btnId));
...I get,
System.FormatException was unhandled _HResult=-2146233033 _message=Input string was not in a correct format...
The value of btnId is "btnbutton_up"
What is the problem?
You should escape those { with double {{:
sbJava.Append(string.Format("_{0}.setOnClickListener(new View.OnClickListener() {{ ", btnId));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With