title: How to update user Profile textfields and profile photo same time on Android Using Retrofit 2
body: <p>I'am using Retrofit 2.I'am trying to implement "PATCH" method to updating profile photo on main thread.I also tried on Postman.I can update the profile photo.</p>
  
  <h2><a href="https://i.stack.imgur.com/SGkIQ.png" rel="nofollow noreferrer">PATCH request success</a></h2>
  
  <p>This is my interface when I use calls.Also UpdateUser is the model w</p>
  
  <pre><code> @PATCH("user/{username}/")
  Call&lt;User&gt; updateUserProfile(@Path("username") String username, @Body UpdateUser User);
  </code></pre>
  
  <hr>
  
  <p>This is my User Model</p>
  
  <pre><code>public class User {
  
  @SerializedName("username")
  @Expose
  private String username;
  
  @SerializedName("first_name")
  @Expose
  private String firstName;
  
  @SerializedName("last_name")
  @Expose
  private String lastName;
  
  @SerializedName("profile_photo")
  @Expose
  private String profilePhoto;
  
  public String getUsername() {
      return username;
  }
  
  public void setUsername(String username) {
      this.username = username;
  }
  
  public String getFirstName() {
      return firstName;
  }
  
  public void setFirstName(String firstName) {
      this.firstName = firstName;
  }
  
  public String getLastName() {
      return lastName;
  }
  
  public void setLastName(String lastName) {
      this.lastName = lastName;
  }
  
  public String getProfilePhoto() {
      return profilePhoto;
  }
  
  public void setProfilePhoto(String profilePhoto) {
      this.profilePhoto = profilePhoto;
  }
  </code></pre>
  
  <hr>
  
  <p>This is my ProfileUpdatePresenter I handle request here</p>
  
  <pre><code>   public class ProfileUpdatePresenter
    {
    private ProfileUpdateView profileView;
    private ApiInterface apiInterface =           
    MyAPIClient.getClient().create(ApiInterface.class);
  
    public ProfileUpdatePresenter(ProfileUpdateView profileView) {
      this.profileView = profileView;
    }
  </code></pre>
  
  <p>I get user on this method</p>
  
  <pre><code>public void getUserProfile(Activity activity, String username) {
      apiInterface.getUserProfile(username).enqueue(new CustomCallBack&lt;User&gt;(activity) {
          @Override
          public void onResponse(@NonNull Call&lt;User&gt; call, @NonNull Response&lt;User&gt; response) {
              super.onResponse(call,response);
              if(response.isSuccessful()) {
                  profileView.onProfileGet(response.body());
              }
          }
  
          @Override
          public void onFailure(@NonNull Call&lt;User&gt; call, @NonNull Throwable t) {
              super.onFailure(call,t);
          }
      });
  }
  </code></pre>
  
  <hr>
  
  <p>I update User here</p>
  
  <pre><code> public void updateUserProfile(Activity activity, String Username, UpdateUser User){
      apiInterface.updateUserProfile(Username,User).enqueue(new CustomCallBack&lt;User&gt;(activity) {
          @Override
          public void onResponse(@NonNull Call&lt;User&gt; call, @NonNull Response&lt;User&gt; response) {
              super.onResponse(call,response);
              if(response.isSuccessful()) {
                  profileView.onUpdateSucceed(response.body());
              }
          }
          @Override
          public void onFailure(@NonNull Call&lt;User&gt; call, @NonNull Throwable t) {
              super.onFailure(call,t);
  
          }
      });
  </code></pre>
  
  <hr>
  
  <p>On my UpdateProfile Activity.I get the user by implementing My presenter's methods.Then also I update here.But I'am confused on how to update my profile photo here.</p>
  
  <pre><code> @Override
  public void onProfileGet(@NotNull User user) {
      UserProfile = user;
      if(UserProfile.getFirstName() != null)
          et_name.setText(UserProfile.getFirstName());
      if(UserProfile.getLastName() != null)
          et_surname.setText(UserProfile.getLastName());
      if(UserProfile.getPhone() != null)
   }
  </code></pre>
  
  <hr>
  
  <p>I also use interface to implement methods that I use on main thread</p>
  
  <pre><code>public interface ProfileUpdateView {
  void onProfileGet(@NotNull User user);
  void onUpdateSucceed(@NotNull User user);
  </code></pre>
  
  <p>}</p>
  
  <hr>
  
  <p>To be honest The main Problem for me is how to Use My Old @PATCH for updating the profile photo.Basically How to combine these on one Call?</p>
  
  <pre><code>@PATCH("user/{username}/")
  Call&lt;User&gt; updateUserProfile(@Path("username") String username, @Body UpdateUser User);
     + 
  @Multipart
  @PATCH("/retrofit_tutorial/retrofit_client.php")
  Call&lt;ServerResponse&gt; uploadFile(@Part MultipartBody.Part file, @Part("file") RequestBody name);
  </code></pre>