Note that there are some explanatory texts on larger screens.

plurals
  1. POcalling a method from an onClick listener
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2858604/accessing-the-containing-class-of-an-inner-class-in-java">Accessing the containing class of an inner class in Java</a> </p> </blockquote> <p>I know this has certainly been answered before, but I have been working on this for two straight nights and I either don't understand or I have messed something up badly. I am trying to call a method with a button. My method is only going to copy and paste so it's not opening another activity.</p> <pre><code>package com.example.copypastetest; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class PDFtester extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pdftester); Button b1 = (Button) findViewById(R.id.button2); b1.setOnClickListener(new OnClickListener(){; @Override public void onClick(View arg0) { // TODO Auto-generated method stub //public void work (View view){ this is my issue??--&gt;Intent intent = new Intent(this, copyAsset.class); startActivity(intent);} } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_pdftester, menu); return true;} }; </code></pre> <p>thank you for looking, I admit I am a total hack. The only reason I made it this far is this website, first question, im sure of many but hopefully someone can help. I am not trying to be a vampire but I really am looking for the correct answer here if there is a page i can read to understand what i did wrong i am all ears.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload