android锁屏壁纸如何实现

misly 发布于 2012/04/16 16:21
阅读 7K+
收藏 2

想请问下android下的锁屏壁纸是如何实现的,也就如何调用系统里面的“设置锁屏壁纸”这个应用,或者android那个api里面有设置锁屏壁纸的方法或接口之类的

WallpaperManager.getInstance(mContext).setBitmap(bitmap);目前知道用这个方法可以将图片设置为壁纸,但是锁屏壁纸的api没有找到

加载中
0
misly
misly

怎么没人回个的

0
LiangX
LiangX

In addition to supporting the policies listed in the above table, the Device Administration API lets you do the following:

  • Prompt user to set a new password.
  • Lock device immediately.
  • Wipe the device's data (that is, restore the device to its factory defaults).
0
misly
misly

引用来自“LiangX”的答案

In addition to supporting the policies listed in the above table, the Device Administration API lets you do the following:

  • Prompt user to set a new password.
  • Lock device immediately.
  • Wipe the device's data (that is, restore the device to its factory defaults).
额,你这是设置密码、设备锁和擦除数据的吧,我是把我当前查看的图片设置为锁屏壁纸啊
0
llklovewx
llklovewx
Hi:不知道此问题您解决了没有?
misly
misly
还没有解决
0
misly
misly
没有啊!
0
物联网
怎么还没人回答啊,我也遇到这样的问题!
0
ada_young
ada_young
@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		File file = new File("mnt/sdcard2/DCIM/Camera/IMG_20120216_160054.jpg");
		Intent intent = createSetAsIntent(Uri.fromFile(file),null);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        startActivity(Intent.createChooser(intent, "设置壁纸"));
		// file:///mnt/sdcard2/DCIM/Camera/IMG_20120216_160054.jpg
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	public static Intent createSetAsIntent(Uri uri, String mimeType) {
		// Infer MIME type if missing for file URLs.
		if (uri.getScheme().equals("file")) {
			String path = uri.getPath();
			int lastDotIndex = path.lastIndexOf('.');
			if (lastDotIndex != -1) {
				mimeType = MimeTypeMap.getSingleton()
						.getMimeTypeFromExtension(
								uri.getPath().substring(lastDotIndex + 1)
										.toLowerCase());
			}
		}

		Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
		intent.setDataAndType(uri, mimeType);
		intent.putExtra("mimeType", mimeType);
		return intent;
	}
返回顶部
顶部