在具有默认邮件应用程序的模拟器上一切正常.但是当我收到一封我使用Gmail应用程序从我的Hero发送的邮件时,我没有依恋.英雄的默认邮件应用程序正常工作.
如何使此代码适用于Hero上的Gmail应用?
你可以看到下面的代码.
private void startSendIntent() {
Bitmap bitmap = Bitmap.createBitmap(editableImageView.getWidth(), editableImageView.getHeight(), Bitmap.Config.RGB_565);
editableImageView.draw(new Canvas(bitmap));
File png = getFileStreamPath(getString(R.string.file_name));
FileOutputStream out = null;
try {
out = openFileOutput(getString(R.string.file_name), MODE_WORLD_READABLE);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
out.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (out != null) out.close();
}
catch (IOException ignore) {}
}
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(png));
emailIntent.setType("image/png");
startActivity(Intent.createChooser(emailIntent, getString(R.string.send_intent_name)));
}
Run Code Online (Sandbox Code Playgroud)
在日志中我看到以下内容:
02-05 17:03:37.526: DEBUG/Gmail(11511): URI FOUND:file:///sdcard/DCIM/100MEDIA/IMAG0001.jpg
02-05 17:03:37.535: DEBUG/Gmail(11511): ComposeActivity added to message:0 …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个依赖于拉动移动用户的地理位置数据的网站.我通过以下方式做到这一点:
function initialize() {
if(window.google && google.gears) {
var geo = google.gears.factory.create('beta.geolocation');
geo.getCurrentPosition(useLocation, errorOnLocate);
}
else if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(useLocation, errorOnLocate);
}
else {
alert("no geo found");
}
}
function errorOnLocate(message)
{
alert(message);
zoomTo(-34.397, 150.644);
}
Run Code Online (Sandbox Code Playgroud)
即使我切换地理位置方法顺序,这始终会在[object PositionError]中输入errorOnLocate函数.
这是一个使用Android 2.1的HTC Hero使用内置的任何浏览器.我的gps已开启,我已指示浏览器允许网站查看我的位置.手机上的谷歌地图本机应用程序中的"位置"功能可以很好地获取我的位置
如果我在我的个人计算机上使用FireFox 3.5访问我的网站,它将更正确地找到我的位置.(我相信它使用了ip和ap数据点的组合).无论哪种方式,它使用相同的JavaScript.
编辑:这是浏览器中的html/js,而不是本机应用程序.此外,确切的错误消息是"最后一个位置提供程序已被禁用"
明年将在弗罗茨瓦夫大学(波兰)举办Android编程课程,但现在需要选择手机.我在考虑HTC Hero,因为:
有没有针对英雄的争论?或者也许还有另一款手机更适合编程课程?