-1

In EditWorkDetails.java (extend to fragment), it has two different layout, which are footer and footer layout .

Error

Error:(60, 47) error: cannot find symbol method getLayoutInflater()

EditWorkDetails.java

 public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            View edit_details = inflater.inflate(R.layout.edit_work_details, container, false);
            dbHelper = new MyDatabaseHelper(getActivity());
            sqlcon = new WorkDetailsAPI(getContext());
            listViewUpdate = (ListView) edit_details.findViewById(R.id.listViewEdit);
            addClaims=(Button) edit_details.findViewById(R.id.buttonClaims);
            footer = (AbsoluteLayout) edit_details.getLayoutInflater().inflate(R.layout.total_hours, null);
            totalHours = (TextView) footer.findViewById(R.id.textView10);
            footerLayout = (FrameLayout) edit_details.getLayoutInflater().inflate(R.layout.under_list_view_button, null);
            btnSubmit = (Button) footerLayout.findViewById(R.id.btnSave);
            btnAddClaims = (Button) footerLayout.findViewById(R.id.addClaims);
            objMyCustomBaseAdapter = new MyCustomBaseAdapter(getActivity(), results, listViewUpdate, footerLayout, footer);
            Bundle bundle = this.getArguments();
            if(getArguments()!=null)
            {
                ID=bundle.getLong("ID");
            }
            Toast.makeText(getActivity(),ID+"",Toast.LENGTH_LONG).show();
            BuildEditDetails(ID);

totalHours.xml

    <?xml version="1.0" encoding="utf-8"?>
    <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >


        <TextView
            android:layout_width="175dp"
            android:layout_height="33dp"
            android:textColor="@color/indian_red"
            android:textStyle="bold"
            android:textSize="18sp"
            android:id="@+id/textView10"
            android:layout_x="174dp"
            android:layout_y="16dp" />
    </AbsoluteLayout>

under_list_view_button.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <Button
        android:layout_width="181dp"
        android:layout_height="wrap_content"
        android:id="@+id/addClaims"
        android:layout_marginLeft="15px"
        android:drawableRight="@mipmap/claims"
        android:text="Add Claims"/>

    <Button
        android:layout_width="130dp"
        android:layout_height="wrap_content"
        android:id="@+id/btnSave"
        android:drawableRight="@mipmap/submit"
        android:layout_marginLeft="450px"
        android:text="Submit" />


</FrameLayout>

How do I fix this ? Thanks

Tony
  • 2,515
  • 14
  • 38
  • 71
  • 1
    footerLayout = (FrameLayout)edit_details.getLayoutInflater().inflate(R.layout.under_list_view_button, null); in that line you try to find the footer layout in edit_details.
    getLayoutInflater() is a method of activity.edit_details is an viewgroup so it is not able to find cannot find symbol method getLayoutInflater() in edit_details and gives (cannot find symbol method getLayoutInflater()) error try as people suggest in answer.
    – santoXme Dec 07 '15 at 07:33
  • I know the question sounds easy for you, but no need vote to close my question ! – Tony Dec 07 '15 at 07:37
  • @santoXme thanks for the information :) – Tony Dec 07 '15 at 07:38

1 Answers1

2

try to do

footerLayout = (FrameLayout) getActivity().getLayoutInflater().inflate(R.layout.under_list_view_button, null);
M D
  • 47,665
  • 9
  • 93
  • 114