// Path: src/com/suchagit/android2cloud/util/ErrorMethods.java
// public class ErrorMethods {
// 	public static Intent getEmailIntent(Fragment context, String type, String message) {
// 		Intent i = new Intent(Intent.ACTION_SEND);
// 		i.setType("message/rfc822");
// 		i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"android@2cloudproject.com"});
// 		i.putExtra(Intent.EXTRA_SUBJECT, "In-App Error Report");
// 		String message_prefix = "Error:\n";
// 		message_prefix += "Type: "+type+"\n";
// 		try {
// 			message_prefix += "Version: " + context.getActivity().getPackageManager().getPackageInfo(context.getActivity().getPackageName(), 0 ).versionCode + "\n";
// 		} catch (NameNotFoundException e) {
// 			message_prefix += "\n";
// 		}
// 		message_prefix += "Android Version: " + android.os.Build.VERSION.SDK + "\n";
// 		message_prefix += "Phone: " + android.os.Build.MODEL + "\n";
// 		message = message_prefix + message;
// 		i.putExtra(Intent.EXTRA_TEXT   , message);
// 		return i;
// 	}
// }


import com.suchagit.android2cloud.R;
import com.suchagit.android2cloud.util.ErrorMethods;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
        int body = R.string.http_client_error;
        int yesButton = R.string.default_error_ok;
        int noButton = R.string.report_error_button;
        
        final String host = getArguments().getString("host");
        final String account = getArguments().getString("account");
        final String token = getArguments().getString("token");
        final String secret = getArguments().getString("secret");
        final String raw_data = getArguments().getString("raw_data");

        return new AlertDialog.Builder(getActivity())
    		.setCancelable(true)
            .setTitle(title)
            .setMessage(body)
            .setPositiveButton(yesButton,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                        	dialog.cancel();
                        }
                    }
                )
            .setNegativeButton(noButton,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                		String message = "Account: " + account +"\n";
                		message += "Host: " + host + "\n";
                		message += "Token: " + token + "\n";
                		message += "Secret: " + secret + "\n";
                		message += "Raw Result Data: \n";
                		message += raw_data + "\n";
// Path: src/com/suchagit/android2cloud/util/ErrorMethods.java
// public class ErrorMethods {
// 	public static Intent getEmailIntent(Fragment context, String type, String message) {
// 		Intent i = new Intent(Intent.ACTION_SEND);
// 		i.setType("message/rfc822");
// 		i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"android@2cloudproject.com"});
// 		i.putExtra(Intent.EXTRA_SUBJECT, "In-App Error Report");
// 		String message_prefix = "Error:\n";
// 		message_prefix += "Type: "+type+"\n";
// 		try {
// 			message_prefix += "Version: " + context.getActivity().getPackageManager().getPackageInfo(context.getActivity().getPackageName(), 0 ).versionCode + "\n";
// 		} catch (NameNotFoundException e) {
// 			message_prefix += "\n";
// 		}
// 		message_prefix += "Android Version: " + android.os.Build.VERSION.SDK + "\n";
// 		message_prefix += "Phone: " + android.os.Build.MODEL + "\n";
// 		message = message_prefix + message;
// 		i.putExtra(Intent.EXTRA_TEXT   , message);
// 		return i;
// 	}
// }


// Path: src/com/suchagit/android2cloud/errors/HttpClientErrorDialogFragment.java
import com.suchagit.android2cloud.R;
import com.suchagit.android2cloud.util.ErrorMethods;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

        int body = R.string.http_client_error;
        int yesButton = R.string.default_error_ok;
        int noButton = R.string.report_error_button;
        
        final String host = getArguments().getString("host");
        final String account = getArguments().getString("account");
        final String token = getArguments().getString("token");
        final String secret = getArguments().getString("secret");
        final String raw_data = getArguments().getString("raw_data");

        return new AlertDialog.Builder(getActivity())
    		.setCancelable(true)
            .setTitle(title)
            .setMessage(body)
            .setPositiveButton(yesButton,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                        	dialog.cancel();
                        }
                    }
                )
            .setNegativeButton(noButton,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                		String message = "Account: " + account +"\n";
                		message += "Host: " + host + "\n";
                		message += "Token: " + token + "\n";
                		message += "Secret: " + secret + "\n";
                		message += "Raw Result Data: \n";
                		message += raw_data + "\n";
                		Intent report = ErrorMethods.getEmailIntent(HttpClientErrorDialogFragment.this, "http_client_error", message);