Android : Undefined Constructor in android

on Thursday, December 4, 2014


I'm making an app that deals with a fragment and I keep getting an undefined error for a constructor.


`



public class ClientFragment extends Fragment {
private static final ClientFragment This = null;
final ClientFragment context = This;
private static String TAG = "This thing here";
private static final String DIALOG_IMAGE = "image";
private static final int REQUEST_PHOTO = 1;
static final String EXTRA_MEM_ID = "com.example.project2.memID";

private Scrap mScraps;
Uri imageFileUri;



public static ClientFragment newInstance(UUID memID) {
Bundle args = new Bundle();
args.putSerializable(EXTRA_MEM_ID, memID);
ClientFragment fragment = new ClientFragment();
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//this snags the UUID sent from MainActivity and tosses it to BookMarks
UUID memId = (UUID)getArguments().getSerializable(EXTRA_MEM_ID);
mScraps = BookMarks.get(getActivity()).getScraps(memId);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_scraps, parent, false);





final ListView mListView= (ListView)v.findViewById(R.id.listview);
ScrapAdapter adapter = new ScrapAdapter(mScraps);

mListView.setAdapter(adapter); //setListAdapter sets the adapter to a specific listview

return v;
}


private static final int TAKE_PICTURE_REQUEST = 0;


private class ScrapAdapter extends ArrayAdapter<Scrap> {
public ScrapAdapter(ArrayList<Scrap> scraps) {
super(getActivity(), 0, scraps);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// If we weren't given a view, inflate one
if (convertView == null) {
convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_memory, null);
}
// Configure the view
Scrap c = getItem(position);
//shows title
TextView titleTextView =(TextView)convertView.findViewById(R.id.list_item_titleTextView);
titleTextView.setText(c.getTitle());
//shows date memory was made
TextView dateTextView =(TextView)convertView.findViewById(R.id.list_item_dateTextView);
dateTextView.setText(c.getDate().toString());
return convertView;
}
}}`


The error is coming from ScrapAdapter adapter = new ScrapAdapter(mScraps); specifically the new ScrapAdapter(mScraps);


The error I receive is "The constructor ClientFragment.ScrapAdapter(Scrap) is undefined"


0 comments:

Post a Comment