Example usage for android.os AsyncTask execute

List of usage examples for android.os AsyncTask execute

Introduction

In this page you can find the example usage for android.os AsyncTask execute.

Prototype

@MainThread
public static void execute(Runnable runnable) 

Source Link

Document

Convenience version of #execute(Object) for use with a simple Runnable object.

Usage

From source file:com.shafiq.myfeedle.core.SelectFriends.java

protected void loadFriends() {
    mFriends.clear();/*from w w  w  .  j  a va2s.com*/
    //      SimpleAdapter sa = new SimpleAdapter(SelectFriends.this, mFriends, R.layout.friend, new String[]{Entities.PROFILE, Entities.FRIEND, Entities.ESID}, new int[]{R.id.profile, R.id.name, R.id.selected});
    SimpleAdapter sa = new SimpleAdapter(SelectFriends.this, mFriends, R.layout.friend,
            new String[] { Entities.FRIEND, Entities.ESID }, new int[] { R.id.name, R.id.selected });
    setListAdapter(sa);
    final ProgressDialog loadingDialog = new ProgressDialog(this);
    final AsyncTask<Long, String, Boolean> asyncTask = new AsyncTask<Long, String, Boolean>() {
        @Override
        protected Boolean doInBackground(Long... params) {
            boolean loadList = false;
            MyfeedleCrypto myfeedleCrypto = MyfeedleCrypto.getInstance(getApplicationContext());
            // load the session
            Cursor account = getContentResolver().query(Accounts.getContentUri(SelectFriends.this),
                    new String[] { Accounts.TOKEN, Accounts.SECRET, Accounts.SERVICE }, Accounts._ID + "=?",
                    new String[] { Long.toString(params[0]) }, null);
            if (account.moveToFirst()) {
                mToken = myfeedleCrypto.Decrypt(account.getString(0));
                mSecret = myfeedleCrypto.Decrypt(account.getString(1));
                mService = account.getInt(2);
            }
            account.close();
            String response;
            switch (mService) {
            case TWITTER:
                break;
            case FACEBOOK:
                if ((response = MyfeedleHttpClient.httpResponse(mHttpClient, new HttpGet(
                        String.format(FACEBOOK_FRIENDS, FACEBOOK_BASE_URL, Saccess_token, mToken)))) != null) {
                    try {
                        JSONArray friends = new JSONObject(response).getJSONArray(Sdata);
                        for (int i = 0, l = friends.length(); i < l; i++) {
                            JSONObject f = friends.getJSONObject(i);
                            HashMap<String, String> newFriend = new HashMap<String, String>();
                            newFriend.put(Entities.ESID, f.getString(Sid));
                            newFriend.put(Entities.PROFILE, String.format(FACEBOOK_PICTURE, f.getString(Sid)));
                            newFriend.put(Entities.FRIEND, f.getString(Sname));
                            // need to alphabetize
                            if (mFriends.isEmpty())
                                mFriends.add(newFriend);
                            else {
                                String fullName = f.getString(Sname);
                                int spaceIdx = fullName.lastIndexOf(" ");
                                String newFirstName = null;
                                String newLastName = null;
                                if (spaceIdx == -1)
                                    newFirstName = fullName;
                                else {
                                    newFirstName = fullName.substring(0, spaceIdx++);
                                    newLastName = fullName.substring(spaceIdx);
                                }
                                List<HashMap<String, String>> newFriends = new ArrayList<HashMap<String, String>>();
                                for (int i2 = 0, l2 = mFriends.size(); i2 < l2; i2++) {
                                    HashMap<String, String> oldFriend = mFriends.get(i2);
                                    if (newFriend == null) {
                                        newFriends.add(oldFriend);
                                    } else {
                                        fullName = oldFriend.get(Entities.FRIEND);
                                        spaceIdx = fullName.lastIndexOf(" ");
                                        String oldFirstName = null;
                                        String oldLastName = null;
                                        if (spaceIdx == -1)
                                            oldFirstName = fullName;
                                        else {
                                            oldFirstName = fullName.substring(0, spaceIdx++);
                                            oldLastName = fullName.substring(spaceIdx);
                                        }
                                        if (newFirstName == null) {
                                            newFriends.add(newFriend);
                                            newFriend = null;
                                        } else {
                                            int comparison = oldFirstName.compareToIgnoreCase(newFirstName);
                                            if (comparison == 0) {
                                                // compare firstnames
                                                if (newLastName == null) {
                                                    newFriends.add(newFriend);
                                                    newFriend = null;
                                                } else if (oldLastName != null) {
                                                    comparison = oldLastName.compareToIgnoreCase(newLastName);
                                                    if (comparison == 0) {
                                                        newFriends.add(newFriend);
                                                        newFriend = null;
                                                    } else if (comparison > 0) {
                                                        newFriends.add(newFriend);
                                                        newFriend = null;
                                                    }
                                                }
                                            } else if (comparison > 0) {
                                                newFriends.add(newFriend);
                                                newFriend = null;
                                            }
                                        }
                                        newFriends.add(oldFriend);
                                    }
                                }
                                if (newFriend != null)
                                    newFriends.add(newFriend);
                                mFriends = newFriends;
                            }
                        }
                        loadList = true;
                    } catch (JSONException e) {
                        Log.e(TAG, e.toString());
                    }
                }
                break;
            case MYSPACE:
                break;
            case LINKEDIN:
                break;
            case FOURSQUARE:
                break;
            case IDENTICA:
                break;
            case GOOGLEPLUS:
                break;
            case CHATTER:
                break;
            }
            return loadList;
        }

        @Override
        protected void onPostExecute(Boolean loadList) {
            if (loadList) {
                //               SimpleAdapter sa = new SimpleAdapter(SelectFriends.this, mFriends, R.layout.friend, new String[]{Entities.PROFILE, Entities.FRIEND}, new int[]{R.id.profile, R.id.name});
                SimpleAdapter sa = new SimpleAdapter(SelectFriends.this, mFriends, R.layout.friend,
                        new String[] { Entities.FRIEND, Entities.ESID },
                        new int[] { R.id.name, R.id.selected });
                sa.setViewBinder(mViewBinder);
                setListAdapter(sa);
            }
            if (loadingDialog.isShowing())
                loadingDialog.dismiss();
        }
    };
    loadingDialog.setMessage(getString(R.string.loading));
    loadingDialog.setCancelable(true);
    loadingDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            if (!asyncTask.isCancelled())
                asyncTask.cancel(true);
        }
    });
    loadingDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, getString(android.R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            });
    loadingDialog.show();
    asyncTask.execute(mAccountId);
}

From source file:cz.maresmar.sfm.view.user.UserListActivity.java

private void deleteUser(@NonNull Uri userUri) {
    AsyncTask.execute(() -> {
        // Delete image
        try (Cursor cursor = getContentResolver().query(userUri, new String[] { ProviderContract.User.PICTURE },
                null, null, null)) {/*from   w  ww. ja v a 2s  .  c  om*/
            int foundRows = cursor.getColumnCount();
            if (BuildConfig.DEBUG) {
                Assert.isOne(foundRows);
            }

            cursor.moveToNext();
            Uri imageUri = Uri.parse(cursor.getString(0));
            File imageFile = new File(imageUri.getPath());
            boolean delResult = imageFile.delete();
            if (BuildConfig.DEBUG) {
                Assert.that(delResult, "Deleting wasn't successful");
            }
        }
        // Delete entry from db
        int deletedRows = getContentResolver().delete(userUri, null, null);
        if (BuildConfig.DEBUG) {
            Assert.isOne(deletedRows);
        }
    });
}

From source file:cz.maresmar.sfm.view.menu.MenuViewAdapter.java

private void makeAsyncEdit(@NonNull Context context, @NonNull Uri userUri, long relativeId, long portalId,
        int reserved, int offered) {
    AsyncTask.execute(() -> ActionUtils.makeEdit(context, userUri, relativeId, portalId, reserved, offered));
}

From source file:cz.maresmar.sfm.view.portal.PortalListFragment.java

private void deletePortal(@NonNull Uri portalUri) {
    AsyncTask.execute(() -> {
        int deletedRows = getContext().getContentResolver().delete(portalUri, null, null);
        if (BuildConfig.DEBUG) {
            Assert.isOne(deletedRows);//from   w w  w  .j ava  2s .  c o m
        }
    });
}

From source file:org.noise_planet.noisecapture.Results.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    boolean showTooltip = sharedPref.getBoolean("settings_tooltip", true);
    setContentView(R.layout.activity_results);
    this.measurementManager = new MeasurementManager(this);
    Intent intent = getIntent();/*from  ww  w . ja  v  a 2 s  .com*/
    if (intent != null && intent.hasExtra(RESULTS_RECORD_ID)) {
        record = measurementManager.getRecord(intent.getIntExtra(RESULTS_RECORD_ID, -1));
    } else {
        // Read the last stored record
        List<Storage.Record> recordList = measurementManager.getRecords();
        if (!recordList.isEmpty()) {
            record = recordList.get(0);
        } else {
            // Message for starting a record
            Toast.makeText(getApplicationContext(), getString(R.string.no_results), Toast.LENGTH_LONG).show();
            initDrawer();
            return;
        }
    }
    tags = measurementManager.getTags(record.getId());
    initDrawer(record.getId());
    toolTip = (ToolTipRelativeLayout) findViewById(R.id.activity_tooltip);

    // RNE PieChart
    rneChart = (PieChart) findViewById(R.id.RNEChart);
    // Disable tooltip as it crash with this view
    //if(showTooltip) {
    //    rneChart.setOnTouchListener(new ToolTipListener(this, R.string.result_tooltip_rne));
    //}
    initRNEChart();
    Legend lrne = rneChart.getLegend();
    lrne.setTextColor(Color.WHITE);
    lrne.setTextSize(8f);
    lrne.setPosition(LegendPosition.RIGHT_OF_CHART_CENTER);
    lrne.setEnabled(true);

    // NEI PieChart
    neiChart = (PieChart) findViewById(R.id.NEIChart);
    initNEIChart();

    Legend lnei = neiChart.getLegend();
    lnei.setEnabled(false);

    // Cumulated spectrum
    sChart = (BarChart) findViewById(R.id.spectrumChart);
    initSpectrumChart();
    Legend ls = sChart.getLegend();
    ls.setEnabled(false); // Hide legend

    TextView minText = (TextView) findViewById(R.id.textView_value_Min_SL);
    minText.setText(R.string.no_valid_dba_value);
    if (showTooltip) {
        ToolTipListener touchListener = new ToolTipListener(this, R.string.result_tooltip_minsl);
        minText.setOnTouchListener(touchListener);
        findViewById(R.id.textView_label_Min_SL).setOnTouchListener(touchListener);
    }

    TextView maxText = (TextView) findViewById(R.id.textView_value_Max_SL);
    maxText.setText(R.string.no_valid_dba_value);
    if (showTooltip) {
        ToolTipListener touchListener = new ToolTipListener(this, R.string.result_tooltip_maxsl);
        maxText.setOnTouchListener(touchListener);
        findViewById(R.id.textView_label_Max_SL).setOnTouchListener(touchListener);
    }

    TextView la10Text = (TextView) findViewById(R.id.textView_value_LA10);
    la10Text.setText(R.string.no_valid_dba_value);
    if (showTooltip) {
        ToolTipListener touchListener = new ToolTipListener(this, R.string.result_tooltip_la10);
        la10Text.setOnTouchListener(touchListener);
        findViewById(R.id.textView_label_la10_SL).setOnTouchListener(touchListener);
    }

    TextView la50Text = (TextView) findViewById(R.id.textView_value_LA50);
    la50Text.setText(R.string.no_valid_dba_value);
    if (showTooltip) {
        ToolTipListener touchListener = new ToolTipListener(this, R.string.result_tooltip_la50);
        la50Text.setOnTouchListener(touchListener);
        findViewById(R.id.textView_label_la50_SL).setOnTouchListener(touchListener);
    }

    TextView la90Text = (TextView) findViewById(R.id.textView_value_LA90);
    la90Text.setText(R.string.no_valid_dba_value);
    if (showTooltip) {
        ToolTipListener touchListener = new ToolTipListener(this, R.string.result_tooltip_la90);
        la90Text.setOnTouchListener(touchListener);
        findViewById(R.id.textView_label_la90_SL).setOnTouchListener(touchListener);
    }

    // Action on Map button
    Button buttonmap = (Button) findViewById(R.id.mapBtn);
    buttonmap.setEnabled(true);
    buttonmap.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            // Go to map page
            Intent a = new Intent(getApplicationContext(), MapActivity.class);
            a.putExtra(RESULTS_RECORD_ID, record.getId());
            startActivity(a);
            finish();
        }
    });
    View measureButton = findViewById(R.id.measureBtn);
    measureButton.setOnClickListener(new OnGoToMeasurePage(this));
    // Action on export button

    Button exportComment = (Button) findViewById(R.id.uploadBtn);
    exportComment.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            runOnUiThread(new SendResults(Results.this, record.getId()));
        }
    });

    exportComment.setEnabled(record.getUploadId().isEmpty());

    AsyncTask.execute(new LoadMeasurements(this));
}

From source file:cz.maresmar.sfm.view.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.AppTheme_NoActionBar);
    super.onCreate(savedInstanceState);

    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);

    // Welcome guide
    if (mPrefs.getBoolean(SettingsContract.FIRST_RUN, SettingsContract.FIRST_RUN_DEFAULT)) {
        Intent firstRunIntent = new Intent(this, WelcomeActivity.class);
        firstRunIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(firstRunIntent);/*from  w  w w. ja  va  2s  . c  o  m*/
        finish();
    }
    // Main UI
    setContentView(R.layout.activity_main);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    // Floating button
    mOkFab = findViewById(R.id.main_ok_fab);
    mOkFab.setOnClickListener(view -> {
        AsyncTask.execute(() -> ActionUtils.saveEdits(this, getUserUri()));
        setMenuEditUiShown(false);
        Snackbar.make(view, R.string.main_edit_saved_text, Snackbar.LENGTH_LONG).setAction("Ok", v -> {
        }).show();
    });
    mDiscardFab = findViewById(R.id.main_discard_fab);
    mDiscardFab.setOnClickListener(view -> {
        AsyncTask.execute(() -> ActionUtils.discardEdits(this, getUserUri()));
        setMenuEditUiShown(false);
    });

    // Material Drawer
    // Prepare users section
    mProfiles = new AccountHeaderBuilder().withActivity(this).withHeaderBackground(R.drawable.header)
            .addProfiles(ADD_USER_DRAWER_ITEM, MANAGE_USER_DRAWER_ITEM).withOnAccountHeaderListener(this)
            .build();

    // Prepare menu section
    mDrawer = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withAccountHeader(mProfiles)
            .addDrawerItems(
                    new PrimaryDrawerItem().withName(R.string.drawer_today).withIcon(R.drawable.ic_today)
                            .withIconTintingEnabled(true).withIdentifier(TODAY_DRAWER_ID),
                    new PrimaryDrawerItem().withName(R.string.drawer_day).withIcon(R.drawable.ic_days)
                            .withIconTintingEnabled(true).withIdentifier(DAY_DRAWER_ID),
                    mPortalDrawerItem = new ExpandableDrawerItem().withName(R.string.drawer_portal)
                            .withIcon(R.drawable.ic_location).withIconTintingEnabled(true)
                            .withIdentifier(PORTAL_EXPANDABLE_DRAWER_ID).withSelectable(false)
                            .withSubItems(ADD_PORTAL_DRAWER_ITEM, MANAGE_PORTAL_DRAWER_ITEM),
                    new PrimaryDrawerItem().withName(R.string.drawer_orders)
                            .withIcon(R.drawable.ic_shopping_cart).withIconTintingEnabled(true)
                            .withIdentifier(ORDERS_DRAWER_ID),
                    new SectionDrawerItem().withName(R.string.drawer_help_and_settings_group),
                    new SecondaryDrawerItem().withName(R.string.drawer_feedback).withIcon(R.drawable.ic_send)
                            .withIconTintingEnabled(true).withIdentifier(FEEDBACK_DRAWER_ID)
                            .withSelectable(false),
                    new SecondaryDrawerItem().withName(R.string.drawer_settings)
                            .withIcon(R.drawable.ic_settings).withIconTintingEnabled(true)
                            .withIdentifier(SETTINGS_DRAWER_ID).withSelectable(false),
                    new SecondaryDrawerItem().withName(R.string.drawer_help).withIcon(R.drawable.ic_help)
                            .withIconTintingEnabled(true).withIdentifier(HELP_DRAWER_ID).withSelectable(false),
                    new SecondaryDrawerItem().withName(R.string.drawer_about).withIcon(R.drawable.ic_info)
                            .withIconTintingEnabled(true).withIdentifier(ABOUT_DRAWER_ID).withSelectable(false))
            .withOnDrawerItemClickListener(this).withOnDrawerNavigationListener(this)
            .withActionBarDrawerToggleAnimated(true).withSavedInstance(savedInstanceState).build();

    // Selected user
    if (mSelectedUserId == SettingsContract.LAST_USER_UNKNOWN) {
        mSelectedUserId = mPrefs.getLong(SettingsContract.LAST_USER, SettingsContract.LAST_USER_UNKNOWN);
    }

    // Selected fragment
    if (mSelectedFragmentId == SettingsContract.LAST_FRAGMENT_UNKNOWN) {
        mSelectedFragmentId = mPrefs.getLong(SettingsContract.LAST_FRAGMENT,
                SettingsContract.LAST_FRAGMENT_UNKNOWN);
    }

    String action;
    if (getIntent().getAction() != null) {
        action = getIntent().getAction();
    } else {
        action = Intent.ACTION_MAIN;
    }

    switch (action) {
    case Intent.ACTION_MAIN:
        break;
    case SHOW_ORDERS_ACTION:
        mSelectedFragmentId = ORDER_FRAGMENT_ID;
        break;
    case SHOW_CREDIT_ACTION:
        mDrawer.openDrawer();
        break;
    default:
        throw new UnsupportedOperationException("Unknown action " + action);

    }
    mAppBarLayout = findViewById(R.id.appbar);

    mSwipeRefreshLayout = findViewById(R.id.swipeRefreshLayout);
    mSwipeRefreshLayout.setColorSchemeColors(getResources().getIntArray(R.array.swipeRefreshColors));
    mSwipeRefreshLayout.setOnRefreshListener(this::startRefresh);

    // Load users from db
    getSupportLoaderManager().initLoader(USER_LOADER_ID, null, this);

    LocalBroadcastManager.getInstance(this).registerReceiver(mSyncResultReceiver,
            new IntentFilter(SyncHandler.BROADCAST_SYNC_EVENT));
    LocalBroadcastManager.getInstance(this).registerReceiver(mActionsEventReceiver,
            new IntentFilter(ActionUtils.BROADCAST_ACTION_EVENT));
}

From source file:cz.maresmar.sfm.view.credential.CredentialDetailFragment.java

@Override
public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor cursor) {
    switch (loader.getId()) {
    case CREDENTIAL_LOADER_ID:
        Timber.d("Credential data loaded");

        cursor.moveToFirst();//from   w  w  w .  j  av a 2s.  c  o  m
        if (BuildConfig.DEBUG) {
            Assert.isOne(cursor.getCount());
        }

        if (mPortalUri == null) {
            mPortalGroupId = cursor.getLong(4);

            String selection = ProviderContract.Portal.PORTAL_GROUP_ID + " = " + mPortalGroupId;
            Uri uri = ProviderContract.Portal.getUri();

            Bundle args = new Bundle();
            args.putParcelable(ARG_QUERY_URI, uri);
            args.putString(ARG_QUERY_SELECTION, selection);

            getLoaderManager().initLoader(PORTAL_LOADER_ID, args, this);
        }

        if (mLoadDataFromDb) {
            // Do not override changes on screen rotation
            mNameText.setText(cursor.getString(0));
            mPasswordText.setText(cursor.getString(1));
            long credentialGroupId = cursor.getLong(2);
            setExtraData(cursor.getString(3));

            @ProviderContract.CredentialFlags
            int flags = cursor.getInt(5);
            boolean increaseNotification = !((flags
                    & ProviderContract.CREDENTIAL_FLAG_DISABLE_CREDIT_INCREASE_NOTIFICATION) == ProviderContract.CREDENTIAL_FLAG_DISABLE_CREDIT_INCREASE_NOTIFICATION);
            mCreditIncreaseNotificationCheckBox.setChecked(increaseNotification);
            boolean lowCreditNotification = !((flags
                    & ProviderContract.CREDENTIAL_FLAG_DISABLE_LOW_CREDIT_NOTIFICATION) == ProviderContract.CREDENTIAL_FLAG_DISABLE_LOW_CREDIT_NOTIFICATION);
            mLowCreditNotificationCheckBox.setChecked(lowCreditNotification);
            mLowCreditText.setText(String.valueOf(cursor.getInt(6)));

            // Set credential group Id
            AsyncTask.execute(() -> {
                try {
                    blockingLoaders.await();
                } catch (InterruptedException e) {
                    Timber.e(e);
                }
                getActivity().runOnUiThread(() -> setCredentialGroupId(credentialGroupId));
            });
            mLoadDataFromDb = false;
        }
        break;
    case CREDENTIAL_GROUPS_LOADER_ID:
        Timber.d("Credential group data loaded");

        mCredentialGroupAdapter = new SimpleCursorAdapter(getContext(),
                R.layout.support_simple_spinner_dropdown_item, cursor,
                new String[] { ProviderContract.CredentialsGroup.NAME }, new int[] { android.R.id.text1 }, 0);
        mCredentialGroupSpinner.setAdapter(mCredentialGroupAdapter);
        blockingLoaders.countDown();
        break;
    case PORTAL_LOADER_ID:
        Timber.d("Portal data loaded");

        cursor.moveToFirst();
        if (BuildConfig.DEBUG) {
            Assert.that(cursor.getCount() > 0, "You should have at least one portal," + "but has %d",
                    cursor.getCount());
        }

        String pluginId = cursor.getString(0);
        requestExtraFormat(pluginId);
        if (mLastPlugin != null && !mLastPlugin.equals(pluginId)) {
            setExtraData(null);
        }
        mLastPlugin = pluginId;

        mPortalGroupId = cursor.getLong(1);
        break;
    default:
        throw new UnsupportedOperationException("Unknown loader id: " + loader.getId());
    }
}

From source file:app.clirnet.com.clirnetapp.activity.LoginActivity.java

private void updateBannerTableDataFlag() {
    AsyncTask.execute(new Runnable() {
        @Override/* ww w.  j  av  a2 s.c o  m*/
        public void run() {

            // sInstance.FlagupdateBannerClicked("0");//V 1.3.1
            // sInstance.FlagupdateBannerDisplay("0");//V 1.3.1
            sInstance.FlagupdateAssociateMaster("0");//V 1.3.2.8 //02-09-2017 ASHISH
            setupdateBannerClickVisitFlag0();
        }
    });
}

From source file:app.clirnet.com.clirnetapp.activity.LoginActivity.java

private void updateDiagnosisDataFlag() {
    AsyncTask.execute(new Runnable() {
        @Override/*from www . ja  va2s  .co m*/
        public void run() {

            // sInstance.FlagupdateBannerClicked("0");//V 1.3.1
            // sInstance.FlagupdateBannerDisplay("0");//V 1.3.1
            sInstance.updateDiagnosisData();//V 1.3.2.8 //02-09-2017 ASHISH
            setDiagnosisUpdateFlag();
        }
    });
}

From source file:cz.maresmar.sfm.view.menu.MenuDetailsFragment.java

public void saveChanges() {
    try {//from   w w  w  .  j a  va  2  s  .  co  m
        int changeReserved = Integer.parseInt(mChangedReservedEditText.getText().toString());
        int changeOffered = Integer.parseInt(mChangedOfferedEditText.getText().toString());

        AsyncTask.execute(() -> ActionUtils.makeEdit(getContext(), mUserUri, mMenuRelativeId, mPortalId,
                changeReserved, changeOffered));
    } catch (NumberFormatException e) {
        Timber.w(e, "Cannot save changes");
    }
}