错误消息认为我的对象是静态的。-Android

错误消息认为我的对象是静态的。-Android,android,static,Android,Static,我收到一条错误消息,说当我将实例传递给我的方法时,无法对非静态方法进行静态引用。它是一个非静态类的实例 要传递的实例的类: package com.btf271.dbmodel; public class AppUser { private String imagePath; public AppUser(){ //default constructor } public AppUser(String imagePath){

我收到一条错误消息,说当我将实例传递给我的方法时,无法对非静态方法进行静态引用。它是一个非静态类的实例

要传递的实例的类:

package com.btf271.dbmodel;

public class AppUser {
    private String imagePath;

    public AppUser(){
        //default constructor
    }

    public AppUser(String imagePath){
        this.imagePath = imagePath;
    }

    public String getImagePath() {
        return this.imagePath;
    }
}
通过它:

private void insertUserToDB(){
        AppUser user1 = new AppUser(mProfilePicPath);
        long user1_id = dbhelper.createAppUserSQLiteEntry(user1); //error at this line
    }

错误引用的是方法createAppUserSQLiteEntry,而不是传递给该方法的对象。您对该方法的定义是什么样的?dbhelper是类的名称还是对象实例的名称?dbhelper是类名而不是变量。感谢您提出关于dbhelper是什么的问题。这就是课堂。dbHelper就是这个实例。必须更改类名才能有大写字母。我愚蠢的错误。