java - Accessing 'this' in anonymous methods -


I am trying to do a simple global exception handler in your Android app and I am having troubles:

<> public class extends TicTacToe activity {/ ** when activity is created first. * / @ Override Crate on Public Zero (Bundle Saved Instantstate) {Super. Contents (Saved Instantstate); . Thread.currentThread () setUncaughtExceptionHandler (New UncaughtExceptionHandler () {@Override pre-qualified public void uncaughtException (yarn, throwing) {Toast.makeText (it, "toast", Toast.LENGTH_LONG);}}); SetContentView (R.layout.main); }}

I'm a rather new one with both Android and Java but that will work in .NET. Can I access the local variables of unknown methods in Java? If so, how should I rewrite it?

Thanks, Vitaly

You can, but not in the way This UncaughtExceptionHandler object

Replace > TicTacToe.this is known

Also, you must have a compile-time error. It's not like this?


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -