我可以在调试应用程序时知道错误是什么吗?下面是我的编码,tessdata保存在我的手机里面。
public class testingtesting extends Activity {
private static final String data_path = "/mnt/sdcard/tessdata";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.image);
ImageView a = (ImageView) findViewById (R.id.testingtesingt);
Bitmap aa = grayScale.bitmap_in_binarize;
// a.setImageBitmap(aa);
TessBaseAPI baseApi = new TessBaseAPI();
baseApi.setDebug(true);
System.out.println("GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG");
//error
// File myDir = getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
baseApi.init(data_path, "eng");
//error
baseApi.setImage(aa);
System.out.println("adwdwawdada");
String recognizedText = baseApi.getUTF8Text();
baseApi.end();
System.out.println("cimcaoioievfoaemmov");
Intent intent = new Intent(testingtesting.this, result.class);
intent.putExtra("title_input", recognizedText);
startActivity(intent);
}
答案 0 :(得分:1)
请提供错误消息。
从我收集到的内容来看,您遇到了System.out.println("GGGGGGGGGGGGGGGGGGGG");
Android不使用标准Java控制台。相反,像这样使用Logcat:
Log.d("testingtesting", "GGGGGGGGGGGGGGGGG");
如果您正在使用Eclipse,请在启动时打开LogCat视图以查看应用的输出:
窗口→显示视图→其他→Android→LogCat
有关LogCat here
的更多信息