Example usage for android.app ProgressDialog ProgressDialog

List of usage examples for android.app ProgressDialog ProgressDialog

Introduction

In this page you can find the example usage for android.app ProgressDialog ProgressDialog.

Prototype

public ProgressDialog(Context context) 

Source Link

Document

Creates a Progress dialog.

Usage

From source file:system.info.reader.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case 0: {/*from   w  w w  . jav  a2s. c  om*/
        if (m_dialog != null)
            m_dialog.cancel();
        m_dialog = new ProgressDialog(this);
        m_dialog.setTitle(getString(R.string.app_name));
        m_dialog.setMessage(getString(R.string.wait));
        m_dialog.setIndeterminate(true);
        m_dialog.setCancelable(true);
        Log.e(getString(R.string.tag), m_dialog.toString());
        return m_dialog;
    }
    case 1: {
        return new AlertDialog.Builder(this).setMessage(getString(R.string.about_dialog_text1) + version + "\n"
                + getString(R.string.about_dialog_text2)).
        //           setMessage(getString(R.string.about_dialog_text1) + version + "\n" + getString(R.string.license) + getString(R.string.about_dialog_text2)).
                setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                    }
                }).create();
    }
    case 2: {
        //Log.d("=================", (String) subItems[0]);
        //itemAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, new String[] {"ItemTitle", "ItemText"});
        //itemView = (ListView) ListView.inflate(this.getBaseContext(), R.id.AppList , null);
        //itemView.setAdapter(itemAdapter);
        //m_altDialog = new AlertDialog.Builder(this).setView(itemView).create();
        return m_altDialog;
    }
    }
    return null;
}

From source file:com.dmsl.anyplace.tasks.FetchBuildingsByBuidTask.java

@Override
protected void onPreExecute() {
    if (showDialog) {
        dialog = new ProgressDialog(ctx);
        dialog.setIndeterminate(true);//from  w w w  . j av  a  2 s  .c  om
        dialog.setTitle("Fetching Building");
        dialog.setMessage("Please be patient...");
        dialog.setCancelable(true);
        dialog.setCanceledOnTouchOutside(false);
        dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                FetchBuildingsByBuidTask.this.cancel(true);
            }
        });
        dialog.show();
    }

}

From source file:com.microsoft.aad.adal.hello.MainActivity.java

@Override
protected void onResume() {
    super.onResume();
    // To test session cookie behavior
    mLoginProgressDialog = new ProgressDialog(this);
    mLoginProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mLoginProgressDialog.setMessage("Login in progress...");

}

From source file:com.example.run_tracker.LoginFragment.java

private void Make_login_request() {
    pDialog = new ProgressDialog(getActivity());
    pDialog.setMessage("Login in ");
    showProgressDialog();/*from   w  w  w  .  jav  a2s  . c  o  m*/
    JSONObject credentials = null;
    try {
        credentials = new JSONObject();
        credentials.put("username", mUsername.getText().toString());
        credentials.put("password", mPassword.getText().toString());

    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    JsonObjectRequest jsonObjReq = new JsonObjectRequest(Method.POST, URLS.URL_LOGIN, credentials,
            new Response.Listener<JSONObject>() {

                @Override
                public void onResponse(JSONObject response) {
                    /*
                     * response.getString("token");
                     * 
                     * (and save the token for future requests) else we got
                     * an error
                     */
                    Log.d(TAG, response.toString());
                    try {
                        response.getString("token");
                        if (mRememberme.isChecked()) {
                            Log.v(TAG, "saving token");
                            // save username and password for future use ins
                            // shared preferences
                            SharedPreferences credentials = getActivity().getPreferences(Context.MODE_PRIVATE);
                            SharedPreferences.Editor editor = credentials.edit();
                            editor.putString("username", mUsername.getText().toString());
                            editor.putString("password", mPassword.getText().toString());
                            editor.commit();
                        }
                        Launch_app(response.getString("token"));

                    } catch (JSONException e) {
                        // TODO Auto-generated catch block
                        try {

                            Toast.makeText(getActivity(), response.getString("error"), Toast.LENGTH_LONG)
                                    .show();
                        } catch (JSONException e1) {
                            // TODO Auto-generated catch block
                            e1.printStackTrace();
                        }
                    }

                    hideProgressDialog();
                }
            }, new Response.ErrorListener() {

                @Override
                public void onErrorResponse(VolleyError error) {
                    VolleyLog.d(TAG, "Error: " + error.getMessage());
                    Launch_app("delete me ");

                    hideProgressDialog();
                }
            }) {

    };

    // Adding request to request queue
    AppController.getInstance().addToRequestQueue(jsonObjReq, TAG);

    // Cancelling request
    // ApplicationController.getInstance().getRequestQueue().cancelAll(tag_json_obj);
}

From source file:vee.vee.string.downloader.StringDownloader.java

/**
 * @see android.os.AsyncTask#onPreExecute()
 */// ww w. ja  va2 s  .  c  o m
@Override
protected void onPreExecute() {
    super.onPreExecute();
    if (debug) {
        Log.w(tag, "onPreExecute");
    }
    dialog = new ProgressDialog(activity);
    dialog.setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    publishProgress(1);
    dialog.show();

}

From source file:com.google.android.gms.samples.plus.SignInActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        mHasCalledGooglePlusApiEndpoint = savedInstanceState
                .getBoolean(KEY_HAS_CALLED_GOOGLE_PLUS_API_ENDPOINT);
    }//from w w w .jav  a2  s .  c  o m
    setContentView(R.layout.sign_in_activity);
    mPlusClient = new PlusClient(this, this, this, SCOPES);

    // Spinner progress bar to be displayed if the user clicks the Google+
    // sign-in button before resolving connection errors.
    mConnectionProgressDialog = new ProgressDialog(SignInActivity.this);
    mConnectionProgressDialog.setMessage(getString(R.string.signing_in_status));
    mConnectionProgressDialog.setOwnerActivity(SignInActivity.this);

    findViewById(R.id.sign_in_button).setOnClickListener(this);
    findViewById(R.id.sign_out_button).setOnClickListener(this);
    mSignInStatus = (TextView) findViewById(R.id.sign_in_status);
}

From source file:com.ankit.touchreview.FinalActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.finalactivity);

    logo = (ImageView) findViewById(R.id.logo);
    LinearLayout1 = (LinearLayout) findViewById(R.id.LinearLayout1);
    mContext = this;

    email = (EditText) findViewById(R.id.email);
    message = (TextView) findViewById(R.id.message);

    DisplayMetrics metrics = this.getResources().getDisplayMetrics();
    int width = metrics.widthPixels;
    //int height = metrics.heightPixels;
    logo.getLayoutParams().width = width / 2;
    Button finish = (Button) findViewById(R.id.finish);
    finish.getLayoutParams().width = width / 3;

    setThemeImage();//from w  w w.  j  av a  2  s . co  m
    setLogoImage();
    setMessage();
    mProcessing = new ProgressDialog(mContext);
    mProcessing.setCancelable(true);
    mProcessing.setMessage("Please Wait");
    mProcessing.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            if (submitted)

                finish();

        }
    });
}

From source file:com.safecell.LoginActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login_layout);

    getWindow().setWindowAnimations(R.anim.null_animation);

    InitUi();/*from ww  w. ja va2 s .  co  m*/
    context = LoginActivity.this;
    if (!isTermsAcepted)
        dialogforWebview();

    progressDialog = new ProgressDialog(context);
    mThread = new ProgressThread();
    mThread1 = new ProgressThread1();
    PackageManager pm = getPackageManager();
    try {
        // ---get the package info---
        PackageInfo pi = pm.getPackageInfo("com.safecell", 0);
        // Log.v("Version Code", "Code = "+pi.versionCode);
        // Log.v("Version Name", "Name = "+pi.versionName);
        versionName = pi.versionName;

    } catch (NameNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    handler = new Handler() {

        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            try {
                progressDialog.dismiss();
            } catch (Exception e) {
                Log.e(TAG, "Exception while dismissing progress dialog");
                e.printStackTrace();
            }
            if (mThread.isAlive()) {
                mThread = new ProgressThread();
            }
        }
    };
    handler1 = new Handler() {

        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            progressDialog.dismiss();
            if (mThread1.isAlive()) {
                mThread1 = new ProgressThread1();
            }
        }
    };
}

From source file:org.openbmap.activities.DialogPreferenceCatalogs.java

@Override
protected void onBindDialogView(View v) {
    super.onBindDialogView(v);
    groups = new SparseArray<>();
    ExpandableListView listView = (ExpandableListView) v.findViewById(R.id.list);
    mAdapter = new DialogPreferenceCatalogsListAdapter(getContext(), groups, this);
    listView.setAdapter(mAdapter);/*from w  ww  .jav  a2 s. co m*/

    if (checkDialog == null || !checkDialog.isShowing()) {
        checkDialog = new ProgressDialog(getContext());
    }
    // retrieve online Catalogs
    GetAvailableCatalogsTask data = new GetAvailableCatalogsTask();
    data.execute();
}

From source file:com.groupme.sdk.activity.GroupCreateActivity.java

@Override
protected Dialog onCreateDialog(int id, Bundle args) {
    switch (id) {
    case DIALOG_CREATING:
        ProgressDialog dialog = new ProgressDialog(this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setMessage(getString(R.string.dialog_creating_group));

        return dialog;
    default:/*w  ww.  j  av a  2s  .  co m*/
        throw new IllegalArgumentException("Unknown dialog id: " + id);
    }
}