Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- filePath = data.getData();
- path = filePath+"";
- if (requestCode == CAMERA_CAPTURE_VIDEO_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null && data.getData() != null) {
- vid.setVideoPath(path);
- vid.start();
- }else if(requestCode == PICK_VIDEO_REQUEST && resultCode == Activity.RESULT_OK){
- vid.setVideoPath(path);
- vid.start();
- //selectedpath = getPath(filePath).toString();
- }
- }
- btnVidSubmit.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- dialog = new ProgressDialog(RecordVideo.this);
- dialog.setMessage("Uploading your post...");
- dialog.setCancelable(false);
- dialog.show();
- SharedPreferences pref = RecordVideo.this.getSharedPreferences("userinfo", Context.MODE_PRIVATE);
- vuname = pref.getString(KEY_UNAME,"");
- vpass = pref.getString(KEY_PASS,"");
- vfname = pref.getString(KEY_FNAME,"");
- vlname = pref.getString(KEY_LNAME,"");
- vloc = pref.getString(KEY_LOC,"");
- vcontact = pref.getString(KEY_CNUM,"");
- Toast.makeText(RecordVideo.this,path+"",Toast.LENGTH_LONG).show();
- Response.Listener<String> responseListener = new Response.Listener<String>() {
- @Override
- public void onResponse(String response) {
- try {
- JSONObject jsonResponse = new JSONObject(response);
- boolean success = jsonResponse.getBoolean("success");
- if (success) {
- dialog.dismiss();
- Intent i = new Intent(RecordVideo.this, MainActivity.class);
- startActivity(i);
- finish();
- Toast.makeText(RecordVideo.this,"You have successfully uploaded your post!",Toast.LENGTH_LONG).show();
- } else if(!success){
- dialog.dismiss();
- AlertDialog.Builder builder = new AlertDialog.Builder(RecordVideo.this);
- builder.setMessage("Failed")
- .setNegativeButton("Retry", null)
- .create()
- .show();
- }
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
- };
- RecordVideoRequest rvr = new RecordVideoRequest(vuname,vfname,vlname, vloc, vcontact, path, vselectedDept,lat,lon,responseListener);
- RequestQueue queue = Volley.newRequestQueue(RecordVideo.this);
- queue.add(rvr);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement