0

I am new to android. I am getting the error as android.view.InflateException: Binary XML file line #6: Error inflating class . Earlier this activity was running fine. But suddenly getting this error. Cleaned the project so many times. But didn't work.

Xml layout is:

<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".FragDownloadSites" >

    <ExpandableListView
        android:id="@+id/lvDownloadSite"
        android:layout_width="fill_parent"
        android:layout_height="610dp"
        android:layout_x="0dp"
        android:layout_y="70dp" >
    </ExpandableListView>

    <TextView
        android:id="@+id/tvDownloadSiteMessage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="30dp"
        android:layout_y="21dp"
        android:text="Downloaded Sites"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <ImageButton
        android:id="@+id/btnDownloadSite"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="540dp"
        android:layout_y="10dp"
        android:src="@drawable/refresh" />

</AbsoluteLayout>

And code is:

package com.example.config;

import android.support.v4.app.Fragment;


public class FragDownloadSites extends Fragment implements SiteDataInterface {
    View rootView;
    ExpandableListView expListView;
    TextView tvMsg;
    ProgressDialog progress;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        rootView = inflater.inflate(R.layout.frag_download_sites, container, false);

        progress = new ProgressDialog(rootView.getContext());
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.setCancelable(false);
        progress.setMessage("Loading...");

        tvMsg=(TextView)rootView.findViewById(R.id.tvDownloadSiteMessage);

        // get the listview
        expListView = (ExpandableListView)rootView.findViewById(R.id.lvDownloadSite);
        DisplaySiteData();

        return rootView;
    }

Thanks in advance.

Avijit
  • 3,834
  • 4
  • 33
  • 45

1 Answers1

0

This class was deprecated in API level 3. Use FrameLayout, RelativeLayout or a custom layout instead.

also Absolute layouts are less flexible and harder to maintain than other types of layouts and absolute positioning is not too much useful in world of various screen resolutions and aspect ratios.

so you please use other layout. may this answer help u...

thanks

Dhaval Jivani
  • 9,467
  • 2
  • 48
  • 42