Java 图像索尼智能手表2
我试图在Sony Smartwatch UI中显示应用程序项目中没有的外部图像。我知道如何使用位于drawable文件夹中的图像Java 图像索尼智能手表2,java,android,sony-smartwatch,Java,Android,Sony Smartwatch,我试图在Sony Smartwatch UI中显示应用程序项目中没有的外部图像。我知道如何使用位于drawable文件夹中的图像 Bundle iconBundle = new Bundle(); iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.thumbnail); iconBundle.putString(Control.Intents.EXTRA_DATA_URI,
Bundle iconBundle = new Bundle();
iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.thumbnail);
iconBundle.putString(Control.Intents.EXTRA_DATA_URI,
ExtensionUtils.getUriString(mContext, R.drawable.thumbnail_list_item));
在本例中,我在drawable文件夹中有一个名为R.drawable.thumbnail\u list\u item的图像。问题是当我尝试使用外部图像时。我有以下URL:,但此代码不起作用:
Bundle iconBundle = new Bundle();
iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.thumbnail);
iconBundle.putString(Control.Intents.EXTRA_DATA_URI,
ExtensionUtils.getUriString(mContext, "http://tcset.com/images/logotcsetarriba.png"));
我怎么做呢?我需要帮助:S谢谢你 必须先将外部映像下载到设备。然后,您可能必须使用。您需要先下载图像,然后再将sendImage与要替换的图像id和下载的位图结合使用。例如:
sendImage(R.id.image, bmp);
这是否回答了您的问题?难以置信,但实际上,您可以在特定的ImageView中显示非参考资料中的图像。它归结为将图像下载到byteArray中,创建一个包并将图像作为Control.Intents.EXTRA_数据传递
Bundle iconBundle = new Bundle();
iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.imageView);
iconBundle.putByteArray(Control.Intents.EXTRA_DATA, buffer);
showLayout(layoutId, layoutId, layoutId, new Bundle[] {iconBundle})
我不知道索尼为什么省略了这样一个有用的功能。使用showBitmap,您可以在220x176中显示图像,但如何使用sendImage显示图像?它不起作用