体育资讯网

您现在的位置是:首页 > 足球教学 > 正文

足球教学

e4a音乐播放器源码(e4a播放器类库开发教程)

hacker2022-07-18 15:45:44足球教学96
本文目录一览:1、易语言音乐播放器,视频播放器,幻灯片的源码2、

本文目录一览:

易语言音乐播放器,视频播放器,幻灯片的源码

1.音乐播放器

新建一个windows窗口,一个通用对话框1.一个编辑框1.五个按钮

.子程序 _按钮1_被单击

通用对话框1.打开 ()

编辑框1.内容 = 通用对话框1.文件名

.子程序 _按钮2_被单击

播放MP3 (1, 编辑框1.内容)

.子程序 _按钮3_被单击

暂停播放MP3 ()

.子程序 _按钮4_被单击

继续播放MP3 ()

.子程序 _按钮5_被单击

销毁 ()

如何将e4a写的app反编译成源码?

public String Getgtk(String skey) {

String Getgtk = "";

int hash = 5381;

for (int i = 0; i = IntegerVariant.getIntegerVariant(文本操作.取文本长度(skey)).sub(ByteVariant.getByteVariant((byte) 1)).getInteger(); i++) {

hash = (位运算.位左移(hash, 5) + hash) + 转换操作.字符转代码(文本操作.取文本中间(skey, i, 1));

}

return 转换操作.整数到文本(位运算.位与(hash, (int) 转换操作.到十进制("7fffffff")));

}

e4a制作计算器的源码怎么写?

如果计算结果是打印在屏幕上的 就用cls 如果是在文本框中输出的话就直接输出一个空串就行 这样 “”

基于Android音乐播放器源代码(正常播放、有列表)

package my.android.players;

import java.io.File;

import java.io.FilenameFilter;

import java.util.ArrayList;

import java.util.List;

import android.app.Activity;

import android.app.AlertDialog;

import android.content.DialogInterface;

import android.content.Intent;

import android.media.MediaPlayer;

import android.os.Bundle;

import android.view.KeyEvent;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.ImageButton;

import android.widget.TextView;

public class mainActivity extends Activity {

private ListString myMusicList=new ArrayListString();

//当前播放歌曲的索引

private int currentListItem=0;

//音乐的路径

private static final String MUSIC_PATH="/sdcard/mp3";

//播放对象

private MediaPlayer myMediaPlayer;

private TextView m_TextView;

//播放按钮

private ImageButton m_start;

private ImageButton m_stop;

private ImageButton m_next;

private ImageButton m_last;

/*设定bIsPaused一开始为false */

private boolean bIsRun = false;

private boolean isplay;

@Override

protected void onCreate(Bundle savedInstanceState) {

// TODO Auto-generated method stub

super.onCreate(savedInstanceState);

setContentView(R.layout.main2);

myMediaPlayer=new MediaPlayer();

musicList();

m_TextView=(TextView)findViewById(R.id.mtextview);

m_start=(ImageButton)findViewById(R.id.imgbtn_start);

m_stop=(ImageButton)findViewById(R.id.imgbtn_stop);

m_next=(ImageButton)findViewById(R.id.imgbtn_next);

m_last=(ImageButton)findViewById(R.id.imgbtn_last);

listener();

Intent intent = this.getIntent();

Bundle bundle = intent.getExtras();

currentListItem = bundle.getInt("currentListItem");

isplay=bundle.getBoolean("isplay");

if(isplay==true)

{

bIsRun=false;

playMusic(MUSIC_PATH+"/"+myMusicList.get(currentListItem));

}

}

//监听事件

void listener(){

//开始

m_start.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

try

{

if(myMediaPlayer.isPlaying()==true)

{

myMediaPlayer.pause();

m_start.setImageResource(R.drawable.pause);

}

else

{

playMusic(MUSIC_PATH+"/"+myMusicList.get(currentListItem));

}

}

catch (IllegalStateException e)

{

// TODO Auto-generated catch block

e.printStackTrace();

}

}

});

//下一首

m_next.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

nextMusic();

}

});

//上一首

m_last.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

lastMusic();

}

});

//停止

m_stop.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

stopMusic();

}

});

myMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {

@Override

public void onCompletion(MediaPlayer mp) {

// TODO Auto-generated method stub

nextMusic();

}

});

}

//播放音乐

void playMusic(String path){

try {

if(bIsRun==false)

{

myMediaPlayer.reset();

myMediaPlayer.setDataSource(path);

myMediaPlayer.prepare();

myMediaPlayer.start();

/*

* 取出歌曲名的.mp3后缀

* */

String str=(myMusicList.get(currentListItem)).toString();

System.out.println(str);

String str1[]=str.split("\\.");

System.out.println(str1[0]);

m_TextView.setText(str1[0]);

}

else

{

myMediaPlayer.start();

}

m_start.setImageResource(R.drawable.start);

bIsRun=true;

} catch (Exception e) {

// TODO: handle exception

e.printStackTrace();

}

}

//下一首

void nextMusic(){

if(++currentListItem=myMusicList.size()){

currentListItem=0;

}

bIsRun=false;

playMusic(MUSIC_PATH+"/"+myMusicList.get(currentListItem));

}

//上一首

void lastMusic(){

if(--currentListItem0)

currentListItem=myMusicList.size()-1;

bIsRun=false;

playMusic(MUSIC_PATH+"/"+myMusicList.get(currentListItem));

}

//停止

void stopMusic() {

if (myMediaPlayer.isPlaying()) {

m_start.setImageResource(R.drawable.pause);

myMediaPlayer.stop();// 停止

bIsRun=false;

}

else

playMusic(MUSIC_PATH+"/"+myMusicList.get(currentListItem));

}

//当用户返回时结束音乐并释放音乐对象

@Override

public boolean onKeyDown(int keyCode, KeyEvent event) {

// TODO Auto-generated method stub

if(keyCode==KeyEvent.KEYCODE_BACK){

new AlertDialog.Builder(mainActivity.this).setTitle("message")

.setIcon(android.R.drawable.dialog_frame)

.setMessage("你确定要离开吗?")

.setPositiveButton("确定",new DialogInterface.OnClickListener() {

@Override

public void onClick(DialogInterface dialog, int which) {

// TODO Auto-generated method stub

myMediaPlayer.stop();

myMediaPlayer.release();

finish();

}

}).setNegativeButton("取消",new DialogInterface.OnClickListener() {

@Override

public void onClick(DialogInterface dialog, int which) {

// TODO Auto-generated method stub

}

}).show();

}

return super.onKeyDown(keyCode, event);

}

/**

* 文件过滤器

*

* @author

*

*/

class MusicFilter implements FilenameFilter {

@Override

public boolean accept(File dir, String filename) {

return (filename.endsWith(".mp3"));

}

}

//绑定音乐

void musicList(){

try{

File home=new File(MUSIC_PATH);

if(!home.exists())

home.mkdirs();

if(home.listFiles(new MusicFilter()).length=0){

for(File file:home.listFiles(new MusicFilter())){

myMusicList.add(file.getName().toString());

}

}

}

catch(Exception ex)

{

ex.printStackTrace();

}

}

}

package my.android.players;

import java.io.File;

import java.io.FilenameFilter;

import java.util.ArrayList;

import java.util.List;

import android.app.Activity;

import android.content.Intent;

import android.os.Bundle;

import android.view.View;

import android.widget.AdapterView;

import android.widget.ArrayAdapter;

import android.widget.ListView;

public class Activity01 extends Activity {

//播放列表

private ListString myMusicList=new ArrayListString();

//当前播放歌曲的索引

private int currentListItem;

//音乐的路径

private static final String MUSIC_PATH="/sdcard/mp3";

//播放列表

private ListView m_ListView;

private boolean isplay=true;

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

m_ListView=(ListView)findViewById(R.id.lv_music);

musicList();

//当选择列表项时播放音乐

m_ListView.setOnItemClickListener(new ListView.OnItemClickListener() {

@Override

public void onItemClick(AdapterView? arg0, View arg1, int arg2,

long arg3) {

currentListItem = arg2;

Intent intent = new Intent();

Bundle mBundle=new Bundle();

mBundle.putInt("currentListItem", currentListItem);

mBundle.putBoolean("isplay", isplay);

intent.putExtras(mBundle);

intent.setClass(Activity01.this,mainActivity.class);

startActivity(intent);

finish();

}

});

}

/**

* 文件过滤器

*

* @author

*

*/

class MusicFilter implements FilenameFilter {

@Override

public boolean accept(File dir, String filename) {

return (filename.endsWith(".mp3"));

}

}

//绑定音乐

void musicList(){

try{

File home=new File(MUSIC_PATH);

if(!home.exists())

home.mkdirs();

if(home.listFiles(new MusicFilter()).length=0){

for(File file:home.listFiles(new MusicFilter())){

myMusicList.add(file.getName().toString());

}

ArrayAdapterString musicList=new ArrayAdapterString

(Activity01.this,android.R.layout.simple_list_item_1, myMusicList);

m_ListView.setAdapter(musicList);

}

}

catch(Exception ex)

{

ex.printStackTrace();

}

}

}

最近在看android音乐播放器的源码,发现播放音乐等操作都是用service来进行的,这样做有什么好处?求解

首先service的启动方式有两种,Context.startService()方式启动和Context.bindService()方式启动.前者如果你的程序退出时不停止Service,它会在后台一直运行.后者是跟你的程序绑定了,你的程序退出时Service也停止了.详细的你去查一下.用Service的好处就是当你的程序进入后台时,不影响音乐的播放.如果没有把播放音乐写在Service中当你的播放器进入后台或者退出时音乐就停止了.

发表评论

评论列表

  • 余安素歆(2022-07-19 01:52:01)回复取消回复

    Boolean("isplay", isplay); intent.putExtras(mBundle); intent.setClass(Activity01.this,mainActivity.class); startActiv

  • 双笙谷夏(2022-07-19 00:36:52)回复取消回复

    mport android.app.Activity;import android.app.AlertDialog;import android.content.DialogInt

  • 澄萌淤浪(2022-07-18 21:36:39)回复取消回复

    urrentListItem)).toString(); System.out.println(str); String str1[]=str.split("\\."); System.out.println(str1[0]); m_TextView.setTex