Home>

in MainActivity. there is EditText to which the user writes nickname:

<
EditText
    Android: id= "@ + id /nicknameedittext"
    Android: Hint= "Enter the game name"
    Android: layout_width= "wrap_content"
    Android: layout_height= "wrap_content" />

How to transfer the text to the Get-queue?

Interface Apirequest {
    @Get ("Bridge? Version= 5 &
Platform= PC &
Player= $ {r.id.nicknameedittext} ")
    Fun Herlist (): Call <
Testhero >
}

I tried handicrafts as in the code above, got a mistake. The search for only the transmission of data between two or more ACTIVITY. Tell me how to implement it right?

@Get that's what? Retrofit, retrofit2 or something else? Specify in tags.

Vadik2021-08-21 12:43:14

@ This Retrrofit2 is now execution

Ethernets2021-08-21 12:49:08
  • Answer # 1

    in accordance with> Retrofit documentationThe parameter in the GET request can be passed as follows:

    Interface Apirequest {
        @Get ("Bridge? Version= 5 &
    Platform= PC ")
        Fun Herlist (@Query ("Player") Player: String): Call <
    Testhero >
    }
    

    Next, being in activati, take EditText by ID:

    Val NicknameView= FindViewByid <
    EditText >
    (R.id.nicknameedittext)
    

    Get its contents:

    Val Nickname= nicknameview.text.tostring ()
    

    Finally, call the API interface method, passing Nickname as Player:

    API.Herlist (NickName)
    

    But what about the Activity pass through the request? I do not understand this a little, I need to declare EditTextTextMultiline somewhere? Or do I not understand something?

    Ethernets2021-08-21 12:50:53

    Added in response How to pull out data from EditText

    Vadik2021-08-21 12:58:06

    Thank you so much, have a nice day

    Ethernets2021-08-21 13:05:28
  • Answer # 2

    in accordance with> Retrofit documentationThe parameter in the GET request can be passed as follows:

    Interface Apirequest {
        @Get ("Bridge? Version= 5 &
    Platform= PC ")
        Fun Herlist (@Query ("Player") Player: String): Call <
    Testhero >
    }
    

    Next, being in activati, take EditText by ID:

    Val NicknameView= FindViewByid <
    EditText >
    (R.id.nicknameedittext)
    

    Get its contents:

    Val Nickname= nicknameview.text.tostring ()
    

    Finally, call the API interface method, passing Nickname as Player:

    API.Herlist (NickName)
    

    But what about the Activity pass through the request? I do not understand this a little, I need to declare EditTextTextMultiline somewhere? Or do I not understand something?

    Ethernets2021-08-21 12:50:53

    Added in response How to pull out data from EditText

    Vadik2021-08-21 12:58:06

    Thank you so much, have a nice day

    Ethernets2021-08-21 13:05:28