[JAVA] Uri → String, String → Uri type conversion

I will leave it as a memo.

Uri → String

This can be done normally by using the toString () method.


Uri uri;
String stringUri;
stringUri = uri.toString();

String → Uri

This can be achieved by using the ʻUri.parse () `method.


Uri uri;
String stringUri;
uri = Uri.parse(stringUri);

If it helps someone.

Recommended Posts

Uri → String, String → Uri type conversion
Java-automatic type conversion
Java date data type conversion (Date, Calendar, String)
Java 8 LocalDateTime type conversion stuff (String, java.util.Date)
Type conversion from java BigDecimal type to String type
URL to String conversion
Java type conversion (String, int, Date, Calendar, etc.)
Leet string conversion program
[Java] Date type conversion
[Java] List type / Array type conversion
Conversion of String, Date, LocalDate
[Java] Precautions for type conversion
[Java] Type conversion speed comparison
Java Primer Series (Type Conversion)
Numerical value (int) ⇔ character string (String) conversion
String
[Java] Correct comparison of String type
Full-width → half-width conversion with Java String (full-width kana → half-width kana)
Regarding String type equivalence comparison in Java
[Java ~ Variable definition, type conversion ~] Study memo
[Java] Data type / string class cheat sheet
Java study # 3 (type conversion and instruction execution)
Notes on operators using Java ~ String type ~
[Java] Convert Object type null to String type
[Basic knowledge of Java] About type conversion
Example of using ArAutoValueConverter (field type conversion)
[Java] Comparison of String type character strings
[Java] Calculation mechanism, operators and type conversion