do not use this
keyword,best practice is to create Context variable and initialize it in onCreate
method,and use every where in your activity.
Context context;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.layoutname);
context=this;
}
now use it like this:
this.runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(context, "Authenticated.", Toast.LENGTH_SHORT).show();
}
}
);
in your case,this refers to the runnable class not the Context. so you can use context
for toast