0
是否有任何可能的方式在延伸視圖的類中調用MediaPlayer?我需要在我的視圖中調用MediaPlayer
我已經讓我的Activity類成功地運作了mediaplayer。
如果這是不可能的,有沒有一種方法可以調用方法,從我的View類開始在我的Activity類中傳輸音頻流?
Android。
public class RealPlayView extends View {
// call objects
private Background background;
private Grid grid;
private Box[] box = new Box[30];
private Paint[] paint = new Paint[30];
private UpdateHandler updatehandler;
private Handler invalidatehandler;
private ColorFilter filter;
// sound variables
private RealPlayActivity realplayactivity;
// variables
public int lineNum = 0;
public int boxValue = 3;
public int gameSpeed = 250;
public int controlMove = 1;
public int controlSet = 1;
public boolean goRight;
// other variables regarding plain function
public int setX1 = 100;
public int setX2 = 100;
public int setX3 = 100;
public int endGame = 0;
// variables regarding to checker
public int X1;
public int X2;
public int X3;
public int X4;
public int X5;
public int X6;
public int X4D;
public int X5D;
public int X6D;
public RealPlayView(Context context) {
super(context);
// call objects
background = new Background(context, R.drawable.background);
grid = new Grid(context, R.drawable.grid);
updatehandler = new UpdateHandler();
invalidatehandler = new Handler();
filter = new PorterDuffColorFilter(0xffffcc33, PorterDuff.Mode.SRC_ATOP);
}
你可以把視圖類代碼化妝基礎? – 2011-12-17 10:48:14