Reputation: 25
This is my code:
protected void loadvide(Chan channel) {
Rtmpdump dump = new Rtmpdump();
dump.parseString(channel.getUrl());
startActivity(new Intent(this,VideoViewDemo.class));
}
The code works, but I have a problem.
The problem is, when I execute the aplication, first execute this part to my code:
Rtmpdump dump = new Rtmpdump();
dump.parseString(channel.getUrl());
and the second part: startActivity(new Intent(this,VideoViewDemo.class));
not work, because the second part begin work when finish the first part.
But I would like that when I start the application, the first and second parts of the code are executed simultaneously.
Upvotes: 0
Views: 103
Reputation: 3878
You can use Async Task for this
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));
}
}
Check this link as per android.developer = > http://developer.android.com/reference/android/os/AsyncTask.html
Check this for few tutorial = > http://www.vogella.com/articles/AndroidBackgroundProcessing/article.html
Upvotes: 1