Getting EditText to String - gettext

I'm kinda new here, so my question is simple as you can see...
This is my code in the onCreate():
first_name_editText= (EditText)findViewById(R.id.first_name);
I've defined all the veriables. What's next? How do I convert the input into my variable?

You can take the value of the edit text by this code:
String fname=first_name_editText.getText().toString();

Related

Uri.Parse() is adding random characters inside the uri

When I try to create a Uri object using Uri.parse, I get %0D%0A added after `_countryCode` value
This is what gets logged
http://api.geonames.org/countryInfo?country=US%0D%0A&username=medcollapp
value of _countryCode is a string like US or IN.
_countryCode is not empty I made sure of it.
I have no idea how to fix this any help would be appreciated.

How to use dynamic map name in flutter

I want to create a new map every time the button is pressed.
I want the names of the maps to be regular.
I tried using ${} in the map name but it doesn't seem to work.
is there any solution?
You may think you want this, but you don't. Information and meta-information should remain separate. Very likely, a Map of Maps will accomplish everything you want with dynamic names.
There are a few ways to do this:
Use the sprintf function:
String mapName = sprintf("map_%d", mapNumber);
Use string interpolation:
String mapName = "map_${mapNumber}";
Use a template string:
String mapName = map_${mapNumber};

origOptions error with string containing EXDATE of jakubroztocil/rrule

Currently I am using the library jakubroztocil/rrule
When I convert a string containing EXDATE to rrule the origOptions attribute I get is always an empty object. But if I leave it out, it returns true.
Ex:
DTSTART;TZID=Asia/Saigon:20220808T080000\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO;UNTIL=20220907T170000Z
With this string I get the correct result
DTSTART;TZID=Asia/Saigon:20220808T080000\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO;UNTIL=20220907T170000Z\nEXDATE;TZID=Asia/Saigon:20220808T080000
With this string I get the wrong result
Looks like my problem will be something similar to #333
But I get nothing from it.
Thank u very much

How to display an int without commas?

I have a list of Text views that include a year saved as an int. I'm displaying it in an interpolated string:
Text("\($0.property) \($0.year) \($0.etc)")
The problem, it adds a comma to the int, for example it displays 1,944 instead of the year 1944. I'm sure this is a simple fix but i've been unable to figure out how to remove the comma. Thanks!
There is explicit Text(verbatim:) constructor to render string without localization formatting, so a solution for your case is
Text(verbatim: "\($0.property) \($0.year) \($0.etc)")
Use Text(String(yourIntValue)) if you use interpolation you need to cast it as a string directly. If you allow the int to handle it, it shows with a ,.
So to recap.
let yourIntValue = 1234
Text(String(yourIntValue)) // will return `1234`.
Text("\(yourIntValue)") // will return `1,234`.
I use the built-in format parameter. It's useful for formatting well beyond just this one specific usage (no commas).
Text("Disk Cache \(URLCache.shared.currentDiskUsage,
format: .number.grouping(.never))"))

how to use divide() method in jasper reports?

Im using iReport1.3.3 tool to create pdf and xls template ..
My problem is for the below expression,
($V{strloanNo}).divide($V{loanCalculation})
i need to divide both the variables but i am not getting expected result. it is displaying "null" value .
any idea guys?
$V{x}.divide( $V{y} )
This works for me.
It looks like your variables are Null.
Make sure to set the Initial Value Expression in the variable's properties.
I set both of mine to below.
new java.math.BigDecimal(10.0)
Guess you can try this out -
$V{strloanNo}.floatValue()/$V{loanCalculation}.floatValue()
As it was discussed
here, you can check this:
$F{Attribute_a}.divide($F{Attribute_b}, new MathContext(100))
If your division results in a non-terminating decimal then an exception is thrown. So you scale simply it to something reasonable and exception be gone.
$F{Attribute_a}.divide($F{Attribute_b})
and class type should be java.math.BigDecimal
if attribute b is zero, please put the condition