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:com.example.run_tracker.MyRunsFragment.java

private void Make_track_request() {
    Log.v(TAG, "Make_track_request");

    pDialog = new ProgressDialog(getActivity());
    pDialog.setMessage("Getting your tracks");
    showProgressDialog();//from ww  w  .ja v a  2  s . co m
    // Creating volley request obj
    JsonArrayRequest trackReq = new JsonArrayRequest(URLS.URL_TRACKS, new Response.Listener<JSONArray>() {
        @Override
        public void onResponse(JSONArray response) {
            // Parsing json
            mTracks.clear();
            for (int i = 0; i < response.length(); i++) {
                try {
                    JSONObject obj = response.getJSONObject(i);
                    mTracks.add(new Track(obj.getString("date"), obj.getString("time"), obj.getString("track"),
                            obj.getString("_id"), obj.getString("distance")));
                    Log.v(TAG, "" + mTracks.get(i).getDate());
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            // notifying list adapter about data changes
            // so that it renders the list view with updated data
            adapter.notifyDataSetChanged();
            hideProgressDialog();

        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            VolleyLog.d(TAG, "Error: " + error.getMessage());
            hideProgressDialog();
        }
    }) {
        /**
         * Passing some request headers token and content type
         * */
        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            HashMap<String, String> headers = new HashMap<String, String>();
            headers.put("Content-Type", "application/json");
            headers.put("x-access-token", ((MainActivity) getActivity()).getToken());
            return headers;
        }
    };
    AppController.getInstance().addToRequestQueue(trackReq, TAG);

}

From source file:com.wenwen.chatuidemo.activity.ContactlistFragment.java

/**
 * ??/*w  w  w  .jav a 2 s .com*/
 */
private void getContactList() {
    try {
        RequestParams params = new RequestParams();
        params.put("uid", DemoApplication.getInstance().getUserUid());
        params.put("flag", "2");
        params.put("pageindex", "1");
        params.put("pagesize", "20");
        pd = new ProgressDialog(getActivity());
        pd.setMessage("?...");
        HttpClientRequest.post(Urls.FRIENDSGET, params, 3000, new AsyncHttpResponseHandler() {
            @Override
            public void onStart() {
                // TODO Auto-generated method stub
                pd.show();
                super.onStart();
            }

            @Override
            public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
                // TODO Auto-generated method stub
                String res = new String(arg2);
                DebugLog.i(TAG, "??==" + res);
                JsonParser parser = new JsonParser();
                JsonArray Jarray = parser.parse(res).getAsJsonArray();
                MyUser myuser = null;
                for (JsonElement obj : Jarray) {
                    myuser = gson.fromJson(obj, MyUser.class);
                    if (!myuser.getAccount_name().equals("") && myuser.getAccount_name() != null) {
                        contactList.add(myuser);
                    }
                }
                // ?
                Collections.sort(contactList, new Comparator<MyUser>() {
                    @Override
                    public int compare(MyUser lhs, MyUser rhs) {
                        return lhs.getAccount_username().compareTo(rhs.getAccount_username());
                    }
                });
                adapter = new ContactAdapter(getActivity(), contactList);
                listView.setAdapter(adapter);
            }

            @Override
            public void onFinish() {
                // TODO Auto-generated method stub
                super.onFinish();
                pd.dismiss();
            }

            @Override
            public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
                // TODO Auto-generated method stub

            }
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.piusvelte.sonet.core.StatusDialog.java

@Override
protected void onResume() {
    super.onResume();
    Intent intent = getIntent();//from w w  w .  jav  a2  s .  c  om
    if (intent != null) {
        if (intent.hasExtra(Widgets.INSTANT_UPLOAD)) {
            mFilePath = intent.getStringExtra(Widgets.INSTANT_UPLOAD);
            Log.d(TAG, "upload photo?" + mFilePath);
        } else {
            mData = intent.getData();
            if (mData != null) {
                mData = intent.getData();
                if (intent.hasExtra(LauncherIntent.Extra.Scroll.EXTRA_SOURCE_BOUNDS))
                    mRect = intent.getParcelableExtra(LauncherIntent.Extra.Scroll.EXTRA_SOURCE_BOUNDS);
                else
                    mRect = intent.getSourceBounds();
                Log.d(TAG, "data:" + mData.toString());
                // need to use a thread here to avoid anr
                mLoadingDialog = new ProgressDialog(this);
                mLoadingDialog.setMessage(getString(R.string.status_loading));
                mLoadingDialog.setCancelable(true);
                mLoadingDialog.setOnCancelListener(new OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface arg0) {
                        if (mStatusLoader != null)
                            mStatusLoader.cancel(true);
                        finish();
                    }
                });
                mLoadingDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, getString(android.R.string.cancel),
                        new OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.cancel();
                                finish();
                            }
                        });
                mLoadingDialog.show();
                mStatusLoader = new StatusLoader();
                mStatusLoader.execute();
            }
        }
    }
    if (mFilePath != null) {
        mDialog = (new AlertDialog.Builder(this)).setTitle(R.string.uploadprompt)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        startActivityForResult(
                                Sonet.getPackageIntent(getApplicationContext(), SonetCreatePost.class)
                                        .putExtra(Widgets.INSTANT_UPLOAD, mFilePath),
                                RESULT_REFRESH);
                        dialog.dismiss();
                    }
                }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        StatusDialog.this.finish();
                    }
                }).create();
        mDialog.show();
    } else {
        // check if the dialog is still loading
        if (mFinish)
            finish();
        else if ((mLoadingDialog == null) || !mLoadingDialog.isShowing())
            showDialog();
    }
}

From source file:com.securekey.sdk.sample.VerifyQuickCodeActivity.java

/**
 * Start quickcode verification/*w w w.  j  a  v  a2s  . com*/
 * <p>
 * Gets Briidge object and calls briidge.verifyQuickCode
 * 
 * @param   passcode   user supplied quickcode
 */
private void verifyQuickCode(final String passcode) {

    mProgressDialog = new ProgressDialog(this);
    updateProgressDialog("Verifying");
    this.jwsExpected = false;
    BriidgePlatformFactory.getBriidgePlatform(VerifyQuickCodeActivity.this).verifyQuickCode(passcode,
            SDKSampleApp.getInstance().retrieveUserId(), VerifyQuickCodeActivity.this);
}

From source file:com.app.jdy.ui.CallBackPasswordActivity.java

/**
 * //from w  w  w.ja  va  2  s . c o m
 * @author Owater
 * @createtime 2015-1-13 ?6:04:53
 * @Decription ??
 * 
 */
public void initView() {
    mBackImg = (ImageView) findViewById(R.id.back_img);
    mBackImg.setVisibility(View.VISIBLE);
    title = (TextView) findViewById(R.id.title_tv);
    title.setText("?");
    back_password_username = (EditText) findViewById(R.id.back_password_username);
    get_back_password_code = (Button) findViewById(R.id.get_back_password_code);
    back_password_code = (EditText) findViewById(R.id.back_password_code);
    set_back_password_code = (Button) findViewById(R.id.set_back_password_code);
    get_code_linearlayout = (LinearLayout) findViewById(R.id.get_code_linearlayout);
    set_code_linearlayout = (LinearLayout) findViewById(R.id.set_code_linearlayout);
    find_password_ok_linearlayout = (LinearLayout) findViewById(R.id.find_password_ok_linearlayout);
    back_new_password = (EditText) findViewById(R.id.back_new_password);
    back_new_repassword = (EditText) findViewById(R.id.back_new_repassword);
    find_password_ok = (Button) findViewById(R.id.find_password_ok);
    back_login = (TextView) findViewById(R.id.back_login);
    pd = new ProgressDialog(this);
    handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case 0:
                Toast.makeText(CallBackPasswordActivity.this, Constants.NO_INTENT_TIPS, Toast.LENGTH_LONG)
                        .show();
                break;
            case 1:
                Toast.makeText(CallBackPasswordActivity.this, "????,?",
                        Toast.LENGTH_LONG).show();
                get_code_linearlayout.setVisibility(View.GONE);
                set_code_linearlayout.setVisibility(View.VISIBLE);
                break;
            case 2:
                try {
                    Toast.makeText(CallBackPasswordActivity.this, jsonObject.getString("msg").toString(),
                            Toast.LENGTH_SHORT).show();
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                break;
            case 3:
                set_code_linearlayout.setVisibility(View.GONE);
                find_password_ok_linearlayout.setVisibility(View.VISIBLE);
                break;
            case 4:
                try {
                    Toast.makeText(CallBackPasswordActivity.this, jsonObject.getString("msg").toString(),
                            Toast.LENGTH_LONG).show();
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                break;
            case 5:
                try {
                    Toast.makeText(CallBackPasswordActivity.this, jsonObject.getString("msg").toString(),
                            Toast.LENGTH_LONG).show();
                } catch (JSONException e1) {
                    e1.printStackTrace();
                }
                startActivity(new Intent(CallBackPasswordActivity.this, LoginActivity.class));
                finish();
                break;
            case 6:
                try {
                    Toast.makeText(CallBackPasswordActivity.this, jsonObject.getString("msg").toString(),
                            Toast.LENGTH_LONG).show();
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                break;
            default:
                break;
            }
        }
    };
}

From source file:com.ved.musicmapapp.LoginAcitivity.java

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

    isMusics = false;
    isMovies = false;
    isBooks = false;
    isGames = false;
    isMe = false;

    prefs = getSharedPreferences("MUSIC_MAP", MODE_PRIVATE);
    edt = prefs.edit();

    btnLogin = findViewById(R.id.btn_login);
    TextView discover_heading = (TextView) findViewById(R.id.discover_heading);
    Typeface tf = Typeface.createFromAsset(getAssets(), "open_sans_regular.ttf");
    discover_heading.setTypeface(tf);

    btnLogin.setOnClickListener(this);

    pd = new ProgressDialog(this);
    pd.setMessage("Logging...");
    pd.setCancelable(false);

    if (getIntent().getBooleanExtra("LOGOUT", false)) {
        onClickLogout();
    }

    initFacebook(savedInstanceState);

    try {
        PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.i("PXR", com.ved.musicmapapp.utils.Base64.encodeBytes(md.digest()));
        }
    } catch (NameNotFoundException e) {
    } catch (NoSuchAlgorithmException e) {
    }

    updateView();
}

From source file:edu.cmu.cs.cloudlet.android.CloudletActivity.java

protected void runConnection(String address, int port, VMInfo overlayVM) {
    if (this.connector != null) {
        this.connector.close();
    }/*from   w  ww.  jav a2 s.  c o  m*/
    this.connector = new CloudletConnector(CloudletActivity.this, synthesisHandler);
    this.connector.setConnection(address, port, overlayVM);
    this.connector.start();

    if (this.progDialog == null) {
        this.progDialog = new ProgressDialog(this);
        this.progDialog.setMessage("Connecting to " + address);
        this.progDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        this.progDialog.setCancelable(true);
        this.progDialog.setIcon(R.drawable.ic_launcher);
    } else {
        this.progDialog.setMessage("Connecting to " + address);
    }
    this.progDialog.show();
}

From source file:com.sxt.superqq.activity.LoginActivity.java

/**
 * ?// w  w w  .ja va2 s.  com
 */
private void setLoginClickListener() {
    findViewById(R.id.btnLogin).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!CommonUtils.isNetWorkConnected(LoginActivity.this)) {
                Toast.makeText(LoginActivity.this, R.string.network_isnot_available, Toast.LENGTH_SHORT).show();
                return;
            }
            currentUsername = usernameEditText.getText().toString().trim();
            currentPassword = passwordEditText.getText().toString().trim();

            /*
             * ????
             */
            if (TextUtils.isEmpty(currentUsername)) {
                Toast.makeText(LoginActivity.this, R.string.User_name_cannot_be_empty, Toast.LENGTH_SHORT)
                        .show();
                return;
            }
            if (TextUtils.isEmpty(currentPassword)) {
                Toast.makeText(LoginActivity.this, R.string.Password_cannot_be_empty, Toast.LENGTH_SHORT)
                        .show();
                return;
            }

            //?
            progressShow = true;
            final ProgressDialog pd = new ProgressDialog(LoginActivity.this);
            pd.setCanceledOnTouchOutside(false);
            pd.setOnCancelListener(new OnCancelListener() {

                @Override
                public void onCancel(DialogInterface dialog) {
                    progressShow = false;
                }
            });
            pd.setMessage(getString(R.string.Is_landing));
            pd.show();

            final long start = System.currentTimeMillis();
            // sdk??
            EMChatManager.getInstance().login(currentUsername, currentPassword, new EMCallBack() {
                @Override
                public void onSuccess() {

                    if (!progressShow) {
                        return;
                    }

                    runOnUiThread(new Runnable() {
                        public void run() {
                            pd.setMessage(getString(R.string.list_is_for));
                        }
                    });
                    try {

                        //?
                        boolean isSuccess = loginAppServer(currentUsername, currentPassword);
                        if (!isSuccess) {
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    Toast.makeText(LoginActivity.this, "", 2000).show();
                                    return;
                                }
                            });
                        }
                        final String userName = SuperQQApplication.getInstance().getUserName();
                        //?
                        isSuccess = NetUtils.downloadAvatar(LoginActivity.this, userName);

                        if (SuperQQApplication.getInstance().getContacts().size() == 0) {
                            //,20userName??
                            new DownloadContactsTask(LoginActivity.this, userName, 0, 20)
                                    .execute(I.SERVER_ROOT);
                        }
                        if (!isSuccess) {
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    Toast.makeText(LoginActivity.this, userName + "?", 3000)
                                            .show();
                                }
                            });
                        }
                        // ** ?logout???
                        // ** manually load all local groups and
                        // conversations in case we are auto login
                        EMGroupManager.getInstance().loadAllGroups();
                        EMChatManager.getInstance().loadAllConversations();
                        //??
                        processContactsAndGroups();
                    } catch (Exception e) {
                        e.printStackTrace();
                        //?????
                        runOnUiThread(new Runnable() {
                            public void run() {
                                pd.dismiss();
                                SuperQQApplication.getInstance().logout(null);
                                Toast.makeText(getApplicationContext(), R.string.login_failure_failed, 1)
                                        .show();
                            }
                        });
                        return;
                    }
                    //?nickname ios?nick
                    boolean updatenick = EMChatManager.getInstance()
                            .updateCurrentUserNick(SuperQQApplication.currentUserNick.trim());
                    if (!updatenick) {
                        Log.e("LoginActivity", "update current user nick fail");
                    }
                    if (!LoginActivity.this.isFinishing())
                        pd.dismiss();
                    // ?
                    startActivity(new Intent(LoginActivity.this, MainActivity.class));
                    finish();
                }

                @Override
                public void onProgress(int progress, String status) {
                }

                @Override
                public void onError(final int code, final String message) {
                    if (!progressShow) {
                        return;
                    }
                    runOnUiThread(new Runnable() {
                        public void run() {
                            pd.dismiss();
                            Toast.makeText(getApplicationContext(), getString(R.string.Login_failed) + message,
                                    Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            });
            //                Intent intent = new Intent(LoginActivity.this, com.sxt.superqq.activity.AlertDialogActivity.class);
            //                intent.putExtra("editTextShow", true);
            //                intent.putExtra("titleIsCancel", true);
            //                intent.putExtra("msg", getResources().getString(R.string.please_set_the_current));
            //                intent.putExtra("edit_text", currentUsername);
            //                startActivityForResult(intent, REQUEST_CODE_SETNICK);
        }
    });
}

From source file:com.eeshana.icstories.activities.UploadVideoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // this will copy the license file and the demo video file.
    // to the videokit work folder location.
    // without the license file the library will not work.
    //copyLicenseAndDemoFilesFromAssetsToSDIfNeeded();
    setContentView(R.layout.upload_video_activity);

    height = SignInActivity.getScreenHeight(UploadVideoActivity.this);
    width = SignInActivity.getScreenWidth(UploadVideoActivity.this);
    mProgressDialog = new ProgressDialog(UploadVideoActivity.this);
    pDialog = new ProgressDialog(UploadVideoActivity.this);
    showCustomToast = new ShowCustomToast();
    connectionDetector = new ConnectionDetector(UploadVideoActivity.this);
    //      mProgressDialog=new ProgressDialog(UploadVideoActivity.this,AlertDialog.THEME_HOLO_LIGHT);
    //      mProgressDialog.setFeatureDrawableResource(height,R.drawable.rounded_toast);
    prefs = getSharedPreferences("PREF", MODE_PRIVATE);
    regId = prefs.getString("regid", "NA");
    SharedPreferences pref = getSharedPreferences("DB", 0);
    userid = pref.getString("userid", "1");
    SharedPreferences assign_prefs = getSharedPreferences("ASSIGN", 0);
    assignment_id = assign_prefs.getString("ASSIGN_ID", "");
    videoPath = getIntent().getStringExtra("VIDEOPATH");

    //      iCTextView=(TextView) findViewById(R.id.tvIC);
    //      iCTextView.setTypeface(CaptureVideoActivity.ic_typeface,Typeface.BOLD);
    //      storiesTextView=(TextView) findViewById(R.id.tvStories);
    //      storiesTextView.setTypeface(CaptureVideoActivity.stories_typeface,Typeface.BOLD);
    //      watsStoryTextView=(TextView) findViewById(R.id.tvWhatsStory);
    //      watsStoryTextView.setTypeface(CaptureVideoActivity.stories_typeface,Typeface.ITALIC);

    //      logoImageView=(ImageView) findViewById(R.id.ivLogo);
    //      RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams((int) (width/1.9), (int) (height/9.5));
    //      lp.addRule(RelativeLayout.CENTER_HORIZONTAL);
    //      lp.setMargins(0, 0, 0, 0);
    //      logoImageView.setLayoutParams(lp);

    uploadtTextView = (TextView) findViewById(R.id.tvUpload);
    uploadtTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    //      extension=getIntent().getStringExtra("EXTENSION");
    //      folderPath = Environment.getExternalStorageDirectory().getPath()+"/ICStoriesFolder";
    //      if (!FileUtils.checkIfFolderExists(folderPath)) {
    //         boolean isFolderCreated = FileUtils.createFolder(folderPath);
    //         Log.i(Prefs.TAG, folderPath + " created? " + isFolderCreated);
    //         if (isFolderCreated) {
    ////w  w w  .  j av  a2s  .c om
    //         }
    //      }
    //command for rotating video 90 degree
    //String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -vf transpose=1 -s 160x120 -r 30 -aspect 4:3 -ab 48000 -ac 2 -ar 22050 -b 2097k "+folderPath+"/out."+extension;

    //Change Video Resolution:
    //String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -vf transpose=3 -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 "+folderPath+"/res."+extension;

    //command for compressing video 
    //      String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 "+folderPath+"/test."+extension;
    //      setCommand(commandStr);
    //      runTranscoing();

    thumb = ThumbnailUtils.createVideoThumbnail(videoPath, MediaStore.Images.Thumbnails.MINI_KIND);
    System.out.println("THUMB IMG  in uplaod== " + thumb);

    titleEditText = (EditText) findViewById(R.id.etTitle);
    titleEditText.setTypeface(CaptureVideoActivity.stories_typeface);
    descriptionEditText = (EditText) findViewById(R.id.etDescripton);
    descriptionEditText.setTypeface(CaptureVideoActivity.stories_typeface);
    locationEditText = (EditText) findViewById(R.id.etLocation);
    locationEditText.setTypeface(CaptureVideoActivity.stories_typeface);
    isAssignmentButton = (Button) findViewById(R.id.buttonCheck);
    isAssignmentButton.setTypeface(CaptureVideoActivity.stories_typeface);
    isAssignmentButton.setOnClickListener(this);
    dailyAssignTextView = (TextView) findViewById(R.id.tvDailyAssignment);
    dailyAssignTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    uploadButton = (Button) findViewById(R.id.buttonUpload);
    uploadButton.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    RelativeLayout uploadRelativeLayout = (RelativeLayout) findViewById(R.id.rlUpload);
    RelativeLayout.LayoutParams lp9 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, height / 17);
    lp9.addRule(RelativeLayout.BELOW, R.id.rlDailyAssignment);
    lp9.setMargins(width / 7, 30, width / 7, 0);
    uploadRelativeLayout.setLayoutParams(lp9);
    uploadButton.setOnClickListener(this);

    //bottom bar

    homeRelativeLayout = (RelativeLayout) findViewById(R.id.rlHome);
    homeRelativeLayout.setBackgroundResource(R.drawable.press_border);
    homeRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
    homeTextView = (TextView) homeRelativeLayout.findViewById(R.id.tvHome);
    homeTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    homeTextView.setTextColor(Color.parseColor("#fffffe"));
    RelativeLayout.LayoutParams lp4 = new RelativeLayout.LayoutParams(width / 3, width / 5);
    lp4.addRule(RelativeLayout.ALIGN_LEFT);
    homeRelativeLayout.setLayoutParams(lp4);
    homeRelativeLayout.setOnClickListener(this);

    wallRelativeLayout = (RelativeLayout) findViewById(R.id.rlWall);
    wallRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
    wallTextView = (TextView) wallRelativeLayout.findViewById(R.id.tvWall);
    wallTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    RelativeLayout.LayoutParams lp5 = new RelativeLayout.LayoutParams(width / 3, width / 5);
    lp5.addRule(RelativeLayout.RIGHT_OF, R.id.rlHome);
    wallRelativeLayout.setLayoutParams(lp5);
    wallRelativeLayout.setOnClickListener(this);

    settingsRelativeLayout = (RelativeLayout) findViewById(R.id.rlSettings);
    settingsRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
    settingsTextView = (TextView) settingsRelativeLayout.findViewById(R.id.tvSettings);
    settingsTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD);
    RelativeLayout.LayoutParams lp6 = new RelativeLayout.LayoutParams(width / 3, width / 5);
    lp6.addRule(RelativeLayout.RIGHT_OF, R.id.rlWall);
    settingsRelativeLayout.setLayoutParams(lp6);
    settingsRelativeLayout.setOnClickListener(this);

    // current location
    locationDialog = new Dialog(UploadVideoActivity.this);
    locationDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    locationDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    locationDialog.setContentView(R.layout.location_dialog);
    locationDialog.setCancelable(true);
    LinearLayout dialogLayout = (LinearLayout) locationDialog.findViewById(R.id.ll1);
    okButton = (Button) dialogLayout.findViewById(R.id.OkBtn);
    okButton.setOnClickListener(this);
    cancelButton = (Button) dialogLayout.findViewById(R.id.cancelBtn);
    cancelButton.setOnClickListener(this);

    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    boolean network_enabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
    if (network_enabled) {
        locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
    } else {
        showCustomToast.showToast(UploadVideoActivity.this,
                "Could not find current location. Please enable location services of your device.");
    }
    //      else if(gps_enabled == false){
    //         locationDialog.show();
    //      }
}

From source file:com.adarshahd.indianrailinfo.donate.TrainDetails.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_details);
    mActivity = this;
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mDialog = new ProgressDialog(mActivity);
    mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mDialog.setIndeterminate(true);//from  www  .jav  a  2 s . co  m
    mDialog.show();
    mButtonAvailability = (Button) findViewById(R.id.id_btn_avail_next_7);
    if (savedInstanceState != null) {
        mDetails = savedInstanceState.getParcelable("LIST");
        if (mDetails == null) {
            return;
        }
        mFrameLayout = null;
        mFrameLayout = (FrameLayout) findViewById(R.id.id_fl_details);
        if (mDetails.getAction().equals(TrainEnquiry.FARE)) {
            getSupportActionBar().setTitle("Fare Details");
            mButtonAvailability.setVisibility(View.GONE);
            createTableLayoutTrainFare();
        }
        if (mDetails.getAction().equals(TrainEnquiry.AVAILABILITY)) {
            getSupportActionBar().setTitle("Availability Details");
            mButtonAvailability.setVisibility(View.VISIBLE);
            mButtonAvailability.setOnClickListener(this);
            createTableLayoutTrainAvailability();
        }
        return;
    }
    mFrameLayout = (FrameLayout) findViewById(R.id.id_fl_details);
    Intent intent = getIntent();
    mAction = intent.getStringExtra(TrainEnquiry.ACTION);
    if (mAction.equals(TrainEnquiry.FARE)) {
        getSupportActionBar().setTitle("Fare Details");
        mButtonAvailability.setVisibility(View.GONE);
        mTrainNumber = intent.getStringExtra(TrainEnquiry.TRAIN);
        mSrc = intent.getStringExtra(TrainEnquiry.SRC);
        mDst = intent.getStringExtra(TrainEnquiry.DST);
        mDay = intent.getStringExtra(TrainEnquiry.DAY_TRAVEL);
        mMonth = intent.getStringExtra(TrainEnquiry.MONTH_TRAVEL);
        mCls = intent.getStringExtra(TrainEnquiry.CLS);
        mAge = intent.getStringExtra(TrainEnquiry.AGE);
        new GetFare().execute();
        mDialog.setMessage("Fetching train fare . . .");
    }
    if (mAction.equals(TrainEnquiry.AVAILABILITY)) {
        getSupportActionBar().setTitle("Availability Details");
        mButtonAvailability.setVisibility(View.VISIBLE);
        mButtonAvailability.setOnClickListener(this);
        mTrainNumber = intent.getStringExtra(TrainEnquiry.TRAIN);
        mSrc = intent.getStringExtra(TrainEnquiry.SRC);
        mDst = intent.getStringExtra(TrainEnquiry.DST);
        mDay = intent.getStringExtra(TrainEnquiry.DAY_TRAVEL);
        mMonth = intent.getStringExtra(TrainEnquiry.MONTH_TRAVEL);
        mCls = intent.getStringExtra(TrainEnquiry.CLS);
        new GetAvail().execute();
        mDialog.setMessage("Fetching train availability . . .");
    }
}