1
진행률을 보여주는 진행률 표시 줄이있는 파일을 업로드하고 게시 방법으로 일부 매개 변수를 보내고 싶습니다. 어떻게 할 수 있습니까?retorfit이있는 파일을 업로드하고 진행 막대가있는 파일
진행률을 보여주는 진행률 표시 줄이있는 파일을 업로드하고 게시 방법으로 일부 매개 변수를 보내고 싶습니다. 어떻게 할 수 있습니까?retorfit이있는 파일을 업로드하고 진행 막대가있는 파일
당신이 개조 2를 사용하는 경우, 어쩌면 당신이 도움이 답을 찾을 수 Is it possible to show progress bar when upload image via Retrofit 2
first of yore java file in upload pic call in ....progress bar initiation...
-----------------------------------------------------
SignUp.this.findViewById(R.id.progress_bar).setVisibility(View.VISIBLE);
Call<UploadPhoto> call = apiService.uploadFile(fileToUpload, filename, api, user_email);
call.enqueue(new Callback<UploadPhoto>() {
@Override
public void onResponse(Call<UploadPhoto> call, Response<UploadPhoto> response) {
SignUp.this.findViewById(R.id.progress_bar).setVisibility(View.GONE);
UploadPhoto inquiryResponse = response.body();
if (inquiryResponse.getStatus().equals("1")) {
} else {
}
}
@Override
public void onFailure(Call<UploadPhoto> call, Throwable t) {
}
});
-----------------------------------------------------------
and then creat xml file : >> progress_uploading_layout.xml
--------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:visibility="gone"
android:background="@android:color/transparent"
android:orientation="vertical">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/uploading"
android:textColor="@color/green"
android:textSize="20sp" />
</LinearLayout>
-----------------mention your activity----
as put your activity_main as xml file ..
<include layout="@layout/progress_uploading_layout"/>