android - No result with barcode scanner -


i'm new android apps. i'm trying create barcode scanner, result not appear in edittext.

also, in onactivityresult following error shown:

the method onactivityresult(int, int, intent) type new view.onclicklistener(){} never used locally

i have class intentintegrator , intentresult in project.

this part of code:

btnbar.setonclicklistener(new view.onclicklistener() {               @override    public void onclick(view v) {                   intent intent = new intent("com.google.zxing.client.android.scan");       startactivityforresult(intent, 0);                                }                   public void onactivityresult(int requestcode, int resultcode, intent data) {;              if (resultcode == activity.result_ok && requestcode == 0) {         bundle extras = data.getextras();         string result = extras.getstring("scan_result");                     edittext desc = (edittext) findviewbyid(r.produto.desc);         desc.settext(result);               }      desc.settext(resultcode);   }        //public void onactivityresult(int requestcode, int resultcode, intent intent) {   }  ); 

this xml code button:

    <edittext      android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:id="@+produto/desc"     android:enabled="false"     /> <requestfocus /> 

you need move onactivityresult method out activity rather inside setonclicklistener.

the hint getting ide (eclipse presume) telling onactivityresult never being used code base, because not in correct place picked activity when the:

intent intent = new intent("com.google.zxing.client.android.scan"); startactivityforresult(intent, 0);    

code path returns.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -