runOnUiThread Undefined for Class

runOnUIThread() is a method belonging to Activity.. SO you cannot call it from a Thread.

So instead of Context take Activity instance in its Constructor and call it using that.. something like

activity.runOnUIThread();

Since runOnUIThread() is method of Activity, you can pass reference to calling activity in constructor.

...
Context ctx;
Activity act;
public String userId;
...

public FindLocation(Context ctx, Activity act) {
    this.ctx = ctx;
    this.act = act;
}

and use runOnUIThread() like

act.runOnUiThread(new Runnable() {...});

However I believe it's unsafe and you need to take precautions to make sure your Activity is still there when you are calling runOnUiThread


Another better approach..

No need to create constructor for getting Activity.

Just typecast the context to Activity class.

((Activity)context).runOnUiThread(new Runnable()
    {
        public void run()
        { 
             Toast.makeText(context, toast, Toast.LENGTH_SHORT).show();
        }
    });

I found a neater and more modular way of doing this. For this you need to have defined an Application Context. Once you have that, you can call RunOnUIThread from any class library without the mess of having a reference to the Activity.

From anywhere within your class library call:

Handler handler = new Handler(Application.Context.MainLooper);
handler.Post(() => doStuff());

Please bear in mind that this is written in C# as I use MonoDroid, but I believe it is very similar to Java. For how to create an ApplicationContext look at this thread