Q:

Fragmente and Context

I have this code into one Fragment but where ask for Context in the Fragment it does not work:
SimpleCursorAdapter ad1 = new SimpleCursorAdapter(**What i put here**, R.layout.spinner, cursor, from, to); 

if this code were into Activity it would be:
SimpleCursorAdapter(**This**, R.layout.spinner, cursor, from, to); 

Please help me. 

A:

You should use getActivity() to access the fragment's activity context:
SimpleCursorAdapter ad1 = new SimpleCursorAdapter(getActivity(), R.layout.spinner, cursor, from, to);

I hope this helps.

