you will need to pass Activity Context to Non Activity class by using constructor or by changing method to parametrized method as :
public class PaintView extends View
{
Context context_new;
public PaintView(Context context){
this.context_new=context;
}
//.. your code here
public void shareImage(Context context)
{
context.startActivity(Intent.createChooser(share, "Share drawing"));
//OR
//context_new.startActivity(Intent.createChooser(share, "Share drawing"));
Toast.makeText(context,
"Please save the image first...",
Toast.LENGTH_LONG).show();
//OR
// Toast.makeText(context_new,
// "Please save the image first...",
//Toast.LENGTH_LONG).show();
}
}
and call shareImage method from Activity as :
PaintView paintview=new PaintView(Your_Current_Activity.this);
paintview.shareImage(Your_Current_Activity.this);