我在该应用程序中有图像厨房应用程序我将所有图像放入drawable-hdpi文件夹中.我在我的活动中调用了这样的图像:
private Integer[] imageIDs = {
R.drawable.wall1, R.drawable.wall2,
R.drawable.wall3, R.drawable.wall4,
R.drawable.wall5, R.drawable.wall6,
R.drawable.wall7, R.drawable.wall8,
R.drawable.wall9, R.drawable.wall10
};
Run Code Online (Sandbox Code Playgroud)
所以现在我想知道我如何使用共享Intent我分享这些图像我推出的共享代码如下:
Button shareButton = (Button) findViewById(R.id.share_button);
shareButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse(Images.Media.EXTERNAL_CONTENT_URI + "/" + imageIDs);
sharingIntent.setType("image/jpeg");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share image using"));
}
});
Run Code Online (Sandbox Code Playgroud)
当我点击分享按钮时我也有共享按钮分享框正在打开但当我克服任何服务时,大多数崩溃或一些服务说:无法打开图像所以我怎么能解决这个问题或者是否有任何其他格式代码来共享图像????
编辑:
我尝试使用下面的代码.但它不起作用.
Button shareButton = (Button) findViewById(R.id.share_button);
shareButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse("android.resource://com.android.test/*");
try { …Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,我想从URL下载图像.我需要立即下载这些图像并将其存储到内部存储中.有200多张图片供下载.请告诉我在最短的时间内下载这些图像的最佳方法.如果有任何第三方库,请告诉我们.
我从 themoviedb API 收到以下 JSON 响应:
\n{\n "popularity":1640.159,\n "vote_count":32,\n "video":false,\n "poster_path":"\\/9Rj8l6gElLpRL7Kj17iZhrT5Zuw.jpg",\n "id":734309,\n "adult":false,\n "backdrop_path":"\\/7fvdg211A2L0mHddvzyArRuRalp.jpg",\n "original_language":"en",\n "original_title":"Santana",\n "genre_ids":[\n 28\n ],\n "title":"Santana",\n "vote_average":6.3,\n "overview":"Two brothers \xe2\x80\x94 one a narcotics agent and the other a general \xe2\x80\x94 finally discover the identity of the drug lord who murdered their parents decades ago. They may kill each other before capturing the bad guys.",\n "release_date":"2020-08-28"\n }\nRun Code Online (Sandbox Code Playgroud)\n我必须使用poster_path但我无法理解它,因为它只是图像名称而不是任何路径。我不知道如何从这个poster_path字符串中获取图像。
请帮我!当我将网址粘贴到 Google 上时,我什么也没得到。
\n