context vs views

This is a strange question. View describes one element of your ui. It can have onClickListeners, properties and so on. But every view is created in some context, usually Activity's context.

Context as itself is something like environment your code is executed in. It has access to ui(if it is an activity), it can contain some global data(application context), and has access to the resources(all of the contexts). Also, context allows you to perform common android operations like broadcasting intents, start activities and services.

So, views should be passed when you want to do something with a particular view. Context is passed when you need access to resources, global data or ui context, or launch other android components.

Tags:

Android