0

Ubacity FirebaseコースでFireBase UI ListAdapterを実装することに固執しています。全体のものは大きく変化しており、現在ActiveListAdapter.javaでエラーが発生します:Udacity Firebaseチュートリアル - Firebase UIリストアダプタの実装

Cannot resolve method 'super(andoid.app.Activity, java.lang.Class, int, com.google.firebase.database.Query)'

は、誰もがこの問題に遭遇していますか?あなたはそれを解決する方法を知っていますか?

これは@Egorが正しい

import android.app.Activity; 
import android.view.View; 
import android.widget.TextView; 

import com.firebase.ui.FirebaseListAdapter; 
import com.google.firebase.FirebaseApp; 
import com.google.firebase.database.FirebaseDatabase; 
import com.google.firebase.database.Query; 
import com.udacity.firebase.shoppinglistplusplus.R; 
import com.udacity.firebase.shoppinglistplusplus.model.ShoppingList; 

/** 
* Populates the list_view_active_lists inside ShoppingListsFragment 
*/ 
public class ActiveListAdapter extends FirebaseListAdapter<ShoppingList> { 

    /** 
    * Public constructor that initializes private instance variables when adapter is created 
    */ 
    public ActiveListAdapter(Activity activity, Class<ShoppingList> modelClass, int modelLayout, 
          Query ref) { 
     super(activity, modelClass, modelLayout, ref); 
     this.mActivity = activity; 
    } 

    /** 
    * Protected method that populates the view attached to the adapter (list_view_active_lists) 
    * with items inflated from single_active_list.xml 
    * populateView also handles data changes and updates the listView accordingly 
    */ 

    @Override 
    protected void populateView(View view, ShoppingList list, int i) { 
     /** 
     * Grab the needed Textivews and strings 
     */ 
     TextView textViewListName = (TextView) view.findViewById(R.id.text_view_list_name); 
     TextView textViewCreatedByUser = (TextView) view.findViewById(R.id.text_view_created_by_user); 


     /* Set the list name and owner */ 
     textViewListName.setText(list.getListName()); 
     textViewCreatedByUser.setText(list.getOwner()); 
    } 
} 
+0

完全なエラーログを投稿できますか? –

+0

これは: 'super(andoid.app.Activity、java.lang.Class 、int、com.google.firebase.database.Query)メソッドを解決できません' –

+0

Can Build.gradleにFirebaseUIを組み込む方法を示しますか? –

答えて

0

私ActiveListAdapter.javaです。あなたのコンストラクタは以下のようになります。

public ActiveListAdapter(Activity activity, Class<ShoppingList> modelClass, int modelLayout, 
         Query ref) { 
    super(ref, modelClass, modelLayout, activity); 
    this.mActivity = activity; 
} 
0

私は同じ問題を抱えていたが、今いくつかの変更を行うことによって解決しました。 build.gradleファイルでバージョンを変更しました 1) 'com.firebaseui:firebase-ui:0.4.2' と をコンパイルします。2) 'com.google.firebase:firebase-auth:9.2.0'をコンパイルします。 (build.gradleの他のfirebaseバージョンも9.2.0に変更する必要があります) インポートコマンドを に変更しました。import com.firebase.ui.database.FirebaseListAdapter; 以前は でした。import com.firebase.ui.FirebaseListAdapter;

2

これは、最新のFirebase UIライブラリを使用しているために発生している可能性があります。これは、クライアントライブラリがまだ古くなっている間にFirebaseライブラリ9.2.1で動作するように更新されています。

'com.firebaseui:firebase-UI:0.4.3'

あなたは、最新のクライアントライブラリを使用し、それに応じてクエリを更新する必要があります。

は、以下のリンクを参照してください。ShoppingListsFragmentで https://firebase.google.com/support/guides/firebase-android

、私のクエリが古いfirebaseクライアントライブラリに基づいており、同様の問題を作成しました。それらを更新した後、すべてが機能し始めました!

'firefox-client-android:2.5.2'

関連する問題