android备忘录教学_Android备忘录

常用库Gradle依赖:

// retrofit2 的gson转换器依赖

compile 'com.squareup.retrofit2:converter-gson:2.0.1'

//retrofit2

compile 'com.squareup.retrofit2:retrofit:2.0.1'

// retrofit2 为RxJava准备的CallAdapter

compile 'com.squareup.retrofit2:adapter-rxjava:2.0.1'

// RxAndroid

compile 'io.reactivex:rxandroid:1.1.0'

//RxJava

compile 'io.reactivex:rxjava:1.1.0'

//Luban 图片压缩框架

compile 'top.zibin:Luban:1.0.5'

仿美团等选择城市列表demo

https://github.com/zaaach/CityPicker

获取照片(拍照或从相册、文件中选择)、裁剪图片、压缩图片的开源工具库

https://github.com/crazycodeboy/TakePhoto

如何在Android Studio安装so文件?

在app>>src>>main 目录下建立 jniLibs文件夹,jniLibs文件夹下放so文件;

在app的buid.gradle文件中添加SO库目录配置

android {

sourceSets {

main.jniLibs.srcDirs = ['libs']

}

}

如何在android 6.0 添加HttpClient库?

在app的build.gradle文件添加配置信息useLibrary 'org.apache.http.legacy'声明编译时依赖

android {

compileSdkVersion 23

buildToolsVersion "23.0.2"

useLibrary 'org.apache.http.legacy'

}

注:如果在build.gradle文件中useLibrary 'org.apache.http.legacy'这句话报错,可将该jar直接放到libs目录下即可。

常用代码

android 6.0 通知

NotificationManager notificationManager = (NotificationManager) mContext

.getSystemService(Context.NOTIFICATION_SERVICE);

PendingIntent pi = PendingIntent.getActivity(mContext, 0,

new Intent(MainActivity.this, MainActivity.class), 0);

NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext)

.setTicker("更新啦")

.setContentTitle("标题")

.setContentText("内容")

.setSmallIcon(R.drawable.ic_launcher);

Notification notification = builder.build();

notificationManager.notify(0, notification);

打开Android 相册

Intent intent=new Intent(Intent.ACTION_GET_CONTENT);

intent.setType("image/*");

打开Android相机

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

intent.putExtra(MediaStore.EXTRA_OUTPUT, PathToUri(imgPath));

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值