1. ./adb -s MX1CA16BLCYPDA1959 shell 当有多个调试设备时需要用s选项指定设备
  2. 在使用ImageView时要注意到android:srcandroid:background的不同, 前者可以在保持比例的条件下调整图像,后者则会使图像变形以完全充满背景;android:scaleType可以设置图像的调整方式,如居中或者全部填充等;android:adjustViewBounds=true可以使imageview调整自己的边界去适应图像
  3. 在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(); } }

   

更多相关文章

  1. Android系统移植与调试之------->如何修改Android设备存储盘符名
  2. 「Android Tips」解决 Mac OSX 无法识别 Android 设备
  3. 获取Android设备上的详细的摄像头信息
  4. 2013阿里技术嘉年华:Android设备体验优化
  5. Android studio项目不能编译,提示设备版本过低
  6. Android 笔记:Android将图像转换成流存储与将流转换成图像
  7. android UDID获取:android 设备SN的获取 续 android 设备唯一码的
  8. Android图像开源视图:SmartImageView

随机推荐

  1. Android(安卓)动画整理(3.0以上)
  2. 丢失Android系统库或者Conversion to Dal
  3. WebView---Android与js交互实例
  4. Android4.2增加新键值
  5. android与js的交互
  6. android静默安装的实现(turn)
  7. Android培训班(38)
  8. flutter集成推送功能-小米推送集成
  9. Android requires compiler compliance l
  10. Android中的测试小demo