这是我的密码:
protected void loadvide(Chan channel) {
Rtmpdump dump = new Rtmpdump();
dump.parseString(channel.getUrl());
startActivity(new Intent(this,VideoViewDemo.class));
}密码有效,但我有个问题。
问题是,当我执行乘法时,首先在我的代码中执行这个部分:
Rtmpdump dump = new Rtmpdump();
dump.parseString(channel.getUrl());第二部分:startActivity(new Intent(this,VideoViewDemo.class));不起作用,因为第二部分在完成第一部分后才开始工作。
但我希望在启动应用程序时,代码的第一部分和第二部分同时执行。
发布于 2013-08-29 10:48:03
您可以为此使用异步任务。
private class MyAsyncClass extends AsyncTask<URL, Integer, Long> {
protected Long doInBackground(URL... urls) {
//Do your task here
Rtmpdump dump = new Rtmpdump();
dump.parseString(channel.getUrl());
}
protected void onProgressUpdate(Integer... progress) {
setProgressPercent(progress[0]);
}
protected void onPostExecute(Long result) {
startActivity(new Intent(this,VideoViewDemo.class));
}
}按android.developer => http://developer.android.com/reference/android/os/AsyncTask.html检查此链接
请检查以下几个教程=> http://www.vogella.com/articles/AndroidBackgroundProcessing/article.html
https://stackoverflow.com/questions/18508545
复制相似问题