我已经尝试过将语音转换为文本的代码,现在我希望这个转换后的文本可以作为短信发送请给我帮助我使用病毒花瓣的代码进行语音转换 并使用API
使用语音文本答案 0 :(得分:1)
public void readExcelData(Context context,String filename){
try {
File file = new File(context.getExternalFilesDir(null), filename);
FileInputStream myInput = new FileInputStream(file);
Vector cellVe
torHolder = new Vector();
/** Create a POIFSFileSystem object**/
POIFSFileSystem myFileSystem = new
POIFSFileSystem(myInput);
/** Create a workbook using the File System**/
HSSFWorkbook myWorkBook = new
HSSFWorkbook(myFileSystem);
/** Get the first sheet from workbook**/
HSSFSheet mySheet = myWorkBook.getSheetAt(0);
/** We now need something to
iterate through the cells.**/
Iterator rowIter = mySheet.rowIterator();
while(rowIter.hasNext())
{
HSSFRow myRow = (HSSFRow) rowIter.next();
Iterator cellIter = myRow.cellIterator();
Vector cellStoreVector=new Vector();
while(cellIter.hasNext()){
HSSFCell myCell = (HSSFCell) cellIter.next();
cellStoreVector.addElement(myCell);
}
cellVectorHolder.addElement(cellStoreVector);
}
excelTableLayout.removeAllViews();
android.widget.TableRow.LayoutParams params = new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f);
for(int i=0;i<cellVectorHolder.size();i++){
System.out.println("Nama: "+cellVectorHolder.elementAt(i));
String values = cellVectorHolder.elementAt(i)+"";
String valuesArr[] = values.split(",");
String first = valuesArr[0];
String sec = valuesArr[1];
System.out.println("\n");
TableRow row = new TableRow(ctx);
TextView firstValues = new TextView(ctx);
firstValues.setTypeface(Typeface.SERIF);
firstValues.setTextColor(Color.BLACK);
firstValues.setText(valuesArr[0].substring(1));
firstValues.setTextSize(17);
firstValues.setBackgroundResource(R.drawable.excelformatbackground);
firstValues.setPadding(6, 6, 6, 6);
firstValues.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0.1f));
firstValues.setLayoutParams(params);
TextView secondValues = new TextView(ctx);
secondValues.setTypeface(Typeface.SERIF);
secondValues.setTextColor(Color.BLACK);
secondValues.setText(valuesArr[1]);
secondValues.setTextSize(17);
secondValues.setBackgroundResource(R.drawable.excelformatbackground);
secondValues.setPadding(6, 6, 6, 6);
secondValues.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0.1f));
secondValues.setLayoutParams(params);
TextView thirdValues = new TextView(ctx);
thirdValues.setTypeface(Typeface.SERIF);
thirdValues.setTextColor(Color.BLACK);
thirdValues.setText(valuesArr[2]);
thirdValues.setTextSize(17);
thirdValues.setBackgroundResource(R.drawable.excelformatbackground);
thirdValues.setPadding(6, 6, 6, 6);
thirdValues.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0.1f));
thirdValues.setLayoutParams(params);
TextView fourthValues = new TextView(ctx);
fourthValues.setTypeface(Typeface.SERIF);
fourthValues.setTextColor(Color.BLACK);
fourthValues.setText(valuesArr[3].substring(0,valuesArr[3].length() - 1));
fourthValues.setTextSize(17);
fourthValues.setBackgroundResource(R.drawable.excelformatbackground);
fourthValues.setPadding(6, 6, 6, 6);
fourthValues.setLayoutParams(params);
row.addView(firstValues);
row.addView(secondValues);
row.addView(thirdValues);
row.addView(fourthValues);
excelTableLayout.addView(row,new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
}
System.out.println("Data is "+cellVectorHolder);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}