PageRenderTime 59ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/MyCampus/app/src/main/java/com/example/maheshraja/mycampus/Activity/EditProfileFragment.java

https://gitlab.com/techgenius/mycampus
Java | 725 lines | 529 code | 128 blank | 68 comment | 83 complexity | cac5c6f8880c0705d3ad9a30370062c7 MD5 | raw file
  1. package com.example.maheshraja.mycampus.Activity;
  2. import android.app.Activity;
  3. import android.app.ProgressDialog;
  4. import android.content.Context;
  5. import android.content.Intent;
  6. import android.content.pm.PackageInfo;
  7. import android.content.pm.PackageManager;
  8. import android.graphics.Bitmap;
  9. import android.graphics.drawable.BitmapDrawable;
  10. import android.location.Location;
  11. import android.location.LocationManager;
  12. import android.net.Uri;
  13. import android.os.Bundle;
  14. import android.os.CountDownTimer;
  15. import android.provider.MediaStore;
  16. import android.support.v7.widget.Toolbar;
  17. import android.util.Log;
  18. import android.view.LayoutInflater;
  19. import android.view.View;
  20. import android.view.ViewGroup;
  21. import android.widget.Button;
  22. import android.widget.EditText;
  23. import android.widget.ImageView;
  24. import android.widget.Toast;
  25. import com.example.maheshraja.mycampus.R;
  26. import com.example.maheshraja.mycampus.asynctask.SearchJobAsynTask;
  27. import com.example.maheshraja.mycampus.daos.JobportalDAo;
  28. import com.example.maheshraja.mycampus.database.DBHandler;
  29. import com.example.maheshraja.mycampus.dtos.DTO;
  30. import com.example.maheshraja.mycampus.dtos.JobPortalDTO;
  31. import com.example.maheshraja.mycampus.listener.AsyncTaskCompleteListener;
  32. import com.example.maheshraja.mycampus.utility.MyConstants;
  33. import com.example.maheshraja.mycampus.utility.Utility;
  34. import com.google.android.gms.common.ConnectionResult;
  35. import com.google.android.gms.common.api.GoogleApiClient;
  36. import com.google.android.gms.location.LocationRequest;
  37. import com.google.android.gms.location.LocationServices;
  38. import org.json.JSONException;
  39. import org.json.JSONObject;
  40. import java.io.ByteArrayOutputStream;
  41. import java.io.File;
  42. import java.io.FileNotFoundException;
  43. import java.io.FileOutputStream;
  44. import java.io.IOException;
  45. import java.util.ArrayList;
  46. public class EditProfileFragment extends BaseFragment {
  47. private Context context;
  48. EditText userNameEdt;
  49. EditText mobileNoEdt;
  50. EditText emailIdEdt;
  51. EditText KeySkillEdt;
  52. EditText reg_resume;
  53. EditText reg_sscper;
  54. EditText reg_inter;
  55. EditText reg_btech;
  56. Button btnSubmit;
  57. EditText preferedlocation;
  58. private Toolbar mToolbar;
  59. private String TAG = "RegistrationActivity";
  60. private CountDownTimer mLocationCountDownTimer;
  61. private ProgressDialog dialog;
  62. protected final int COUNT_DOWN_TIME = 30000;
  63. protected final int COUNT_DOWN_TIME_INTERVAL = 1000;
  64. protected static boolean checkForLocation = true;
  65. private String current;
  66. private File mypath;
  67. private Uri uriSavedImage;
  68. private final int IMAGECAPTURE_ACTIVITY = 100;
  69. private String imgFilePath = "";
  70. private ImageView mCameraImg;
  71. private View rootView;
  72. @Override
  73. public View onCreateView(LayoutInflater inflater, ViewGroup container,
  74. Bundle savedInstanceState) {
  75. context=mActivity;
  76. View rootView = inflater.inflate(R.layout.fragemt_jobportalform, container, false);
  77. userNameEdt = (EditText)rootView. findViewById(R.id.reg_name);
  78. mobileNoEdt = (EditText)rootView. findViewById(R.id.reg_mobile);
  79. emailIdEdt = (EditText)rootView. findViewById(R.id.reg_email);
  80. KeySkillEdt = (EditText)rootView. findViewById(R.id.reg_keyskills);
  81. reg_resume = (EditText)rootView. findViewById(R.id.reg_resume);
  82. reg_sscper = (EditText)rootView. findViewById(R.id.reg_sscper);
  83. reg_inter=(EditText)rootView. findViewById(R.id.reg_inter);
  84. reg_btech=(EditText)rootView. findViewById(R.id.reg_btech);
  85. preferedlocation=(EditText)rootView. findViewById(R.id.reg_location);
  86. btnSubmit = (Button)rootView. findViewById(R.id.reg_submit);
  87. btnSubmit.setOnClickListener(new View.OnClickListener() {
  88. @Override
  89. public void onClick(View v) {
  90. String validation = validateFields();
  91. if (validation == null) {
  92. if (Utility.networkAvailability(context)) {
  93. // showProgress();
  94. registrationProcess();
  95. // loginProcess();
  96. //saveData(getUserData());;
  97. } else {
  98. Utility.showAlert(context, null, getString(R.string.check_connection));
  99. }
  100. } else {
  101. Utility.showAlert(context, "Alert", validation);
  102. }
  103. //uploadImage();
  104. }
  105. });
  106. populateData();
  107. return rootView;
  108. }
  109. private AsyncTaskCompleteListener taskCompleteListener = new AsyncTaskCompleteListener() {
  110. @Override
  111. public void onAsynComplete(String result) {
  112. if (result != null) {
  113. if(Utility.isJSONValid(result)){
  114. try {
  115. JSONObject object = new JSONObject(result);
  116. int code = object.optInt("code");
  117. if(code == 100){
  118. Utility.showAlert(mActivity, null, "Updated Your Profile Successfully");
  119. }else if(code == 101){
  120. Utility.showAlert(mActivity, null, "Failed Updated Your Profile");
  121. }else{
  122. Utility.showAlert(mActivity, null, "Unknown response");
  123. }
  124. } catch (JSONException e) {
  125. e.printStackTrace();
  126. }
  127. }else{
  128. Utility.showAlert(mActivity, null, "Invalid Response contact system admin");
  129. }
  130. } else {
  131. Utility.showAlert(mActivity, "Network problem", "Check your internet connection");
  132. }
  133. Utility.hideProgressDialog();
  134. }
  135. };
  136. private void registrationProcess() {
  137. JobPortalDTO dto = (JobPortalDTO) getUserData();
  138. JSONObject reqJson = new JSONObject();
  139. try {
  140. reqJson.put("userName", dto.getUserName());
  141. System.out.println("userName" + dto.getUserName());
  142. reqJson.put("mobileNumber", dto.getMobileNumber());
  143. System.out.println("mobileNumber"+ dto.getMobileNumber());
  144. reqJson.put("preferedLocation", dto.getPreferedLocation());
  145. System.out.println("preferedLocation"+ dto.getPreferedLocation());
  146. reqJson.put("emailAddress", dto.getEmailAddress());
  147. System.out.println("emailAddress"+dto.getEmailAddress());
  148. reqJson.put("resumeHeadline", dto.getResumeHeadline());
  149. System.out.println("resumeHeadline" + dto.getResumeHeadline());
  150. reqJson.put("keySkills", dto.getKeySkills());
  151. System.out.println("keySkills" + dto.getKeySkills());
  152. reqJson.put("SSCPercentage", dto.getSSCPercentage());
  153. System.out.println("SSCPercentage" + dto.getSSCPercentage());
  154. reqJson.put("interPercentage", dto.getInterPercentage());
  155. System.out.println("interPercentage" + dto.getInterPercentage());
  156. reqJson.put("btechPercentage", dto.getBtechPercentage());
  157. System.out.println("btechPercentage" + dto.getBtechPercentage());
  158. } catch (JSONException e) {
  159. e.printStackTrace();
  160. }catch (Exception e){
  161. }
  162. SearchJobAsynTask loginAsync = new SearchJobAsynTask(reqJson.toString(), completeListener, MyConstants.CONNECTION_TIMEOUT, MyConstants.SOCKET_TIMEOUT);
  163. Utility.showProgressDialog(context);
  164. loginAsync.execute(MyConstants.JobPortal_Update_URL);
  165. }
  166. private AsyncTaskCompleteListener completeListener = new AsyncTaskCompleteListener() {
  167. @Override
  168. public void onAsynComplete(String result) {
  169. if (result != null) {
  170. if(Utility.isJSONValid(result)){
  171. try {
  172. JSONObject object = new JSONObject(result);
  173. int code = object.optInt("code");
  174. if(code == 100){
  175. saveData(getUserData());
  176. Utility.showAlert(mActivity, null, "Updated Your Profile Successfully");
  177. return;
  178. //Utility.showAlert(mActivity, null, "Informed Successfully");
  179. }else if(code == 101){
  180. Utility.showAlert(mActivity, null, "Failed Informed");
  181. }else{
  182. Utility.showAlert(mActivity, null, "Unknown response");
  183. }
  184. } catch (JSONException e) {
  185. e.printStackTrace();
  186. }
  187. }else{
  188. Utility.showAlert(mActivity, null, "Invalid Response contact system admin");
  189. }
  190. } else {
  191. Utility.showAlert(mActivity, "Network problem", "Check your internet connection");
  192. }
  193. Utility.hideProgressDialog();
  194. }
  195. };
  196. private void showProgress() {
  197. final ProgressDialog progressDialog = new ProgressDialog(mActivity);
  198. progressDialog.setMessage("Please wait");
  199. progressDialog.setCanceledOnTouchOutside(false);
  200. progressDialog.setCancelable(false);
  201. progressDialog.show();
  202. new CountDownTimer(500, 1000) {
  203. @Override
  204. public void onTick(long millisUntilFinished) {
  205. }
  206. @Override
  207. public void onFinish() {
  208. progressDialog.cancel();
  209. saveData(getUserData());
  210. }
  211. }.start();
  212. }
  213. private void saveData(DTO userData) {
  214. JobportalDAo.getInstance().update(userData, DBHandler.getInstance(mActivity).getDBObject(1));
  215. }
  216. private DTO getUserData() {
  217. JobPortalDTO dto = new JobPortalDTO();
  218. dto.setUserName(getText(userNameEdt));
  219. dto.setMobileNumber(getText(mobileNoEdt));
  220. dto.setEmailAddress(getText(emailIdEdt));
  221. dto.setPreferedLocation(getText(preferedlocation));
  222. dto.setResumeHeadline(getText(reg_resume));
  223. dto.setSSCPercentage(getText(reg_sscper));
  224. dto.setBtechPercentage(getText(reg_btech));
  225. dto.setInterPercentage(getText(reg_inter));
  226. dto.setKeySkills(getText(KeySkillEdt));
  227. return dto;
  228. }
  229. private String validateFields() {
  230. if (isTextEmpty(userNameEdt)) {
  231. return "Enter your name";
  232. }
  233. if (isTextEmpty(mobileNoEdt)) {
  234. return "Enter mobile number";
  235. }
  236. if (mobileNoEdt.getText().toString().trim().length() <= 9) {
  237. return "Enter valid mobile number";
  238. }
  239. if (isTextEmpty(emailIdEdt)) {
  240. return "Enter mail ID";
  241. }
  242. if(!isValidEmailAddress(getText(emailIdEdt))){
  243. return "Enter valid mail ID";
  244. }
  245. if (isTextEmpty(KeySkillEdt)) {
  246. return "Enter Keyskill";
  247. }
  248. if (isTextEmpty(reg_resume)) {
  249. return "Enter Resume Headline";
  250. }
  251. if (isTextEmpty(reg_sscper)) {
  252. return "Enter SSC Percentage";
  253. }
  254. /*if (isTextEmpty(uidEdt)) {
  255. return "Enter UID";
  256. }*/
  257. if (isTextEmpty(reg_inter)) {
  258. return "Enter Inter Percentage";
  259. }
  260. /*if (isTextEmpty(locationEdt)) {
  261. return "Enter your location";
  262. }*/
  263. if (isTextEmpty(reg_btech)) {
  264. return "Enter BTECH Percentage";
  265. }
  266. if (isTextEmpty(preferedlocation)) {
  267. return "Enter Loctaion";
  268. }
  269. return null;
  270. }
  271. public boolean isValidEmailAddress(String email) {
  272. String ePattern = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$";
  273. java.util.regex.Pattern p = java.util.regex.Pattern.compile(ePattern);
  274. java.util.regex.Matcher m = p.matcher(email);
  275. return m.matches();
  276. }
  277. /*private static boolean isValidEmailAddress(String email) {
  278. boolean result = true;
  279. try {
  280. InternetAddress emailAddr = new InternetAddress(email);
  281. emailAddr.validate();
  282. } catch (AddressException ex) {
  283. result = false;
  284. }
  285. return result;
  286. }*/
  287. private void navigateApp() {
  288. mActivity.popFragments();
  289. }
  290. private boolean isTextEmpty(EditText editText) {
  291. if (!editText.getText().toString().trim().isEmpty())
  292. return false;
  293. else
  294. return true;
  295. }
  296. private String getText(EditText editText) {
  297. return editText.getText().toString().trim();
  298. }
  299. /**
  300. * Creating google api client object
  301. */
  302. protected synchronized void buildGoogleApiClient() {
  303. if (mGoogleApiClient == null) {
  304. mGoogleApiClient = new GoogleApiClient.Builder(mActivity)
  305. .addConnectionCallbacks(this)
  306. .addOnConnectionFailedListener(this)
  307. .addApi(LocationServices.API).build();
  308. createLocationRequest();
  309. }
  310. }
  311. /**
  312. * Creating location request object
  313. */
  314. protected void createLocationRequest() {
  315. if (mLocationRequest == null) {
  316. mLocationRequest = new LocationRequest();
  317. mLocationRequest.setInterval(0);
  318. mLocationRequest.setFastestInterval(0);
  319. mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
  320. mLocationRequest.setSmallestDisplacement(0); // 10 meters
  321. }
  322. }
  323. @Override
  324. public void onConnectionFailed(ConnectionResult result) {
  325. Log.i(TAG, "Connection failed: ConnectionResult.getErrorCode() = " + result.getErrorCode());
  326. }
  327. @Override
  328. public void onConnected(Bundle arg0) {
  329. if (location != null && location.length() > 0)
  330. return;
  331. try {
  332. Location loc = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
  333. if (loc != null) {
  334. location = "" + loc.getLatitude() + "," + loc.getLongitude();
  335. }
  336. } catch (SecurityException e) {
  337. e.printStackTrace();
  338. }
  339. LocationManager lm = (LocationManager) mActivity.getSystemService(mActivity.LOCATION_SERVICE);
  340. if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
  341. startLocationUpdates();
  342. mLocationCountDownTimer = new CountDownTimer(COUNT_DOWN_TIME, COUNT_DOWN_TIME_INTERVAL) {
  343. @Override
  344. public void onTick(long millisUntilFinished) {
  345. }
  346. @Override
  347. public void onFinish() {
  348. try {
  349. stopLocationUpdates();
  350. Location loc = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
  351. if (loc != null) {
  352. location = "" + loc.getLatitude() + "," + loc.getLongitude();
  353. }
  354. } catch (SecurityException e) {
  355. }
  356. }
  357. };
  358. mLocationCountDownTimer.start();
  359. }
  360. }
  361. @Override
  362. public void onConnectionSuspended(int arg0) {
  363. mGoogleApiClient.connect();
  364. }
  365. /**
  366. * Starting the location updates
  367. */
  368. protected void startLocationUpdates() {
  369. try {
  370. if (mGoogleApiClient.isConnected())
  371. LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
  372. } catch (SecurityException e) {
  373. }
  374. }
  375. /**
  376. * Stopping location updates
  377. */
  378. protected void stopLocationUpdates() {
  379. if (mGoogleApiClient.isConnected())
  380. LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
  381. }
  382. @Override
  383. public void onLocationChanged(Location loc) {
  384. // Assign the new location
  385. //mLastLocation = location;
  386. if (loc != null) {
  387. location = "" + loc.getLatitude() + "," + loc.getLongitude();
  388. stopLocationUpdates();
  389. cancelLocationTimer();
  390. }
  391. }
  392. private void cancelLocationTimer() {
  393. if (mLocationCountDownTimer != null) {
  394. mLocationCountDownTimer.cancel();
  395. mLocationCountDownTimer = null;
  396. }
  397. }
  398. protected void getCurrentLocation(final Context mActivity) {
  399. LocationManager lm = (LocationManager) mActivity.getSystemService(mActivity.LOCATION_SERVICE);
  400. if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
  401. if (mGoogleApiClient != null) {
  402. if (mGoogleApiClient.isConnected()) {
  403. mGoogleApiClient.disconnect();
  404. }
  405. mGoogleApiClient.connect();
  406. }
  407. showProgressDialog();
  408. new CountDownTimer(COUNT_DOWN_TIME, COUNT_DOWN_TIME_INTERVAL) {
  409. @Override
  410. public void onTick(long millisUntilFinished) {
  411. if (location != null) {
  412. hideProgressDialog();
  413. Toast.makeText(mActivity, MyConstants.GOT_LOCATION_MSG, Toast.LENGTH_SHORT).show();
  414. this.cancel();
  415. }
  416. }
  417. @Override
  418. public void onFinish() {
  419. hideProgressDialog();
  420. Toast.makeText(mActivity, MyConstants.GOT_LOCATION_MSG, Toast.LENGTH_SHORT).show();
  421. checkForLocation = false;
  422. this.cancel();
  423. }
  424. }.start();
  425. } else {
  426. Utility.showAlertToOpenGPS(mActivity);
  427. }
  428. }
  429. public void showProgressDialog() {
  430. dialog = new ProgressDialog(mActivity);
  431. dialog.setCanceledOnTouchOutside(false);
  432. dialog.setCancelable(false);
  433. dialog.setMessage("Please wait...");
  434. dialog.show();
  435. }
  436. public void hideProgressDialog() {
  437. if (dialog != null) {
  438. dialog.dismiss();
  439. }
  440. }
  441. public void onStart() {
  442. super.onStart();
  443. if ((mGoogleApiClient != null) && (!mGoogleApiClient.isConnected())) {
  444. mGoogleApiClient.connect();
  445. }
  446. }
  447. public void onStop() {
  448. super.onStop();
  449. if ((mGoogleApiClient != null) && (mGoogleApiClient.isConnected())) {
  450. mGoogleApiClient.disconnect();
  451. }
  452. }
  453. private void dispatchTakePictureIntent() {
  454. Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  455. startActivityForResult(intent, IMAGECAPTURE_ACTIVITY);
  456. /*Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  457. if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
  458. startActivityForResult(takePictureIntent, IMAGECAPTURE_ACTIVITY);
  459. }*/
  460. }
  461. private void captureImage() {
  462. File dir;
  463. if (Utility.getFileDir(mActivity) != null && Utility.getFileDir(mActivity).length() > 0) {
  464. dir = new File(Utility.getFileDir(mActivity));
  465. } else {
  466. // File sdCard = Environment.getExternalStorageDirectory();
  467. PackageManager m = mActivity.getPackageManager();
  468. String s = mActivity.getPackageName();
  469. try {
  470. PackageInfo p = m.getPackageInfo(s, 0);
  471. s = p.applicationInfo.dataDir;
  472. } catch (PackageManager.NameNotFoundException e) {
  473. Log.w("yourtag", "Error Package name not found ", e);
  474. return;
  475. }
  476. File sdCard = new File(s);
  477. dir = new File(sdCard.getAbsolutePath() + "/iSave");
  478. if (!dir.exists()) {
  479. dir.mkdir();
  480. }
  481. Utility.setFileDir(dir.toString(), mActivity);
  482. }
  483. String uniqueId = Utility.getCurrentDate().replaceAll("/", "_") + "_" + System.currentTimeMillis() + ".png";
  484. current = uniqueId;
  485. mypath = new File(dir, current);
  486. Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  487. uriSavedImage = Uri.fromFile(mypath);
  488. //intent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
  489. if (hasImageCaptureBug()) {
  490. intent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
  491. } else {
  492. intent.putExtra(MediaStore.EXTRA_OUTPUT, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
  493. }
  494. startActivityForResult(intent, IMAGECAPTURE_ACTIVITY);
  495. }
  496. public boolean hasImageCaptureBug() {
  497. // list of known devices that have the bug
  498. ArrayList<String> devices = new ArrayList<String>();
  499. devices.add("android-devphone1/dream_devphone/dream");
  500. devices.add("generic/sdk/generic");
  501. devices.add("vodafone/vfpioneer/sapphire");
  502. devices.add("tmobile/kila/dream");
  503. devices.add("verizon/voles/sholes");
  504. devices.add("google_ion/google_ion/sapphire");
  505. return devices.contains(android.os.Build.BRAND + "/" + android.os.Build.PRODUCT + "/"
  506. + android.os.Build.DEVICE);
  507. }
  508. @Override
  509. public void onActivityResult(int requestCode, int resultCode, Intent data) {
  510. switch (requestCode) {
  511. case IMAGECAPTURE_ACTIVITY:
  512. if (requestCode == IMAGECAPTURE_ACTIVITY && resultCode == Activity.RESULT_OK) {
  513. Bitmap photo = (Bitmap) data.getExtras().get("data");
  514. BitmapDrawable bitmapDrawable = new BitmapDrawable(photo);
  515. mCameraImg.setImageDrawable(bitmapDrawable);
  516. try {
  517. File dir;
  518. if (Utility.getFileDir(mActivity) != null && Utility.getFileDir(mActivity).length() > 0) {
  519. dir = new File(Utility.getFileDir(mActivity));
  520. } else {
  521. PackageManager m = mActivity.getPackageManager();
  522. String s = mActivity.getPackageName();
  523. try {
  524. PackageInfo p = m.getPackageInfo(s, 0);
  525. s = p.applicationInfo.dataDir;
  526. } catch (PackageManager.NameNotFoundException e) {
  527. Log.w("yourtag", "Error Package name not found ", e);
  528. return;
  529. }
  530. File sdCard = new File(s);
  531. dir = new File(sdCard.getAbsolutePath() + "/iSave");
  532. if (!dir.exists()) {
  533. dir.mkdir();
  534. }
  535. Utility.setFileDir(dir.toString(), mActivity);
  536. } // boolean
  537. //status = isExternalStoragePresent();
  538. // String uniqueId = Utility.getCurrentDate().replaceAll("/", "_") + "_" + System.currentTimeMillis() + ".png";
  539. String uniqueId = getText(emailIdEdt)+".png";
  540. current = uniqueId;
  541. System.out.println("current" + current);
  542. mypath = new File(dir, current);
  543. FileOutputStream mFileOutStream = new FileOutputStream(mypath);
  544. photo.compress(Bitmap.CompressFormat.PNG, MyConstants.photoQuality, mFileOutStream); // Converting to byte array
  545. ByteArrayOutputStream stream = new ByteArrayOutputStream();
  546. photo.compress(Bitmap.CompressFormat.JPEG, MyConstants.photoQuality, stream);
  547. imgFilePath = current;
  548. Utility.setProfileImageURL(current, mActivity);
  549. System.out.println("capture image ===" + mypath);
  550. mFileOutStream.flush();
  551. mFileOutStream.close();
  552. } catch (FileNotFoundException e) {
  553. e.printStackTrace();
  554. } catch (IOException e) {
  555. e.printStackTrace();
  556. }
  557. /*try {
  558. BitmapFactory.Options options = new BitmapFactory.Options();
  559. options.inSampleSize = 4;
  560. final Bitmap bitmap = BitmapFactory.decodeFile(
  561. uriSavedImage.getPath(), options);
  562. FileOutputStream mFileOutStream;
  563. try {
  564. mFileOutStream = new FileOutputStream(
  565. uriSavedImage.getPath());
  566. bitmap.compress(Bitmap.CompressFormat.PNG, 0, mFileOutStream);
  567. mFileOutStream.flush();
  568. mFileOutStream.close();
  569. imgFilePath = current;
  570. } catch (FileNotFoundException e) {
  571. e.printStackTrace();
  572. } catch (IOException e) {
  573. e.printStackTrace();
  574. }
  575. mCameraImg.setImageDrawable(new BitmapDrawable(bitmap));
  576. //pending
  577. //mCamera.setBackgroundDrawable(new BitmapDrawable(bitmap));
  578. } catch (Exception e) {
  579. e.printStackTrace();
  580. }*/
  581. }
  582. break;
  583. }
  584. }
  585. private void populateData(){
  586. JobPortalDTO dto = (JobPortalDTO) JobportalDAo.getInstance().getRecords(DBHandler.getInstance(mActivity).getDBObject(0)).get(0);
  587. userNameEdt.setText(dto.getUserName());
  588. mobileNoEdt.setText(dto.getMobileNumber());
  589. emailIdEdt.setText(dto.getEmailAddress());
  590. KeySkillEdt.setText(dto.getKeySkills());
  591. reg_inter.setText(dto.getInterPercentage());
  592. reg_sscper.setText(dto.getSSCPercentage());
  593. reg_btech.setText(dto.getBtechPercentage());
  594. preferedlocation.setText(dto.getPreferedLocation());
  595. reg_resume.setText(dto.getResumeHeadline());
  596. }
  597. }