相册,多选图片,加号动态显示
2015-04-14 19:25
281 查看
0. onNewIntent(Intent intent) 可以接收到任意跳转到本界面的意图
显示图片界面的Activity 设置为singleTask 模式。
1.跳转到图片目录 并且携带已经选择几张图片
//
Intent intent = new Intent();
intent.setClass(this, ImgFileListActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("PictureCount", lists.size());
intent.putExtras(bundle);
startActivity(intent);
2.显示各个文件夹的目录
List<HashMap<String, String>> listdata=new ArrayList<HashMap<String,String>>();
Bitmap bitmap[] = null;
if (locallist!=null) {
bitmap=new Bitmap[locallist.size()];
for (int i = 0; i < locallist.size(); i++) {
HashMap<String, String> map=new HashMap<String, String>();
map.put("filecount", locallist.get(i).filecontent.size()+"张图片");
map.put("imgpath", locallist.get(i).filecontent.get(0)==null?null:(locallist.get(i).filecontent.get(0)));
map.put("filename", locallist.get(i).filename);
listdata.add(map);
}
}
listAdapter=new ImgFileListAdapter(this, listdata);
listView.setAdapter(listAdapter);
3. 点击跳转到相应的目录下
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Intent intent=new Intent(this,ImgsActivity.class);
Bundle bundle=new Bundle();
bundle.putParcelable("data", locallist.get(arg2));
bundle.putInt("selectpicture", selectP);
intent.putExtras(bundle);
startActivity(intent);
finish();
}
4.获取到目录下所有图片并且用gridView 显示
接收数据parce
bundle = getIntent().getExtras();
fileTraversal = bundle.getParcelable("data");
// 获取某个相册的所有图片 地址
listsP = fileTraversal.filecontent;
listsRP = new ArrayList<String>();
imgsAdapter = new ImgsAdapter(listsP, ImgsActivity.this);
imgGridView.setAdapter(imgsAdapter);
//单击事件来添加 图片到一个线性布局中 ,并且将图片的地址 加到listsRp集合内
//
for (int i = 0; i < listsP.size(); i++) {
listsBoolean.add(true);
}//用布尔类型来标记是否选择过这张图片
//点击选择图片
imgGridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view,
int position, long arg3) {
String filapath = fileTraversal.filecontent.get(position);
if (selectpicture - select_layout.getChildCount() > 0) {
if (listsRP.size() <= 5) {
if (listsBoolean.get(position) == true) {
listsRP.add(filapath);
listsBoolean.set(position, false);
// 将这张图片添加到线性布局里面
addPictureToLinear(filapath, position);
} else {
ToastLocationUtils.toastLocalUtils(
ImgsActivity.this, "该图片已添加过");
}
} else {
ToastLocationUtils.toastLocalUtils(ImgsActivity.this,
"最多添加6张图片");
}
} else {
ToastLocationUtils.toastLocalUtils(ImgsActivity.this,
"最多选择6张图片");
}
int sPicture = selectpicture-select_layout.getChildCount();
choise_button.setText("(已选择" + select_layout.getChildCount()
+ "张图片) 还可选择(" + sPicture + ")张");
}
});
//意图将数据集合传回到发帖界面
Intent intent = new Intent(this, MyReportPost.class);
Bundle bundle = new Bundle();
bundle.putStringArrayList("files", listsRP);
intent.putExtras(bundle);
startActivity(intent);
//集合显示,刷新适配器即可
显示图片界面的Activity 设置为singleTask 模式。
1.跳转到图片目录 并且携带已经选择几张图片
//
Intent intent = new Intent();
intent.setClass(this, ImgFileListActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("PictureCount", lists.size());
intent.putExtras(bundle);
startActivity(intent);
2.显示各个文件夹的目录
List<HashMap<String, String>> listdata=new ArrayList<HashMap<String,String>>();
Bitmap bitmap[] = null;
if (locallist!=null) {
bitmap=new Bitmap[locallist.size()];
for (int i = 0; i < locallist.size(); i++) {
HashMap<String, String> map=new HashMap<String, String>();
map.put("filecount", locallist.get(i).filecontent.size()+"张图片");
map.put("imgpath", locallist.get(i).filecontent.get(0)==null?null:(locallist.get(i).filecontent.get(0)));
map.put("filename", locallist.get(i).filename);
listdata.add(map);
}
}
listAdapter=new ImgFileListAdapter(this, listdata);
listView.setAdapter(listAdapter);
3. 点击跳转到相应的目录下
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Intent intent=new Intent(this,ImgsActivity.class);
Bundle bundle=new Bundle();
bundle.putParcelable("data", locallist.get(arg2));
bundle.putInt("selectpicture", selectP);
intent.putExtras(bundle);
startActivity(intent);
finish();
}
4.获取到目录下所有图片并且用gridView 显示
接收数据parce
bundle = getIntent().getExtras();
fileTraversal = bundle.getParcelable("data");
// 获取某个相册的所有图片 地址
listsP = fileTraversal.filecontent;
listsRP = new ArrayList<String>();
imgsAdapter = new ImgsAdapter(listsP, ImgsActivity.this);
imgGridView.setAdapter(imgsAdapter);
//单击事件来添加 图片到一个线性布局中 ,并且将图片的地址 加到listsRp集合内
//
for (int i = 0; i < listsP.size(); i++) {
listsBoolean.add(true);
}//用布尔类型来标记是否选择过这张图片
//点击选择图片
imgGridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view,
int position, long arg3) {
String filapath = fileTraversal.filecontent.get(position);
if (selectpicture - select_layout.getChildCount() > 0) {
if (listsRP.size() <= 5) {
if (listsBoolean.get(position) == true) {
listsRP.add(filapath);
listsBoolean.set(position, false);
// 将这张图片添加到线性布局里面
addPictureToLinear(filapath, position);
} else {
ToastLocationUtils.toastLocalUtils(
ImgsActivity.this, "该图片已添加过");
}
} else {
ToastLocationUtils.toastLocalUtils(ImgsActivity.this,
"最多添加6张图片");
}
} else {
ToastLocationUtils.toastLocalUtils(ImgsActivity.this,
"最多选择6张图片");
}
int sPicture = selectpicture-select_layout.getChildCount();
choise_button.setText("(已选择" + select_layout.getChildCount()
+ "张图片) 还可选择(" + sPicture + ")张");
}
});
//意图将数据集合传回到发帖界面
Intent intent = new Intent(this, MyReportPost.class);
Bundle bundle = new Bundle();
bundle.putStringArrayList("files", listsRP);
intent.putExtras(bundle);
startActivity(intent);
//集合显示,刷新适配器即可
相关文章推荐
- Android仿微信朋友圈发动态功能(相册图片多选)
- ANDROID GRIDVIEW仿微信图片多选功能_显示本地相册图片多选效果
- Android 仿微信朋友圈发动态功能(相册图片多选)
- 安卓,弹出选项框从相册相机中选择图片并显示。动态权限的处理,附源代码。
- 获取本地所有图片显示并可多选的本地相册
- 多选本地相册中的图片并展示(仿QQ空间动态发送页面)上传至服务器
- Android仿微信朋友圈发动态功能(相册图片多选)
- Android仿微信朋友圈发动态功能(相册图片多选)
- Android 调用相机裁剪图片,和调用相册裁剪图片,动态申请相机权限和sd的读写权限
- Android开发中调用系统相册上传图片到服务器OPPO等部分手机上出现短暂的显示桌面问题的解决方法
- 博计报表动态显示图片实现预警
- 小程序中如何实现操作菜单的显示(点击选取图片,弹出菜单拍摄、相册)功能
- 图片无缝连接,动态显示时间
- C# ComboBox显示图片与多选
- 点击进入相册 选择照片并 获取返回值 显示图片
- android保存图片到本地并可以在相册中显示出来
- 在WinCE下绘制半透的效果要注意的问题+WINCE 下创建动态显示图片窗口
- 仿QQ发表动态,获取系统相册,选择多张图片上传
- Winform动态显示图片,数据流方式
- C/C++实现显示GIF动态图片