[Solved] calling a method from an onClick listener [duplicate]

Use this code: @Override public void onClick(View view) { // TODO Auto-generated method stub //public void work (View view){ Intent intent = new Intent(PDFtester.this, copyAsset.class); startActivity(intent);} } Note :- Interfaces like OnClickListener,OnTouchListener etc don’t use this for getting Context try to use YourActivity.this or getApplicationContext() 2 solved calling a method from an onClick listener [duplicate]

[Solved] Implement inner-class-like reference behaviour? [closed]

In Java we can have (non-static) inner-classes, which seem to “behave” like having a strong-reference to their container-class and/or owner-class, but without causing memory-leak. I mean, I observed that even if both owner-class and inner-class keep strong-reference to each other, the classes are garbage-collected anyway (once no external class references them, although having reference-recursion). Yes, … Read more