Basic Examples

suggest change

Standard usage in Activity:

Context context = getApplicationContext();

Standard usage in Fragment:

Context context = getActivity().getApplicationContext();

this (when in a class that extends from Context, such as the Application, Activity, Service and IntentService classes)

TextView textView = new TextView(this);

another this example:

Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents