Why don't you just use a singleton?
import android.content.Context;
public class ClassicSingleton {
private Context c=null;
private static ClassicSingleton instance = null;
protected ClassicSingleton()
{
// Exists only to defeat instantiation.
}
public void setContext(Context ctx)
{
c=ctx;
}
public Context getContext()
{
return c;
}
public static ClassicSingleton getInstance()
{
if(instance == null) {
instance = new ClassicSingleton();
}
return instance;
}
}
Then in the activity class:
private ClassicSingleton cs = ClassicSingleton.getInstance();
And in the non activity class:
ClassicSingleton cs= ClassicSingleton.getInstance();
Context c=cs.getContext();
ImageView imageView = (ImageView) ((Activity)c).findViewById(R.id.imageView1);