I am creating an image sharing app which uses a button to share images. I'm getting an unable to resolve the required method error
in the code below:
public class ShareActivity extends Activity implements View.OnClickListener {
Button button1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_share);
button1 = (Button)findViewById(R.id.button1);
button1.setOnClickListener(this);
}
private void button1Click()
{
BitmapDrawable bm = (BitmapDrawable) getDrawable(button1);
Bitmap mysharebmp = bm.getBitmap();
String path = Images.Media.insertImage(getContentResolver(),
mysharebmp, "MyImage", null);
On this line:
BitmapDrawable bm = (BitmapDrawable) getDrawable(button1);ShareActivity
I am getting The method getDrawable(Button) is undefined for the type ShareActivity
. Why might I be getting this error? The full code is here.