我们正在开发一款Android应用程序,用于从Unity中的ARCamera拍摄屏幕截图。
问题是我们有一个按钮,当我们点击按钮时,照片会保存在我们在手机中创建的文件夹中,但照片没有在手机的图库文件夹中更新。但是当我删除保存照片的文件夹中的任何照片时,图像会显示在手机的图库文件夹中。
刷新代码
$(document).ready(function(){
// Getting all the data from AWS link
$.ajax(
{
url: 'https://s3.amazonaws.com/interview-api-samples/events-results.json',
cache: false,
dataType: 'json',
type: 'GET',
data: ({ 'events' : [] }),
success: hillEvents,
error: function(e, xhr)
{
console.log(e);
}
});
function hillEvents(data)
{
$('#hillEvents').html(data.Date);
$.each(data.events, function(i, evt){
// converting date and time.
var eventStart= evt.startDate;
var myDate = new Date(eventStart);
// changing myDate to a date string
var dateString =
myDate.getUTCMonth() +"/"+
("0" + (myDate.getUTCDate()+1)).slice(-2) +"/"+
("0" + myDate.getUTCFullYear()).slice(-2);
// Converting time from military to standaerd and checking if it is am/pm
var hours = myDate.getUTCHours();
var minutes =myDate.getUTCMinutes();
var timeOfEvent = "" + ((hours >12) ? hours - 12 : hours);
timeOfEvent += (minutes < 10) ? ":0" + minutes : ":" + minutes;
timeOfEvent += (hours >= 12) ? " P.M." : " A.M.";
//getting all nested records
$.each(evt.locations,function(i,locations) {
//location data
var city= locations.city;
var state= locations.state;
var timeZone= locations.timezone;
var contactPhone= locations.contactPhone;
var contactEmail= locations.contactEmail;
var contactName= locations.contactName;
var address1= locations.address1;
var address2= locations.address2;
var postalCode= locations.postalCode;
//hosts
var host= locations.tags.host;
var specialGuest=locations.tags.specialGuest;
var cohost=locations.tags.cohost;
$.each(locations.tiers,function(i,v){
var tierTitle= v.title;
var tierDecription= v.decription;
var tierPrice=locations.price;
var tierRaiser=v.raiser;
var tierMax=v.maxNum;
var tierQuantity=v.quantity;
});
$.each(locations.shifts,function(i,v){
var shiftStart= v.startDate;
var shiftEnd= v.endDate;
});
});
var main_info ='<h1>' + evt.name + '</h1>';
main_info += '<p>' + evt.templateInfo.title + '</p>';
main_info += '<p>' + evt.description + '</p>';
main_info += '<p> Date: ' + dateString + " "+ timeOfEvent+ '</p>';
main_info += '<button class="eventsButton">View Event Details</button>';
// only counts first record
// main_info += '<p class="mainInfo">' + locations.city + ','+ locations.state +'</p>';
var secondary_info = '<h1 class="">' + 'hello'+ '</h1>';
secondary_info += '<p class="">' + evt.description + '</p>';
secondary_info += '<p class="">' + evt.createdDate + '</p>';
secondary_info += '<p class="">' + evt.createdDate + '</p>';
secondary_info += '<p class="">' + evt.guestsCanInviteOthers + '</p>';
$("div.content").append("<div class=event><div class=main_info>"+ main_info +"<div class='secondary_info>'"+ secondary_info +"<input class=attending type=checkbox>"+"I will attend this event"+"</>"+"</div></div></div>");
});
}
console.log("done");
});
但这适用于搭载Android 4.3的三星手机(型号为GT-I9300I)。问题是什么?
答案 0 :(得分:0)
尝试通过调用
将文件添加到图库MediaStore.Images.Media.insertImage(getContentResolver(), pathToImage, yourTitle , yourDescription);