I am currently trying:
extends Activity implements MediaPlayer.OnCompletionListener
extends Activity implements View.OnClickListener
at the same time and its not working or rather im not sure how to implement it...how would I go about doing this?
edit: maybe it will help if I show you guys what I have now and its not working:
package com.vamp6x6x6x.rusty;
import java.io.IOException;
import com.vamp6x6x6x.rusty.R;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
public class rustyactivity extends Activity implements MediaPlayer.OnCompletionListener, View.OnClickListener {
/** Called when the activity is first created. */
ImageView display;
int toPhone;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
display = (ImageView) findViewById(R.id.IVDisplay);
ImageView image1 = (ImageView) findViewById(R.id.IVimage1);
ImageView image2 = (ImageView) findViewById(R.id.IVimage2);
ImageView image3 = (ImageView) findViewById(R.id.IVimage3);
ImageView image4 = (ImageView) findViewById(R.id.IVimage4);
ImageView image5 = (ImageView) findViewById(R.id.IVimage5);
Button setWall = (Button) findViewById(R.id.bSetWallpaper);
toPhone = R.drawable.guy1;
image1.setOnClickListener(this);
image2.setOnClickListener(this);
image3.setOnClickListener(this);
image4.setOnClickListener(this);
image5.setOnClickListener(this);
setWall.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.IVimage1:
display.setImageResource(R.drawable.guy1);
toPhone = R.drawable.guy1;
break;
case R.id.IVimage2:
display.setImageResource(R.drawable.guy2);
toPhone = R.drawable.guy2;
break;
case R.id.IVimage3:
display.setImageResource(R.drawable.guy3);
toPhone = R.drawable.guy3;
break;
case R.id.IVimage4:
display.setImageResource(R.drawable.guy4);
toPhone = R.drawable.guy4;
break;
case R.id.IVimage5:
display.setImageResource(R.drawable.guy5);
toPhone = R.drawable.guy5;
break;
case R.id.bSetWallpaper:
Bitmap whatever = BitmapFactory.decodeStream(getResources().openRawResource(toPhone));
try{
getApplicationContext().setWallpaper(whatever);
}catch(IOException e){
e.printStackTrace();
}
}
Button ending = (Button) findViewById(R.id.theme);
ending.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
playSound(R.raw.theme);
}
});
}
private void playSound(int resId) {
MediaPlayer mp = MediaPlayer.create(this, resId);
mp.setOnCompletionListener(this);
mp.start();
}
@Override
public void onCompletion(MediaPlayer mp) {
// TODO Auto-generated method stub
}
}