助考100%,祝你取得好成绩.
来源:互联网 发布:windows车载系统 编辑:程序博客网 时间:2024/05/19 05:38
1.GreenDao
1. 要在新建的module模块对应的build.gradle里面配置依赖包以及生成类的位置
dependencies {//依赖包 classpath 'com.android.tools.build:gradle:2.2.3' classpath 'org.greenrobot:greendao-gradle-plugin:3.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files}
2.
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.0.1' testCompile 'junit:junit:4.12' compile 'org.greenrobot:greendao:3.2.0'}在顶部声明部位
apply plugin: 'com.android.application'apply plugin: 'org.greenrobot.greendao'在android{}添加
android { compileSdkVersion 25 buildToolsVersion "23.0.3" greendao{ schemaVersion 1 daoPackage 'com.jiyun.com.day07_greendao' targetGenDir 'src/main/java' } }
实现数据库修改:@Entity(nameInDb = "message")public class Message { @Property(nameInDb = "id") @Id(autoincrement = true) private Long id; @Property(nameInDb = "name") private String name; @Property(nameInDb = "content") private String content; @Property(nameInDb = "image") private String img1;1.Bean类实例化,Intent传对象,
Intent intent=new Intent(SecondActivity.this,SanActivity.class);intent.putExtra("bean",list.get(i));startActivityForResult(intent,200);2.接收,修改
Intent intent = getIntent();bean = intent.getParcelableExtra("bean");bean.setName(editTextString);bean.setShop(editText2String);bean.setImage(R.mipmap.ic_launcher);DaoMangger.getIntance(SanActivity.this).getDap().update(bean);3.回传Intent intent=new Intent(SanActivity.this,SecondActivity.class);setResult(200);finish();4.数据库中修改@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode==200&&resultCode==200){ list.clear(); List<Book> list1 = DaoMangger.getIntance(SecondActivity.this).getDap().queryBuilder().list(); list.addAll(list1); la.notifyDataSetChanged(); }}二。分享1.带面板分享2.不带面板UMImage umImage = new UMImage(MainActivity.this, R.mipmap.ic_launcher);new ShareAction(MainActivity.this) .withText("hello") .withMedia(umImage) .setDisplayList(SHARE_MEDIA.QQ) .setCallback(new UMShareListener()UMImage umImage1 = new UMImage(MainActivity.this, R.mipmap.ic_launcher);new ShareAction(MainActivity.this) .setPlatform(SHARE_MEDIA.QQ)//传入平台 .withText("hello")//分享内容 .withMedia(umImage1) .setCallback(new UMShareListener()3.登陆
UMShareAPI.get(this).getPlatformInfo(this, SHARE_MEDIA.QQ, new UMAuthListener()4.获取QQ头像
在下面有Map集合的方法中写
Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();while (iterator.hasNext()) { Map.Entry<String, String> next = iterator.next(); String key = next.getKey(); String value = next.getValue(); if (key.equals("iconurl")){ Intent in = new Intent(MainActivity.this, Main2Activity.class); in.putExtra("url", value); startActivity(in);volley:
okhttp:public class Utils { private static Utils utils; private RequestQueue queue; private Utils(Context context){ queue = Volley.newRequestQueue(context); } public static Utils getIntance(Context context){ if (utils==null){ utils=new Utils(context); } return utils; } public void sendPost(String url, Response.Listener<String> listener,Response.ErrorListener errorListener){ StringRequest stringRequest = new StringRequest(url, listener, errorListener); queue.add(stringRequest); }}public class Utils { private static Utils utils; private OkHttpClient okHttpClient; private Utils(){ okHttpClient=new OkHttpClient(); } public static synchronized Utils getIntance(){ if (utils==null) utils=new Utils(); return utils; } public void sendGet(String url, Callback callback){ Request builder = new Request.Builder().url(url).build(); Call call = okHttpClient.newCall(builder); call.enqueue(callback); }}
阅读全文
0 0
- 助考100%,祝你取得好成绩.
- 高一统考成绩
- 欣闻我班上的学生林健在Image Cup比赛中取得好成绩
- 欣闻我班上的学生林健在Image Cup比赛中取得好成绩
- 欣闻我班上的学生林健在Image Cup比赛中取得好成绩
- 欣闻我班上的学生林健在Image Cup比赛中取得好成绩
- 欣闻我班上的学生林健在Image Cup比赛中取得好成绩
- 欣闻我班上的学生林健在Image Cup比赛中取得好成绩
- 欣闻我班上的学生林健在Image Cup比赛中取得好成绩
- 我也明白要在各门功课上取得好成绩
- 女孩,为什么你上学时成绩那么好,…
- 全国各地软考成绩查询
- 机考成绩出来啦~
- 软考成绩查询网址
- 好成绩值多少钱?
- 她没有考好
- 过年好没劲,考
- 每日5条语法,伴你能力考好 No.1
- 异或运算随笔
- OpenGL ES 2.0 纹理总结
- 线性代数 -- 行列式及其性质
- js arr数组排序
- javascript实用技巧,js小知识
- 助考100%,祝你取得好成绩.
- 快速排序
- Android常见管理器—短信管理器 SmsManager
- 初学$ajax()简单使用及前后台交互
- 链式复制
- Bootstrap3 移动设备优先并使用了一些HTML5元素
- JSP着重点
- 无头双链表的创建
- Distributed hash table