Uri uri = Uri.parse("https://www.example.com"); Uri.Builder builder = uri.buildUpon(); builder.appendQueryParameter("param1", "value1"); builder.appendQueryParameter("param2", "value2"); uri = builder.build();
Uri uri = Uri.parse("https://www.example.com/api"); Uri.Builder builder = uri.buildUpon(); builder.appendPath("users"); uri = builder.build();This will add the path segment `users` to the existing Uri, resulting in `https://www.example.com/api/users`. Again, the package library used is `android.net`. Overall, the Uri class in android.net package library provides a powerful tool for parsing, manipulating, and interacting with URIs within Android apps.