0

Trying to send user details who is log in to my app with facebook details to mysql database using databasehelper.java here i am getting error in DatabaseHelper helper1 = new DatabaseHelper(this); is there any syntax mistake or any wrong code i am using for sending the data to my server ??

public void getProfileInformation() {
     Bundle params = new Bundle();
        params.putString("fields", "id,name,email");

    mAsyncRunner.request("me", new RequestListener() {
        @Override
        public void onComplete(String response, Object state) {
            Log.d("Profile", response);
            String json = response;
            try {
                JSONObject profile = new JSONObject(json);
                // getting name of the user
                final String name = profile.getString("name");
                // getting email of the user
                final String email = profile.getString("email");
                final String id = profile.getString("id");

                /*runOnUiThread(new Runnable() {

                    @Override
                    public void run() {

                        Toast.makeText(getApplicationContext(),
                                "Name: " + name + "\nEmail: " + email + "\nid" + id,
                                Toast.LENGTH_LONG).show();
                    }

                });*/

                if(id != null && id.length() > 0){

                    String accessToken = null;
                    DatabaseHelper helper1 = new DatabaseHelper(this);
                    DatabaseUtility dao = new DatabaseUtility(helper);
                    try {
                        accessToken = dao.getAccessToken();
                    } catch (Exception e1) {
                    }
                    Map<String , String> params = new HashMap<String,String>();
                    params.put(Constants.FACEBOOK_ID, id);
                    params.put(Constants.ACCESS_TOKEN_PARAM, accessToken);
                    Status status = null;
                    try {
                        status = Utils.addFacebookAccount(params, LoginActivity.this);
                    } catch (NullPointerException e) {
                    } 
                    catch (JSONException e) {
                    }

                    Utils.showErrorMessage(getApplicationContext(), Constants.CONNECTED_TO_FACEBOOK_ERROR, Constants.TOAST_VISIBLE_LONG);

                    Intent i=new Intent(getApplicationContext(),ProfileActivity.class);
                    startActivity(i);
            }}
                catch (JSONException e) {
                e.printStackTrace();
            }
        }
4

0 回答 0