2017-10-03 10 views

Répondre

0
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"/>