我目前正在尝试:
extends Activity implements MediaPlayer.OnCompletionListener
extends Activity implements View.OnClickListener
Run Code Online (Sandbox Code Playgroud)
同时它不工作或者我不确定如何实现它......我将如何做到这一点?
编辑:如果我向你们展示我现在拥有的东西并且它不起作用,也许会有所帮助:
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 …Run Code Online (Sandbox Code Playgroud) 截至目前我正在使用这个:
String path="/sdcard/media/audio/ringtones/";
String filename=soundname+".ogg";
boolean exists = (new File(path)).exists();
if (!exists){new File(path).mkdirs();}
FileOutputStream save;
try {
save = new FileOutputStream(path+filename);
save.write(buffer);
save.flush();
save.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
return false;
} catch (IOException e) {
// TODO Auto-generated catch block
return false;
}
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://"+path+filename)));
File k = new File(path, filename);
ContentValues values = new ContentValues();
values.put(MediaStore.MediaColumns.DATA, k.getAbsolutePath());
values.put(MediaStore.MediaColumns.TITLE, soundname);
values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/ogg");
values.put(MediaStore.Audio.Media.ARTIST, "...");
values.put(MediaStore.Audio.Media.IS_RINGTONE, true);
values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true);
values.put(MediaStore.Audio.Media.IS_ALARM, true);
values.put(MediaStore.Audio.Media.IS_MUSIC, false);
//Insert …Run Code Online (Sandbox Code Playgroud)