1.网络连接通信

HttpClient 类通信(见《第一行代码》 郭霖2014.8月第一版P385)

Android Asynchronous Http Client  (见  http://loopj.com/android-async-http/  )

更多见   https://github.com/itheima1/Android

2.网页浏览 webView

https://github.com/getlantern/FinestWebView-Android

3.日志工具(一个静态类)

public class LogUtil{
public static final int VERBOSE =1;
public static final int DEBUG =2;
public static final int INFO=3;
public static final int WARN=4;
public static final int ERROR=5;
public static final int NOTHING=6;
public static final int LEVEL=VERBOSE;
public static void v(String tag,String msg){
if(VERBOSE>=LEVEL){
Log.v(tag,msg);
}
}
public static void d(String tag,String msg){
if(DEBUG>=LEVEL)
{
Log.d(tag,msg);
}
}
public static void i(String tag,String msg){
if(INFO>=LEVEL){
Log.i(tag,msg);
}
}
public static void w(String tag,String msg){
if(WARN>=LEVEL){
Log.w(tag,msg);
}
}
public static void e(String tag,String msg){
if(ERROR>=LEVEL){
Log.e(tag, msg);
}
}
}

4.Active切换

public class SecondActivity extends Activity{
public static void actionStart(Context context,String data1,String datta2){
Intent intent = new Intent(context,SecondActivity.class);
intent.putExtra("param1",data);
intent.putExtra("param2",data2);
context.startActivity(intent);
}
}

5.Intent 传递对象(例如Person对象)

  一.Person 要继承 Serializable(即;public class Person implements Serializable{.....})

  二.传递有intent.putExtra("person",person)

  三.获取对象  Person person = (Person) getInstant().getSerializableExtra("person");

 6.全局获取Context(and 全局变量存储)

 7.左侧滑出菜单栏(使用布局:android.support.v4.widget.DrawerLayout)

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start" <!--此处是关键语句-->
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>

禁止滑动调出侧边栏:

mDrawer_layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); //关闭手势滑动
mDrawer_layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); //打开手势滑动 

参考资料:http://blog.csdn.net/very_caiing/article/details/41854569

       https://developer.android.com/training/implementing-navigation/nav-drawer.html

8.Android开发需要新建的文件夹  

Helpers:存放一些帮助类文件
Models:存放模型
Services:存放网络通信,或一些调用手机硬件接口的方法类
Adapters: ListView 的adapter
Controls:存放自定义控件
Fragments:存放定义的Fragents

9.知晓当前实在哪一个活动

  在onCreate()方法中添加语句:

Log.d("BaseActivity",getClass().getSimpleName());

 10.Android 图表控件

  https://github.com/PhilJay/MPAndroidChart

  https://github.com/PhilJay/MPAndroidChart/wiki

11.Android 开发必看

http://www.jdzhao.com/

http://a.codekk.com/

https://github.com/hehonghui/android-tech-frontier

http://www.simplecoder.cn/

http://www.open-open.com/lib/view/open1461395311690.html  //完整项目mvp

http://blog.csdn.net/typename/article/details/39030091             //webview

http://www.devtf.cn/

12.Android网络HttpClient(像html中 ajax 调用服务)

和Ajax的功能相同(确保服务ajax可以正常使用)

  1.“http://192.168.17.44:81/amtioth5.Wcf/AjaxGetData/DataService.asmx”是地址

  2.hello是方法名

  3.obj.put("name", "your name"); 传参数。

  4.相关下载:链接:http://pan.baidu.com/s/1eSsftya 密码:pf52

 try {
HttpClient httpclient = new DefaultHttpClient();
String uri = "http://192.168.17.44:81/amtioth5.Wcf/AjaxGetData/DataService.asmx/hello"; //类似这样的地址也可以:http://192.168.17.44:81/amtioth5.Wcf/Service2.svc/DoWork2
HttpPost httppost = new HttpPost(uri);
//添加http头信息
httppost.addHeader("Content-Type", "application/json");
httppost.addHeader("User-Agent", "imgfornote");
//http post的json数据格式: {"name": "your name","parentId": "id_of_parent"}
JSONObject obj = new JSONObject();
obj.put("name", "your name");
httppost.setEntity(new StringEntity(obj.toString()));
HttpResponse response;
response = httpclient.execute(httppost);
int code = response.getStatusLine().getStatusCode();
if (code == 200) {
String rev = EntityUtils.toString(response.getEntity());
}
} catch (ClientProtocolException e) {
} catch (IOException e) {
} catch (JSONException e) {
}

13.线程

  一、新建一个类继承子Thread    

class MyThread extends Thread{
@Override
public void run(){
//TODO
}
}
//启动线程
new MyThread().start();

  二、实现Runnable 接口

class MyThread implements Runnable{
@Override
public void run(){
//TODO
}
}
//启动线程
MyThread myThread = new MyThread();
new Thread(myThread).start();  

//UI interactive

private Handler handler = new Handler(){
public void handlerMessage(Message msg){
switch(msg.what){
// case .... handle UI
default:
break;
}
}
}

三、使用AsyncTask    /*recommend*/

class DownLoadTask extends AsyncTask<Void, Integer, Boolean>{
@Override
protected void onPreExecute(){}
@Override
protected Boolean doInBackground(void... params){return true;}
@Override
protected void onProgressUpdate(Integer... value){}
@Override
protected void onPostExecute(Boolean result){}
}
// 执行
new DownLoadTask().execute();

14.底部tab

http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0731/3247.html

https://www.aswifter.com/2015/07/02/Material-Design-Example-5/

https://github.com/lwngreat/MaterialDesignExample

https://www.aswifter.com/2015/08/09/implements-bottom-tab-with-tablayout/

http://www.jianshu.com/p/c3f6d316ec5b

https://www.aswifter.com/android/            /*importent*/

15.Android Studio 使用  proguard

  配置文件   proguard-rules.pro (Eclipse中的文件名为proguard.cfg)  

#指定代码的压缩级别
-optimizationpasses 5
#是否使用大小写混合
-dontusemixedcaseclassnames
#优化/不优化输入的类文件
-dontoptimize
#是否混淆第三方jar包
-dontskipnonpubliclibraryclasses
#混淆时是否做预校验
-dontpreverify
#混淆时是否记录日志
-verbose
#混淆时所采用的算法
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
#保护注解
-keepattributes *Annotation* #保持JNI用到的native方法不被混淆
-keepclasseswithmembers class * {
native <methods>;
} #保持自定义控件的构造函数不被混淆,因为自定义控件很可能直接写在布局文件中
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
} #保持自定义控件的构造函数不被混淆
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
} #保持布局中onClick属性指定的方法不被混淆
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
} #保持枚举enum类不被混淆
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
} #保持序列化的Parcelable不被混淆
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
} #指定哪些第三方jar包需要混淆
#-libraryjars libs/bcprov-jdk16-1.46.jar #保持哪些系统组件类不被混淆
-keep public class * extends android.app.Fragment
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class * extends android.support.v4.**
-keep public class com.android.vending.licensing.ILicensingService #保持哪些第三方jar包不被混淆
-keep class com.baidu.** {*;}
-keep class vi.com.** {*;}
-dontwarn com.baidu.**
-dontwarn org.xmlpull.v1.XmlPullParser
-dontwarn org.xmlpull.v1.XmlSerializer

将配置添加的app项目中

//混淆
minifyEnabled true
//加载默认混淆配置文件及自定义混淆 配置
proguardFiles getDefaultProguardFile(‘proguard-android.txt’),’proguard-rules.pro’ 
我们设置minifyEnabled true,就会在打包的时候进行代码混淆处理. 其中proguard-android.txt不用管,在sdk目录里面,我们主要是配置了proguard-rules.pro文件。可能大家直接在Eclipse创建项目不会有这个文件,而是 proguard.cfg文件,其实一样的。
参考:http://blog.csdn.net/aqi00/article/details/50773578
运行出现错误:

  

  17:40:18 Gradle build finished with 1 error(s) and 23 warning(s) in 2s 946ms
  17:40:18 Generate Signed APK: Errors while building APK. You can find the errors in the 'Messages' view.

  /*************-------------------*******************/

  Warning:library class android.content.res.ColorStateList depends on program class org.xmlpull.v1.XmlPullParser
  Warning:library class android.graphics.drawable.AnimationDrawable depends on program class org.xmlpull.v1.XmlPullParser
  Warning:library class android.graphics.drawable.BitmapDrawable depends on program class org.xmlpull.v1.XmlPullParser
  Warning:library class android.graphics.drawable.ClipDrawable depends on program class org.xmlpull.v1.XmlPullParser
  Warning:library class android.graphics.drawable.ColorDrawable depends on program class org.xmlpull.v1.XmlPullParser
  Warning:library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
  Warning:library class android.graphics.drawable.GradientDrawable depends on program class org.xmlpull.v1.XmlPullParser

解决方法:在proguard-rules.pro 添加如下内容

-dontwarn org.xmlpull.v1.XmlPullParser

-dontwarn org.xmlpull.v1.XmlSerializer

16.App检测更新

http://blog.csdn.net/wwj_748/article/details/8195565

图书:

Android 源码设计模式解析与实战(何红辉关爱民 著)

Android 开发技术流程的更多相关文章

  1. Android开发技术周报182学习记录

    Android开发技术周报182学习记录 教程 App安全二三事 记录 为什么要安全 App的移动安全主要包括下面几种: 密钥破解,导致本地加密数据被盗取. 通信密钥破解,导致接口数据被盗取. 伪造接 ...

  2. Android开发技术周报176学习记录

    Android开发技术周报176学习记录 教程 当 OkHttp 遇上 Http 2.0 http://fucknmb.com/2018/04/16/%E5%BD%93OkHttp%E9%81%87% ...

  3. Android开发技术周报

    Android开发技术周报 原文  http://androidweekly.cn/android-dev-weekly-issue48/ 教程 深入理解Android之Gradle Gradle是当 ...

  4. Android开发技术周报183学习记录

    Android开发技术周报183学习记录 教程 Android性能优化来龙去脉总结 记录 一.性能问题常见 内存泄漏.频繁GC.耗电问题.OOM问题. 二.导致性能问题的原因 1.人为在ui线程中做了 ...

  5. Android 开发技术周报 Issue#277

    新闻 Android 11界面再调整:加入快速截屏.多任务向国产ROM看齐 最新版Android 11推送 谷歌Pixel 5被曝光:支持反向充电 4月Android系统版本分布:8.0 Oreo最主

  6. Android 开发 技术大纲

    大家好,  下面 是  Android 开发 的 技术大纲,  觉得 画的很好,  所以 转载过来, 这个 技术大纲 出自 “享学课堂” .

  7. Android 开发技术选型(博客,新闻,阅读类)

    前言 最开始学习写应用的时候,发现类聚合数据这个平台可以提供一些免费数据接口,于是写了个人的第一个应用-– JuheNews,当时的知识储备稍显粗糙,虽然现在的知识也不咋滴,但是相对之前而言还是有些进 ...

  8. Android开发技术重要参考资料

    只言片语 有的时候看不懂别人的代码,觉得自己笨:其实,你想多了,看不懂不是因为你蠢而是别人的代码写得烂:所以,别那么宽容别人却苛责自己. 参考资料 郭霖 way 爱哥 有心 胡凯 robin trin ...

  9. Android 开发技术周报 Issue#278

    新闻 Pixel 4a渲染图曝光:或能成新款iPhone SE有力竞争者 Google Play商店为预注册的游戏和应用提供自动安装功能 Android最强单摄Pixel 4a样张曝光:1200万像素 ...

随机推荐

  1. C++常量指针与常量数据

    常量指针即指针是常量的,一但声明指向某个数据后不能被更改,但是指向的数据可以被更改.声明格式如下: ; int * const p = &demo; 常量数据是指数据是常量的,一但被初始化后不 ...

  2. 解决django关于图片无法显示的问题

    http://python.usyiyi.cn/django/index.html http://m.blog.csdn.net/blog/qingyuanluofeng/44877399 http: ...

  3. Python之路第二天,基础(2)-基本数据类型

    一.Python数据类型 数 在Python中有4种类型的数,整数,长整数,浮点数和复数. 2是一个整数的例子 长整数不过是大一点的整数 3.23和52.3E是浮点数的例子.E标记表示10的幂.52. ...

  4. 函数:Python的乐高积木 - 零基础入门学习Python017

    函数:Python的乐高积木 让编程改变世界 Change the world by program 相信大家小时候应该都玩过神奇的乐高积木,只要通过想象和创意,我们可以用它拼凑出很多神奇的东西. 随 ...

  5. C语言生产随机数的方法

    尽管在计算机中并没有一个真正的随机数发生器,但是可以做到使产生的数字的重复率很低,以至于它们看起来是随机的.实现这一功能的程序叫做伪随机数发生器. 有关如何产生随机数的理论有许多,这里不讨论这些理论及 ...

  6. Netbeans使用Xdebug调试的配置

    在phpinfo()信息里找到php.ini的位置并打开php.ini在文档最后添加如下代码: 注释原来xdebug配置 xdebug.remote_enable=onxdebug.remote_ha ...

  7. 查看Linux系统下Raid信息

    软件raid:只能通过Linux系统本身来查看 cat /proc/mdstat 可以看到raid级别,状态等信息. 硬件raid: 最佳的办法是通过已安装的raid厂商的管理工具来查看,有cmdli ...

  8. Google的Protocol Buffer格式分析

    [转]转自:序列化笔记之一:Google的Protocol Buffer格式分析 从公开介绍来看,ProtocolBuffer(PB)是google 的一种数据交换的格式,它独立于语言,独立于平台.作 ...

  9. qt QSortFilterProxyModel

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.Qt import * from PyQt4. ...

  10. iOS经常使用的加密算法

    在iOS开发中,为了数据的安全经常对内容进行加密,在这儿我们对经常使用的加密算法进行了总结: 1.MD5 <span style="font-size:18px;">+ ...