2016-11-16 69 views
0

錯誤,我得到錯誤這個錯誤「錯誤:錯誤:這個類應該提供一個默認的構造函數(公共構造不帶參數)(com.example.joekatibi.crime.CrimeAdapter)可實例] 「 我怎樣才能解決這個問題,我在這個新的,但是當我在調試模式下運行它運行沒有任何錯誤。請幫助當我建立我的Android項目Crimeapp

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

請在您的類中添加它

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

謝謝你,但它是在上面的類 –

相關問題