Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Adding Users Using Parse.com Creating an Account and App on Parse.com

brian colliflower
brian colliflower
15,433 Points

test values not saving to Parse

I am using android Studio and following along had some trouble getting Parse.com added but it seems to be working I have the auto complete and it compiles but no matter where I put the code it doesnt seem to get called I am not seeing my toast messages and the object is not saving to Parse.com here is the last try it should run as soon as the login screen comes up package com.henchman.brian.ribbit;

import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast;

import com.parse.Parse; import com.parse.ParseUser; import com.parse.SignUpCallback;

import butterknife.ButterKnife; import butterknife.InjectView;

public class LogInActivity extends ActionBarActivity { @InjectView(R.id.SignUpText)TextView mSignUpText;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_log_in);
    ButterKnife.inject(this);

    Parse.initialize(this, "4hppwGg4dx8tP0sfKCOOXrGItqsbblNoXEGLP0li", "QiiMzBQIrWrV56HFljQKb2WGRz4jxt56P4GH238a");

    ParseUser user = new ParseUser();
    user.setUsername("my name");
    user.setPassword("my pass");
    user.setEmail("email@example.com");

// other fields can be set just like with ParseObject //user.put("phone", "650-555-0000");

    user.signUpInBackground(new SignUpCallback() {


        @Override
        public void done(com.parse.ParseException e) {
            if (e == null) {
                Toast.makeText(getApplicationContext(), "Yay it worked", Toast.LENGTH_LONG);
            } else {
                // Sign up didn't succeed. Look at the ParseException
                // to figure out what went wrong
                Toast.makeText(getApplicationContext(), "ERROR MASAGE" + e, Toast.LENGTH_LONG);
            }
        }
    });





    mSignUpText.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(LogInActivity.this,SignUpActivity.class);
            startActivity(intent);


        }
    });
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_log_in, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}

}

1 Answer

brian colliflower
brian colliflower
15,433 Points

Nevermind I fixed it the permission wasn't right I got it working and set the code back the way it was supposed to yikes Dumb mistake