I don't know what c is
gridServ.setAdapter(new ImageAdapter(c)); // is c activity context
or
gridServ.setAdapter(new ImageAdapter(getActivity()));
getActivity()
public final Activity getActivity ()
Added in API level 11
Return the Activity this fragment is currently associated with.
Then you have
public ImageAdapter(Context c) {
mContext = c;
// you get the activity context here
// you can use the same
}
Pass the activity context to the constructor of asynctask.
new LoadJSON(mContext).execute(url,title);
// using mContext initialized in ImageAdapter
Then in the asynctask constructor
Context mContext;
public LoadJSON(Context context)
{
mContext = context; // get activity context
}
Also
@Override
protected void onPreExecute() {
super.onPreExecute();
Then
@Override
protected void onPostExecute(String titulo) {
super.onPostExecute(titulo);
Also use mContex
t to startActivity
Intent i = new Intent(mContext, PantallaInfo.class);
mContext.startActivity(i);
startActivity
is a method of Activity class. Requires Activity context.