core.jar 만들어서 라이브러리에 추가했습니다.
허나 뭐가문제인지 스캔버튼을 클릭하면 unfortunately stopped 메시지가 뜨는군요..
바코드 스캐너가 설치된 상태에서 com.google.zxing path를 써야 실행이 된다고하는데,
설치하지않은 상태에서 작동하게하려면 어떻게해야하나요?
package com.example.whalestudio;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class page1 extends Activity {
TextView tvStatus;
TextView tvResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.page1);
tvStatus = (TextView) findViewById(R.id.tvStatus);
tvResult = (TextView) findViewById(R.id.tvResult);
Button scanBtn = (Button) findViewById(R.id.btnScan);
Button bt1 = (Button) findViewById(R.id.button1);
Button bt2 = (Button) findViewById(R.id.button2);
bt1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent in = new Intent(page1.this,page2.class);
startActivity(in);
}
});
bt2.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent in2 = new Intent(page1.this,qna.class);
startActivity(in2);
}}
);
scanBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
try {
Intent intent = new Intent("com.example.Whalestudio.zxing.client.android.SCAN");
startActivityForResult(intent, 0);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Toast.makeText(getApplicationContext(), "ERROR:" + e, 1).show();
}
}
});
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
tvStatus.setText(intent.getStringExtra("SCAN_RESULT_FORMAT"));
tvResult.setText(intent.getStringExtra("SCAN_RESULT"));
} else if (resultCode == RESULT_CANCELED) {
tvStatus.setText("Press a button to start a scan.");
tvResult.setText("Scan cancelled.");
}
}
}
}