ste*_*e 1 1 java android ioexception
我java.io.IOException在编译时遇到了未处理的异常.我已经发布了下面的代码,并指出了错误行.我搜索了许多关于这个问题的帖子,但我没有得到任何相关的解决方案.
MainActivity.java:
public class MainActivity extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
...................
}
public void startRecording() throws IOException {
..................
}
player.setOnCompletionListener(new OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
if (RecordFile != null && ifexist.equals("true")) {
}
else {
if (isRecclicked == true) {
recordButtonPressed = true;
try {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
// this code will be executed after 2 seconds
startRecording(); ----> Unhandled Exception java.io.iOException
}
}, 2000);
}
catch (IOException e) {
e.printStackTrace();
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
try {
startRecording();
}catch(IOException ex) {
//Do something with the exception
}
Run Code Online (Sandbox Code Playgroud)