2015年6月24日水曜日

[streaming] Онлайн Радиод зориулсан аудио стрийминг / Audio streaming for online radio

Permission uguh
<uses-permission android:name="android.permission.INTERNET" />


mediaPlayer = new MediaPlayer();

String streamUrl = "http://153.127.247.79:30001/listen.mp3";

mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

try {
    mediaPlayer.setDataSource(streamUrl);
} catch (IllegalArgumentException e) {
    Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (SecurityException e) {
    Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (IllegalStateException e) {
    Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (IOException e) {
    e.printStackTrace();
}

try {
    mediaPlayer.prepare();
} catch (IllegalStateException e) {
    Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
} catch (IOException e) {
    Toast.makeText(getApplicationContext(), "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
}

mediaPlayer.start();

2015年3月8日日曜日

[Async] холбоотой хэрэгтэй холбоосууд


1. Groundy lib болоод бусад
http://stackoverflow.com/questions/3028306/download-a-file-with-android-and-showing-the-progress-in-a-progressdialog

2. Прогрэссийг тэмплэйт
http://android.keicode.com/basics/async-asynctask.php

3. Yapon hel deerhi Android Wiki
http://wikiwiki.jp/android/?AsyncTask%A4%C7%A5%D0%A5%C3%A5%AF%A5%B0%A5%E9%A5%A6%A5%F3%A5%C9%BD%E8%CD%FD%A4%F2%B9%D4%A4%A6