我坚持在 Udacity Firebase 课程中实施 FireBase UI ListAdapter。整个事情发生了很大变化,现在 ActiveListAdapter.java 抛出错误:
无法解析方法“超级(andoid.app.Activity,java.lang.Class,int,com.google.firebase.database.Query)”
有没有人遇到过这个问题?你知道如何解决吗?
这是我的 ActiveListAdapter.java
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());
}
}