02-14 16:41:01.518 1108-1108/com.example.akinyemi.parselogintutorial E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.akinyemi.parselogintutorial, PID: 1108 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.akinyemi.parselogintutorial/com.example.akinyemi.parselogintutorial.MyActivity}: java.lang.NullPointerException
public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Parse.initialize(this, "Oej48di7dmNFQ41jnW3AO980BiWG9hLjJNQDhMxn", "CaegN9WONiI3p1F99EDFDlKSzQpuTomFejSSBPAx"); // Determine whether the current user is an anonymous user if (ParseAnonymousUtils.isLinked(ParseUser.getCurrentUser())) { // If user is anonymous, send the user to LoginSignupActivity.class Intent intent = new Intent(MyActivity.this, LoginSignupActivity.class); startActivity(intent); finish(); } else { // If current user is NOT anonymous user // Get current user data from Parse.com ParseUser currentUser = ParseUser.getCurrentUser(); if (currentUser != null) { // Send logged in users to Welcome.class Intent intent = new Intent(MyActivity.this, Welcome.class); startActivity(intent); finish(); } else { // Send user to LoginSignupActivity.class Intent intent = new Intent(MyActivity.this, LoginSignupActivity.class); startActivity(intent); finish(); } } } ParseApplication.java public class ParseApplication extends Application { public static final String YOUR_APPLICATION_ID = "Oej48di7dmNFQ41jnW3AO980BiWG9hLjJNQDhMxn"; public static final String YOUR_CLIENT_KEY = "CaegN9WONiI3p1F99EDFDlKSzQpuTomFejSSBPAx"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(); // Add your initialization code here Parse.initialize(this, "Oej48di7dmNFQ41jnW3AO980BiWG9hLjJNQDhMxn", "CaegN9WONiI3p1F99EDFDlKSzQpuTomFejSSBPAx"); ParseUser.enableAutomaticUser(); ParseACL defaultACL = new ParseACL(); // If you would like all objects to be private by default, remove this // line. defaultACL.setPublicReadAccess(true); ParseACL.setDefaultACL(defaultACL, true); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)