public synchronized void startSong(String filename) { if (thread != null) stopSong(); this.filename = filename; if (this.filename.toLowerCase().endsWith(".s98")) { if (MS98NativeInterface.ms98OpenFile(filename) != 1) { Log.e(TAG, "Cannot open " + filename + " for playing"); stopSelf(); return; } audioStreamer = audioStreamerS98; } else { if (PMDWinNativeInterface.pmdwinOpenFile(filename) != 1) { Log.e(TAG, "Cannot open " + filename + " for playing"); stopSelf(); return; } audioStreamer = audioStreamerPMDWin; } terminate = false; track.play(); track.write(empty, 0, empty.length); thread = new Thread(audioStreamer); thread.start(); Notification nf = new Notification(R.drawable.ic_launcher, title, System.currentTimeMillis()); nf.flags |= Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR; Intent notificationIntent = new Intent(this, SelectSong.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); nf.setLatestEventInfo(getApplicationContext(), title, title2, contentIntent); // nm.notify(NID_PMD_PLAYING, nf); startForeground(NID_PMD_PLAYING, nf); }