还原壁纸为默认壁纸
clearWallperper()的方法
重点是
package zhang.example;
import java.io.IOException;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class cwallpaper extends Activity {
private Button button;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button=(Button)findViewById(R.id.button);
button.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
try{
clearWallpaper();
Toast.makeText(cwallpaper.this, "OK", Toast.LENGTH_SHORT).show();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
});
}
public void clearWallpaper()throws IOException{
super.clearWallpaper();
}
}