1

I have a problem and do not know how to solve it. I want to give her fab button behavior so I want to use the method AttachToListView. I get an error in the project "Cannot resolve method AttachToListView". How can I fix this? I am hope for your help.

public class FragmentListView extends Fragment {
private CreateView cView;
private DatabaseHelper dbHelper;
private BaseManager bAdapter;
private SQLiteDatabase database;
ListView lv;
SwipeRefreshLayout srl;
String TAG = "FragmentListView";
Boolean flag_contextmenu = false;
int item_click;
ActionMode mmode;

public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_listview, null);
    String title = getActivity().getResources().getStringArray(R.array.arr_widgets)[4];
    ActivityMain.getInstance().getSupportActionBar().setTitle(title);
    ActivityMain.getInstance().mDrawerToggle.setDrawerIndicatorEnabled(false);
    setHasOptionsMenu(true);

    dbHelper = new DatabaseHelper(getActivity());
    database = dbHelper.getWritableDatabase();
    bAdapter = new BaseManager(getActivity(), database);
    cView = new CreateView(getActivity(), bAdapter);
    lv = (ListView) v.findViewById(R.id.lv_fragmentlistview);
    srl = (SwipeRefreshLayout) v.findViewById(R.id.srl_fragmentlistview);
    CreateListView();
    ListviewClickListener();
    SwipeRefreshListener();
    FloatingActionButton fab = (FloatingActionButton)  v.findViewById(R.id.fab_fragmentlistview);
    fab.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
        }
    });

    if(savedInstanceState != null)
    {
        flag_contextmenu = savedInstanceState.getBoolean("flag_contextmenu");
        if (flag_contextmenu =        = true)
    {
        StartContextMenu();
    }
}
fab.AttachToListView(lv);
return v;

}

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
style="@style/AppTheme.window">
<android.support.design.widget.CoordinatorLayout
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/srl_fragmentlistview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:color="?attr/coloraccent"
    style="@style/AppTheme.window">
    <ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/lv_fragmentlistview"
        android:layout_gravity="right"
        android:headerDividersEnabled="false">
    </ListView>
</android.support.v4.widget.SwipeRefreshLayout>

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab_fragmentlistview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:layout_margin="16dp"
    android:clickable="true"
    android:src="@drawable/fab_add"
    app:layout_anchor="@id/lv_fragmentlistview"
    app:layout_anchorGravity="bottom|right|end"
    app:layout_behavior="com.softinlife.templatestyles.Views.FAB.FABBehavior">
</android.support.design.widget.FloatingActionButton>
</android.support.design.widget.CoordinatorLayout>

1 Answers1

0

Is attachToListView and not AttachToListView.

Darci Neto
  • 36
  • 3