Example usage for android.app ProgressDialog show

List of usage examples for android.app ProgressDialog show

Introduction

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

Prototype

public static ProgressDialog show(Context context, CharSequence title, CharSequence message,
        boolean indeterminate, boolean cancelable) 

Source Link

Document

Creates and shows a ProgressDialog.

Usage

From source file:Main.java

public static void showDialog(Context context, String msg) {
    if (progressDialog == null) {
        progressDialog = ProgressDialog.show(context, "", msg, true, false);
    }/*from  www .  ja v a 2  s .c o m*/
}

From source file:com.citrus.sdk.webops.Pay.java

@Override
protected void onPreExecute() {
    waitBox = ProgressDialog.show(activity, "Please Wait", "Connecting to the PG", true, true);
}

From source file:com.p2c.thelife.SettingsFragment.java

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    // show the progress dialog while getting the user profile
    m_progressDialog = ProgressDialog.show(getActivity(), getResources().getString(R.string.waiting),
            getResources().getString(R.string.retrieving_account), true, true);
    Server server = new Server(getActivity());
    server.queryUserProfile(TheLifeConfiguration.getOwnerDS().getId(), this, "queryUserProfile");

    // Setup button click listeners
    Button showLicenseButton = (Button) getActivity().findViewById(R.id.show_license);
    ImageView userAvatar = (ImageView) getActivity().findViewById(R.id.settings_image);
    Button updatePhotoPrompt = (Button) getActivity().findViewById(R.id.settings_update_photo_prompt);

    Button saveButton = (Button) getActivity().findViewById(R.id.button1);

    showLicenseButton.setOnClickListener(new View.OnClickListener() {
        @Override//from w  w  w .  java 2  s .  com
        public void onClick(View v) {
            showLicense(v);
        }
    });

    userAvatar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            selectImage(v);
        }
    });

    updatePhotoPrompt.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            selectImage(v);
        }
    });
    saveButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setUserProfile(v);
        }
    });

    super.onViewCreated(view, savedInstanceState);
}

From source file:com.facebook.android.FQLQuery.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mHandler = new Handler();

    setContentView(R.layout.fql_query);/*from   ww  w.j av a2 s  . c o m*/
    LayoutParams params = getWindow().getAttributes();
    params.width = LayoutParams.FILL_PARENT;
    params.height = LayoutParams.FILL_PARENT;
    getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);

    mFQLQuery = (EditText) findViewById(R.id.fqlquery);
    mFQLOutput = (TextView) findViewById(R.id.fqlOutput);
    mSubmitButton = (Button) findViewById(R.id.submit_button);

    mSubmitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE))
                    .hideSoftInputFromWindow(mFQLQuery.getWindowToken(), 0);
            dialog = ProgressDialog.show(FQLQuery.this.activity, "",
                    FQLQuery.this.activity.getString(R.string.please_wait), true, true);
            /*
             * Source tag: fql_query_tag
             */
            String query = mFQLQuery.getText().toString();
            Bundle params = new Bundle();
            params.putString("method", "fql.query");
            params.putString("query", query);
            Utility.mAsyncRunner.request(null, params, new FQLRequestListener());
        }
    });
}

From source file:com.example.dex.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);//from  w w w.  jav  a  2 s.c  o  m
    mToastButton = (Button) findViewById(R.id.toast_button);

    // Before the secondary dex file can be processed by the DexClassLoader,
    // it has to be first copied from asset resource to a storage location.
    final File dexInternalStoragePath = new File(getDir("dex", Context.MODE_PRIVATE), SECONDARY_DEX_NAME);
    if (!dexInternalStoragePath.exists()) {
        mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.diag_title),
                getResources().getString(R.string.diag_message), true, false);
        // Perform the file copying in an AsyncTask.
        // dex
        (new PrepareDexTask()).execute(dexInternalStoragePath);
    } else {
        mToastButton.setEnabled(true);
    }

    mToastButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            // Internal storage where the DexClassLoader writes the optimized dex file to.
            final File optimizedDexOutputPath = getDir("outdex", Context.MODE_PRIVATE);

            // Initialize the class loader with the secondary dex file.
            DexClassLoader cl = new DexClassLoader(dexInternalStoragePath.getAbsolutePath(),
                    optimizedDexOutputPath.getAbsolutePath(), null, getClassLoader());
            Class libProviderClazz = null;

            try {
                // Load the library class from the class loader.
                // 
                libProviderClazz = cl.loadClass("com.example.dex.lib.LibraryProvider");

                // Cast the return object to the library interface so that the
                // caller can directly invoke methods in the interface.
                // Alternatively, the caller can invoke methods through reflection,
                // which is more verbose and slow.
                LibraryInterface lib = (LibraryInterface) libProviderClazz.newInstance();

                // Display the toast!
                lib.showAwesomeToast(view.getContext(), "hello !");
            } catch (Exception exception) {
                // Handle exception gracefully here.
                exception.printStackTrace();
            }
        }
    });
}

From source file:com.eTilbudsavis.sdkdemo.CatalogViewer.java

@Override
public void onResume() {
    super.onResume();
    Eta.getInstance().onResume();//w w  w.  j  a va  2s.c om

    if (mPageflip == null) {

        // First load, get a fresh list of catalogs for our area
        mProgressDialog = ProgressDialog.show(CatalogViewer.this, "", "Getting catalog list...", true, true);
        getCatalogList();

    } else {

        // No need to load content again, as PageflipFragment have been setup from the saved instance state
        setupPageflip();

    }

}

From source file:com.manning.androidhacks.hack041.ArticleActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.article);//w w w .  j  a va2 s .com

    articleId = getIntent().getIntExtra(ARTICLE_ID, -1);
    if (articleId == -1)
        throw new RuntimeException("Extra must be passed in!");

    dialog = ProgressDialog.show(this, null, "Loading Articles", true, false);
    /*
     * Kick off a task (if needed) to load the data for this activity. Note: We
     * must be mindful of screen orientation changes here.
     */
    task = (LoadArticleTask) getLastNonConfigurationInstance();
    if (task == null) {
        task = new LoadArticleTask(this, articleId);
        task.execute();
    } else {
        task.attach(this);
    }
}

From source file:com.manning.androidhacks.hack041.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);/*from  www .java 2 s  . co m*/
    listView = (ListView) findViewById(R.id.listView);

    dialog = ProgressDialog.show(this, null, "Loading Articles", true, false);
    /*
     * Kick off a task (if needed) to load the data for this activity. Note: We
     * must be mindful of screen orientation changes here.
     */
    task = (LoadArticleListTask) getLastNonConfigurationInstance();
    if (task == null) {
        task = new LoadArticleListTask(this);
        task.execute();
    } else {
        task.attach(this);
    }

}

From source file:com.example.healthplus.wifidirect.DeviceDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mContentView = inflater.inflate(R.layout.device_detail, null);
    mContentView.findViewById(R.id.btn_connect).setOnClickListener(new View.OnClickListener() {

        @Override/*from   w  w  w  . ja  v  a  2  s .c om*/
        public void onClick(View v) {
            WifiP2pConfig config = new WifiP2pConfig();
            config.deviceAddress = device.deviceAddress;
            config.wps.setup = WpsInfo.PBC;
            if (progressDialog != null && progressDialog.isShowing()) {
                progressDialog.dismiss();
            }
            progressDialog = ProgressDialog.show(getActivity(), "Press back to cancel",
                    "Connecting to :" + device.deviceAddress, true, true
            //                        new DialogInterface.OnCancelListener() {
            //
            //                            @Override
            //                            public void onCancel(DialogInterface dialog) {
            //                                ((DeviceActionListener) getActivity()).cancelDisconnect();
            //                            }
            //                        }
            );
            ((DeviceActionListener) getActivity()).connect(config);

        }
    });

    mContentView.findViewById(R.id.btn_disconnect).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ((DeviceActionListener) getActivity()).disconnect();
        }
    });

    mContentView.findViewById(R.id.btn_start_client).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // Allow user to pick an image from Gallery or other
            // registered apps
            //Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            //Log.d(WiFiDirectActivity.TAG, "Reached here Richa1");
            //intent.setType("image/*");
            //intent.setType("text/plain");
            //startActivityForResult(intent, CHOOSE_FILE_RESULT_CODE);
            //Log.d(WiFiDirectActivity.TAG, "Reached here Richa2");
            sendFile();

        }
    });

    return mContentView;
}

From source file:com.eTilbudsavis.sdkdemo.Search.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);//w ww .  j a va  2s.c  o m

    Eta.createInstance(Keys.API_KEY, Keys.API_SECRET, this);

    // Find views
    mQuery = (EditText) findViewById(R.id.etQuery);
    mListView = (ListView) findViewById(R.id.lvResult);

    // Check for any saved state
    if (savedInstanceState != null && savedInstanceState.containsKey(ARG_OFFERS)
            && savedInstanceState.containsKey(ARG_QUERY)) {
        mOffers = (List<Offer>) savedInstanceState.getSerializable(ARG_OFFERS);
        if (mOffers != null) {
            mListView.setAdapter(new SearchAdapter());
        }
        String q = savedInstanceState.getString(ARG_QUERY);
        if (q != null) {
            mQuery.setText(q);
            mQuery.setSelection(q.length());
        }

    }

    System.out.print("Eta null: " + Eta.getInstance().getClass().toString());

    Button search = (Button) findViewById(R.id.btnPerformSearch);
    search.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            String query = mQuery.getText().toString().trim();

            if (query.length() > 0) {

                mPd = ProgressDialog.show(Search.this, "", "Searching...", true, true);
                performSearch(query);

            }

        }
    });

}