error handling in synchronous calls while saving in android

Hi, please clarify how i am supposed to handle errors while making synchronus calls in android api.
For example in the code below,

contributions.setContributor_name( mCurrentUser );
    contributions.setContribution_amount( mAmount );
    contributions.setBalance_carried_forwad( balance );
    contributions.setId_no( mUserIdNo );
    contributions.setPayment_mode( mPaymentMode );

protected Contributions doInBackground( Integer... params )
    for (; count <= params[0]; count++) {
        try {
        } catch (InterruptedException e) {

protected void onProgressUpdate(Integer... values) {
    progresBarView.setProgress( values[0] );

protected void onPostExecute(Contributions contributions) {
    showToast( getResources().getString( R.string.save_success ) );
    progresBarView.setVisibility( View.GONE );
When i a user saves a duplicate value i need to handle the error and prompt him .. how do i catch or handle the response??
Thank you.

I can’t see where you call any synchronous Backendless method. Could you please clarify?

in in the function doInBackground() there’s return… which returns the object of Contribution type if saved succefully. But when there’s is an error e.g duplicate entry saving, i cant handle it or tell what is returned. Here’s the example. I want to alert user on that duplicate message…

You should wrap it into try-catch block and handle in the way you need.

Sorry i dont seem to understand you… Where exactly… should i wrap the return OR postExecute() ??

You should wrap a synchronous call to Backendless.

Thank you Sergey for you Help. It’s okay now.