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. unity3d连接Sqlite并打包发布Android
  2. android的一些开源项目
  3. Android(安卓)Adapter详解(1)
  4. 预防Android内存泄露
  5. android中怎么调整字体的间距和行间距
  6. Android常用动画alpha和rotate同时使用
  7. android camera(一):camera模组CMM介绍
  8. Hierarchy Viewer
  9. 实现ListView的item逐个飞入效果——LayoutAnimationController

随机推荐

  1. Android(安卓)SDK下, 如何在程序中输出日
  2. android 多线程处理UI
  3. Android(安卓)- Android(安卓)Studio修改
  4. android camera 源码分析(基于应用)
  5. 【Android】状态栏通知Notification、Not
  6. andio:android 音频的代码层次关系
  7. Android(安卓)的 SDK Manager 无法启动
  8. android 程序开发的插件化 模块化方法 之
  9. Android(安卓)恢复出厂设置(recovery)
  10. Android(安卓)ClassLoader解析(2) - Andr