Posts by cd1 • 196 points
10 posts
-
0
votes1
answer24
viewsA: How to pass a parameter from an Activity b to Activity A
You need to use the Activity Result API methods for this. Really, if you call a startActivityForResult in the second Activity, the first Activity will be started from scratch, and is not what you…
-
1
votes1
answer42
viewsA: Receive response Okhttp KOTLIN
In his method get(), you’re calling two different methods: println(responseBody!!.string()) return responseBody.toString() string() and toString(). The method string() returns the body of your…
-
0
votes1
answer28
viewsA: how to filter what will appear in Recyclerview
Recyclerview will show the data that it has, in case of your code, it will show the data in mydoes. If you want to filter the result in Recyclerview, the best way is to filter it externally (e.g. in…
-
0
votes1
answer52
viewsA: I cannot call an "id" of the "Mainactivity.kt" file inside the "activity_main.xml" file
The simplest way to get your View reference is: class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState)…
-
3
votes1
answer48
viewsA: How to get the value of a JSON field
You are accessing the JSON file as if it had another structure. View JSON content in a more structured and easy-to-understand way: { "type": "RichMessage", "message": { "type": "ChatWindowMenu",…
-
1
votes3
answers87
viewsA: In the Kotlin language, how to access a public variable that is in one class, through another class?
You need to get an object from the class it contains variavel_de_tipo_public_string and access this variable from it. For example: class UmaClasse { var variavel_de_tipo_public_string: String =…
-
0
votes1
answer21
viewsA: Error with Nav Controller
You need to call the method findNavController passing the view ID NavHostFragment. That is, in the method configNavDrawer, instead of: val navController =…
-
0
votes1
answer24
viewsA: Response from the API
Since you’re using coroutine, you don’t need the return of your @GET method to be a Response<...>, just be your object PokemonsResponse direct. That is, modify your class API so that the…
-
0
votes1
answer20
viewsA: Viewmodel with Hilt
Hilt never injects ViewModels (take a look at https://dagger.dev/hilt/view-model.html for more information). You need to initialize your ViewModel in Mainactivity to be able to use it. I suggest the…
-
0
votes1
answer67
viewsA: 'onCreate' overrides Nothing - Kotlin
Welcome to Stack Overflow. The method onCreate should receive only the parameter savedInstanceState, without the dolarResult. The error indicates that you are trying to overwrite a method that does…