- ./adb -s MX1CA16BLCYPDA1959 shell 当有多个调试设备时需要用s选项指定设备
- 在使用ImageView时要注意到
android:src
和android:background
的不同, 前者可以在保持比例的条件下调整图像,后者则会使图像变形以完全充满背景;android:
scaleType可以设置图像的调整方式,如居中或者全部填充等;android:
adjustViewBounds=true可以使imageview调整自己的边界去适应图像
- 在Android下调用拨号程序或Google地图等比想象的要容易很多,使用Intent即可;
Intent geoIntent = new Intent(Intent.ACTION_VIEW);
geoIntent.setData(Uri.parse('geo:0,0?q=你的地址"));
try{startActivity(geoIntent);} catch(ActivityNotFoundException e) {
Toast.makeText(GeneratorActivity.this,R.string.noMapException, Toast.LENGTH_SHORT).show();
}
参见这一网页
http://developer.android.com/guide/appendix/g-app-intents.html
其他的操作如调用email,电话,短信等也基本同理,并不复杂:
//action="http://www.baidu.com"; //action="tel:df1234"; //action="sms:12334"; //action="mail:shang@nereide.fr"; //action="geo:48.849242,2.293024"; //action="geo: Société Néréide, 3b
Les Isles 37270 Veretz, France"; if(action != null ) { if(action.startsWith("tel:")){ Intent callIntent = new Intent(Intent.ACTION_DIAL); callIntent.setData(Uri.parse(action));
startActivity(callIntent); }else if(action.startsWith("sms:")){ Intent callIntent = new Intent(Intent.ACTION_SENDTO); callIntent.setData(Uri.parse(action));
startActivity(callIntent); }else if (action.startsWith("mail:")){ Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("message/rfc822");
emailIntent.putExtra(Intent.EXTRA_EMAIL,new String[]{action.substring(5)} ); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "my subject"); emailIntent.putExtra(Intent.EXTRA_TEXT,
"body text"); try { startActivity(Intent.createChooser(emailIntent, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(GeneratorActivity.this, R.string.noEmailClientException, Toast.LENGTH_SHORT).show(); } } else if (action.startsWith("geo")){ if( !action.startsWith("geo:0,0?q="))
{ action = action.replaceFirst("geo:", "geo:0,0?q="); } Log.d(TAG, action); Intent geoIntent = new Intent(Intent.ACTION_VIEW);
geoIntent.setData(Uri.parse(action)); try{startActivity(geoIntent); } catch(ActivityNotFoundException e) { Toast.makeText(GeneratorActivity.this,
R.string.noMapException, Toast.LENGTH_SHORT).show(); } }
分享到:
相关推荐
Android开发笔记---ListView
Android学习笔记-Activity篇 Contents Android学习笔记-Activity篇 1 一、activity创建: 1 二、在manifest.xml中声明activity: 1 三、启动activity 1 3.1 启动不带返回结果的Activity 1 3.2 启动带有返回结果的...
新版Android开发教程&笔记--基础入门一 新版Android开发教程&笔记--基础入门二 新版Android开发教程&笔记三--环境搭建与解析 新版Android开发教程&笔记四--Dalvik ADB 新版Android开发教程+笔记五--模拟器、应用1、2...
android学习笔记--clip.pdf
http://blog.csdn.net/loveqRc/article/details/54169666 Android学习笔记--Gson笔记
android学习笔记-clip.pdf
Android自学笔记-16-任务栈源代码
android学习笔记--clip参照.pdf
Android自学笔记-11-listview简单例子
Android学习笔记-SQLite介绍-以及使用Sqlite-进行数据库的创建-完成数据.pdf
Android学习笔记-采用ListView实现数据列表显示-以及各种适配器使用-和如何写.pdf
Android学习笔记--通过wifi向服务器端发送数据
Android自学笔记-13-ContentObserver内容观察者
Android自学笔记-14-意图(Intent)
Android自学笔记-17-广播接收者(BroadcastReceiver)
Android自学笔记-15-Activity的生命周期
Android自学笔记-9-Pull方式处理XML
新版Android开发教程&笔记--基础入门一.pdf 新版Android开发教程&笔记--基础入门二.pdf 新版Android开发教程&笔记三--环境搭建与解析.pdf 新版Android开发教程&笔记四--Dalvik ADB.pdf 新版Android开发教程+笔记五--...
黑马程序员-SpringCloud-学习笔记-02-微服务拆分及远程调用
黑马程序员之android学习笔记--用户界面 View(一).docx