Example usage for android.database Cursor moveToLast

List of usage examples for android.database Cursor moveToLast

Introduction

In this page you can find the example usage for android.database Cursor moveToLast.

Prototype

boolean moveToLast();

Source Link

Document

Move the cursor to the last row.

Usage

From source file:com.haibison.android.anhuu.FragmentFiles.java

@Override
public void onLoadFinished(Loader<Cursor> loader, final Cursor data) {
    mLoading = false;//from   ww  w. j av a2s . c o m

    /*
     * Update list view.
     */
    mFileAdapter.changeCursor(data);

    mViewGroupFiles.setVisibility(View.VISIBLE);
    mViewLoadingHandler.removeCallbacksAndMessages(null);
    mViewLoading.setVisibility(View.GONE);
    getActivity().supportInvalidateOptionsMenu();

    if (data == null) {
        showFooterView(true, getString(R.string.anhuu_f5be488d_msg_failed_please_try_again), true);
        return;
    }

    data.moveToLast();
    final Uri uriInfo = BaseFileProviderUtils.getUri(data);
    final Uri selectedFile = (Uri) getArguments().getParcelable(FileChooserActivity.EXTRA_SELECT_FILE);

    /*
     * Footer.
     */

    if (selectedFile != null && mIsSaveDialog) {
        new LoadingDialog<Void, Void, String>(getActivity(), false) {

            @Override
            protected String doInBackground(Void... params) {
                if (BaseFileProviderUtils.isFile(getActivity(), selectedFile))
                    return BaseFileProviderUtils.getFileName(getActivity(), selectedFile);
                return null;
            }// doInBackground()

            @Override
            protected void onPostExecute(String result) {
                super.onPostExecute(result);

                if (!TextUtils.isEmpty(result))
                    mTextSaveas.setText(result);
            }// onPostExecute()

        }.execute();
    } // if

    boolean hasMoreFiles = ProviderUtils.getBooleanQueryParam(uriInfo, BaseFile.PARAM_HAS_MORE_FILES);
    showFooterView(hasMoreFiles || mFileAdapter.isEmpty(),
            hasMoreFiles ? getString(R.string.anhuu_f5be488d_pmsg_max_file_count_allowed, mMaxFileCount)
                    : getString(R.string.anhuu_f5be488d_msg_empty),
            mFileAdapter.isEmpty());

    if (mNewLoader || selectedFile != null)
        createFileSelector();

    mNewLoader = false;
}