-3

Hi i want to get context from ocrgraphic.java file which is a helper.

How can I do?

1st activity

public final class OcrCaptureActivity extends AppCompatActivity {

2nd java

public class OcrGraphic extends GraphicOverlay.Graphic {

I need to have application context in 2nd java file

novohed
  • 9
  • 2

2 Answers2

1
public class OcrGraphic extends GraphicOverlay.Graphic {
    private Context mContext;

    public OcrGraphic(Context context) {
        mContext = context;
    }
}

Somewhere in OcrCaptureActivity:

...

OcrGraphic mOcrGraphic = new OcrGraphic(this);

...

Hope this helps.

e.rikov
  • 46
  • 3
0

Pass Context in OcrGraphic Constructor.

kostyabakay
  • 1,649
  • 2
  • 21
  • 32