简体   繁体   中英

cannot resolve symbol Object in Object.,extend

I'm trying to use a parse server from back4app as my backend and I'm having troubles with the initial installation part.So I followed the documentation given in back4app to connect my app to the parse server and the installation shows in the dashboard. However when I run the code given below it gives an error saying that cannot resolve symbol Object

    package com.example.android.beastt;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.parse.ParseObject;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
 import android.widget.Toast;

import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseUser;

import java.util.Arrays;


public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ParseObject myFirstClass = Parse.Object.extend("MyFirstClass");
        myFirstClass.put("name", "I'm able to save objects!");
        myFirstClass.saveInBackground();

    }
}

Any help would be appreciated in solving this error or a tutorial on how to use back4app as a whole

I was having the same issue but was able to resolve by changing code from this:

 ParseObject myFirstClass = Parse.Object.extend("MyFirstClass");

to this:

ParseObject myFirstClass = new ParseObject("MyFirstClass");

For reference:

ParseObject myFirstClass = new ParseObject("MyFirstClass");
        myFirstClass.put("name", "I'm able to save objects!");
        myFirstClass.saveInBackground();

This should allow you to save the object. You can also find more information here: https://dashboard.back4app.com/apidocs?java#objects-api

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM