• 大小: 490KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-12
  • 语言: Java
  • 标签: 头像截取  

资源简介

本文使用Bmob作为云后台,实现一个简简单单的头像的选取、截取、上传、下载功能的实现。 编码环境:Android Studio2.1.1 运行环境:Miui8.6.8.18(安卓版本号6.0.1MMB29M) 手机型号:小米3 如有错误,欢迎指正!

资源截图

代码片段和文件信息

package com.example.no_clay.demolist.ChooseImage;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.example.no_clay.demolist.R;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.datatype.BmobFile;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.DownloadFileListener;
import cn.bmob.v3.listener.QueryListener;
import cn.bmob.v3.listener.SaveListener;
import cn.bmob.v3.listener.UploadFileListener;

/**
 * Created by 寒 on 2016/6/4.
 */
public class ChooseImageMainActivity extends AppCompatActivity {

    private MyCircleImageView chooseUserImage;
    private MyCircleImageView showUserImage;
    private Button downloadButton;
    private Button uploadButton;
    private SelectPicPopupWindow menuWindow;
    private Uri userImageUri;//保存用户头像的uri
    SignUserImage signUserImage = new SignUserImage();

    private static final int DOWNLOAD_IMAGE_MSG = 0;
    private static final int REQUEST_CODE_PICK_IMAGE = 0;
    private static final int REQUEST_CODE_CAPTURE_CAMEIA = 1;
    private static final int RESIZE_REQUEST_CODE = 2;
    private static final String TAG = “ChooseImageMainActivity“;
    private Context context = ChooseImageMainActivity.this;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.choose_image_main_layout);

        initView();
        chooseUserImage.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View v) {
                menuWindow = new SelectPicPopupWindow(context new
                        View.onclickListener() {
                            @Override
                            public void onclick(View v) {
                                menuWindow.dismiss();
                                switch (v.getId()) {
                                    case R.id.takePhotoBtn: {
                                        String state = Environment.getExternalStorageState();
                                        if (state.equals(Environment.MEDIA_MOUNTED)) {
                                            Intent getImageByCamera = new
                                                    Intent(“android.media.acti

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-07-29 09:52  java\
     目录           0  2016-07-29 09:52  java\com\
     目录           0  2016-07-29 09:52  java\com\example\
     目录           0  2016-07-29 09:52  java\com\example\no_clay\
     目录           0  2016-08-03 15:58  java\com\example\no_clay\demolist\
     目录           0  2016-09-01 17:44  java\com\example\no_clay\demolist\ChooseImage\
     文件       15845  2016-09-01 17:44  java\com\example\no_clay\demolist\ChooseImage\ChooseImageMainActivity.java
     文件        2488  2016-08-31 18:44  java\com\example\no_clay\demolist\ChooseImage\MyCircleImageView.java
     文件        2319  2016-06-04 15:30  java\com\example\no_clay\demolist\ChooseImage\SelectPicPopWindow.java
     文件         622  2016-06-05 16:28  java\com\example\no_clay\demolist\ChooseImage\SignUserImage.java
     文件        2309  2015-01-15 01:32  res\layout\choose_image_layout_dialog_pic.xml
     目录           0  2016-07-29 09:52  res\
     目录           0  2016-07-29 09:52  res\anim\
     文件         336  2016-05-26 19:25  res\anim\inuptodown.xml
     文件         465  2016-05-25 17:36  res\anim\outdowntoup.xml
     文件         373  2012-09-25 21:22  res\anim\push_bottom_in.xml
     文件         354  2012-09-25 21:22  res\anim\push_bottom_out.xml
     目录           0  2016-07-29 09:52  res\drawable\
     文件         327  2016-07-19 21:15  res\drawable\admire_checked.png
     文件         322  2016-07-19 21:15  res\drawable\admire_unchecked.png
     文件         295  2016-07-21 15:43  res\drawable\circle_bg.xml
     文件         411  2016-07-15 16:35  res\drawable\embed_start.png
     文件        1153  2016-07-21 09:56  res\drawable\first.png
     文件        1514  2016-07-21 10:39  res\drawable\gray_circle.png
     文件         846  2016-07-19 20:30  res\drawable\hot.png
     文件        4741  2014-09-02 22:08  res\drawable\img_1.png
     文件        4975  2014-09-02 22:08  res\drawable\img_2.png
     文件        4428  2014-09-02 22:08  res\drawable\img_3.png
     文件        4916  2014-09-02 22:08  res\drawable\img_4.png
     文件        5802  2014-09-02 22:08  res\drawable\img_5.png
     文件      291183  2014-09-02 19:22  res\drawable\img_frame_background.jpg
............此处省略30个文件信息

评论

共有 条评论

相关资源