package com.teamNikAml.doctorpatient.fragments;

import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.teamNikAml.doctorpatient.activity.R;


/*import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;*/

public class BackupFragment extends Fragment {

	

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

		View rootView = inflater.inflate(R.layout.fragment_backup, container,
				false);

		return rootView;
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
	}

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

	@Override
	public void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	}
/*
	@Override
	public void onConnectionFailed(ConnectionResult arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onConnected(Bundle arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onConnectionSuspended(int arg0) {
		// TODO Auto-generated method stub
		
	}*/
	
	
}

@@ -42,16 +42,141 @@
 ments;%0A%0A
+import java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileOutputStream;%0Aimport java.nio.channels.FileChannel;%0A%0A
 import a
@@ -192,24 +192,24 @@
 p.Fragment;%0A
-
 import andro
@@ -249,24 +249,55 @@
 .os.Bundle;%0A
+import android.os.Environment;%0A
 import andro
@@ -903,16 +903,1053 @@
 alse);%0A%0A
+%09%09try %7B%0A%09        File sd = Environment.getExternalStorageDirectory();%0A%09        File data = Environment.getDataDirectory();%0A%0A%09        if (data.canWrite()) %7B%0A%09            String currentDBPath = %22//data//%22+ %22com.teamNikAml.doctorpatient.activity%22 +%22//databases//%22+%22PatientRecordsDatabase%22;%0A%09            String backupDBPath = %22DatabaseBackup%22;%0A%09            File currentDB = new File(data, currentDBPath);%0A%09            File backupDB = new File(data, backupDBPath);%0A%0A%09            if (currentDB.exists()) %7B%0A%09                FileInputStream fileInputStream = new FileInputStream(currentDB);%0A%09%09%09%09%09FileChannel src = fileInputStream.getChannel();%0A%09                FileOutputStream fileOutputStream = new FileOutputStream(backupDB);%0A%09%09%09%09%09FileChannel dst = fileOutputStream.getChannel();%0A%09                dst.transferFrom(src, 0, src.size());%0A%09                src.close();%0A%09                dst.close();%0A%09                fileInputStream.close();%0A%09                fileOutputStream.close();%0A%09            %7D%0A%09        %7D%0A%09    %7D catch (Exception e) %7B%0A%09    %7D%0A
 %09%09return

backup phone internal mem