数据传递
2016-03-08 11:59
155 查看
//单条传送
A传
Intentintent=newIntent(A.this,B.class);
Bundlebundle=newBundle();bundle.putString("cid",cid);//要传递的数据intent.putExtras(bundle);
startActivity(intent);
B接
Stringcid=this.getIntent().getExtras().getString("cid");
//listview中item传送信息A传
Intentintent=newIntent(A.this,B.class);bean=listB.get(position);//传递实体类,某一值intent.putExtra("Age",bean.getAge());startActivity(intent);B接
Intentintent=getIntent();StringAge=intent.getStringExtra("Age");
########################################
//userId保存在userinfo中
SharedPreferencessp=getSharedPreferences("userinfo",0);SharedPreferences.Editoreditor=sp.edit();editor.putString("userId",userId);editor.commit();
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//userId从userinfo中取出
SharedPreferencesshare=getSharedPreferences("userinfo",0);StringuserId=share.getString("userId","");
相关文章推荐
- Spring 整合Quartz两种方式比较(JobDetailBean和MethodInvokingJobDetailFactoryBean方式)
- leetcode--Range Sum Query - Immutable
- 判断用户的登录状态,弹出alertView来进行登录操作
- HashMap源码分析(一)
- C++函数重载与缺省参数的宏观理解
- SQL SERVER普通用户需要什么权限才能执行sp_configure命令
- [Android Pro] DES加密 version1
- Java并发编程(十):并发容器之CopyOnWriteArrayList(转载)
- post请求
- HBase Shell手动移动Region
- Howto run google-chrome as root
- 013_HDFS文件合并上传putmarge功能(类似于hadoop fs -getmerge)
- 关于C编程容易忽略的地方
- Java开发中的23种设计模式详解
- 【cocos2d-js网络教程篇】cocos2d-js http网络请求
- 【牛腩】“闪电”的发现
- 算法训练 区间k大数查询
- JDBC之DatabaseMetaData之获取表的所有列名
- iOS优秀技术博客
- ThinkPHP分页及保持分页参数