我构建我的Android项目Crimeapp时出错

时间:2016-11-16 09:02:00

标签: android

我收到错误此错误“错误:错误:此类应提供默认构造函数(不带参数的公共构造函数)(com.example.joekatibi.crime.CrimeAdapter)[Instantiatable]” 我怎么能解决这个问题,这是新的,但是当我在调试模式下运行它运行没有任何错误。请帮忙

package com.example.joekatibi.crime;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.List;

public class CrimeAdapter extends ArrayAdapter<DataCrime> {

    private LayoutInflater mInflater;
    private int mResource;

    public CrimeAdapter(Context context, int resource, List<DataCrime> dataCrimes )
    {
        super( context, resource, dataCrimes );
       

        mResource = resource;
        mInflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent )
    {
        View view = convertView == null ? mInflater.inflate( mResource, parent, false ) : convertView;

        TextView FullName = (TextView) view.findViewById( R.id.Full_Name );
        TextView IdNumber = (TextView) view.findViewById( R.id.id_number );
        TextView Phone = (TextView) view.findViewById( R.id.mobile_number );
        TextView ResidenceHome = (TextView) view.findViewById( R.id.Residence );
        TextView DateTimeCrime = (TextView) view.findViewById( R.id.Date_crime );
        TextView CrimeScene = (TextView) view.findViewById( R.id.Crime_Scene );
        TextView CrimeDetail = (TextView) view.findViewById( R.id.Crime_Details );


        DataCrime item = getItem( position );
        FullName.setText( item.getFullName() );
        IdNumber.setText( item.getIdNumber() );
        Phone.setText( item.getPhone());
        ResidenceHome.setText( item.getResidence() );
        DateTimeCrime.setText(item.getDateCrime());
        CrimeScene.setText( item.getCrimeScene()) ;
        CrimeDetail.setText( item.getCrimeDetails()) ;

        return view;
    }



}

1 个答案:

答案 0 :(得分:1)

请在课堂上添加

public CrimeAdapter() {
    // don't do anything here
}