Quantcast
Viewing all articles
Browse latest Browse all 941

Context, this, and Activity ... P3

A few recent posts about P3 issues have the following lines of code (from akenaton) as solution to obtaining context/activity info etc, but they are giving me an error.

The error I am getting is saying that "the function getActivity() does not exist"

import android.content.Context; import android.app.Activity;

Context context;
Activity act;

void setup() {
  act = this.getActivity();
  context = act.getApplicationContext();
}

void draw() {
}

I could have stayed in one of the current discussions but as this goes across a few I hope another discussion thread is OK!?


Viewing all articles
Browse latest Browse all 941

Trending Articles