SharedPreferences存储+SD卡存储

SharedPreferences存储+SD卡存储
SharedPreferences
使用方式
写数据
读数据
使用案例1
案例2 轮播图广告
文件存储:
内部文件存储
openFileOutput
openFileInput
外部文件存储(SD卡)
代码案例
SharedPreferences

SharedPreferences简称Sp(后面都会称Sp),是一种轻量级的数据存储方式,采用Key/value的方式 进行映射,最终会在手机的/data/data/package_name/shared_prefs/目录下以xml的格式存在。
Sp通常用于记录一些参数配置、行为标记等!因为其使用简单,所以大多数开发者用起来很爽!
但是 请注意:千万不要使用Sp去存储量大的数据,也千万不要去让你的Sp文件超级大,否则会大大影响应用性能, 甚至出现ANR(程序无响应)

特点:

保存少量的数据,且这些数据的格式非常简单。 存储5种原始数据类型: boolean, float, int, long, String
比如应用程序的各种配置信息(如是否打开音效、是否使用震动效果、小游戏的玩家积分等),记住密码功能,音乐播放器播放模式。
技能要点: (1)如何存储数据 (2)如何获取数据
使用方式

**步骤1:**得到SharedPreferences对象 getSharedPreferences(“文件的名称”,“文件的类型”);
(1).Context.MODE_PRIVATE:指定该SharedPreferences数据只能被应用程序读写
(2)MODE_APPEND:检查文件是否存在,存在就往文件追加内容,否则就创建新文件。
以下不在建议使用
(3).Context.MODE_WORLD_READABLE:指定该SharedPreferences数据能被其他
应用程序读,但不能写。
(4).Context,MODE_WORLD_WRITEABLE:指定该SharedPreferences数据能被其他应用程序写,但不能读。
**步骤2:**得到 SharedPreferences.Editor编辑对象
SharedPreferences.Editor editor=sp.edit();
**步骤3:**添加数据
editor.putBoolean(key,value)
editor.putString()
editor.putInt()
editor.putFloat()
editor.putLong()
**步骤4:**提交数据 editor.commit()或者apply()(推荐用这个.异步提交)
Editor其他方法: editor.clear() 清除数据 editor.remove(key) 移除指定key对应的数据

写数据

 //SP写数据
    private void write() {
        //TODO  1:得到SharedPreferences对象
        //参数一 xml文件的名字 参数二 模式 MODE_PRIVATE 指定该SharedPreferences数据只能被本应用程序读写
        SharedPreferences preferences = getSharedPreferences("songdingxing", MODE_PRIVATE);
        //TODO 2:获得编辑对象
        SharedPreferences.Editor editor = preferences.edit();
        //TODO 3:写数据
        editor.putString("username","送定型");
        editor.putInt("age",18);
        editor.putBoolean("isMan",false);
        editor.putFloat("price",12.4f);
        editor.putLong("id",5425054250l);
        //TODO 4:提交数据
        editor.commit();
    }

读数据

步骤1:得到SharedPreferences对象 getSharedPreferences(“文件的名称”,“文件的类型”);
步骤2:读取数据 String msg = sp.getString(key,defValue);
//读数据
    private void read() {
        //TODO  1:得到SharedPreferences对象
        //参数一 xml文件的名字 参数二 模式 MODE_PRIVATE 指定该SharedPreferences数据只能被本应用程序读写
        SharedPreferences preferences = getSharedPreferences("sgf", MODE_PRIVATE);
        //TODO 2:直接读取
        //参数一 键  参数二 找不到的时候给默认值
        String username=preferences.getString("username","");
        int age=preferences.getInt("age",0);
        boolean isMan=preferences.getBoolean("isMan",false);
        float price=preferences.getFloat("price",0.0f);
        long id=preferences.getLong("id",0l);
        Toast.makeText(this, username+":"+age+":"+isMan+":"+price+":"+id, Toast.LENGTH_SHORT).show();
    }

使用案例1
在这里插入图片描述
xml布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".LoginActivity"
    android:orientation="vertical"
    android:gravity="center">
    <EditText
        android:layout_marginLeft="50dp"
        android:layout_marginRight="50dp"
        android:id="@+id/username"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <EditText
        android:layout_marginLeft="50dp"
        android:layout_marginRight="50dp"
        android:id="@+id/password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    <RelativeLayout
        android:layout_marginLeft="50dp"
        android:layout_marginRight="50dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <CheckBox
            android:layout_alignParentLeft="true"
            android:id="@+id/cb_remember"
            android:text="记住密码"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <Button
            android:layout_alignParentRight="true"
            android:id="@+id/login"
            android:text="登录"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </RelativeLayout>
</LinearLayout>


java代码

package com.example.day008;

import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;

import java.util.Map;

public class MainActivity extends AppCompatActivity {

    private SharedPreferences sharedPreferences;
    private EditText username;
    private EditText password;
    private CheckBox cb;
    private Button login;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        username = (EditText) findViewById(R.id.username);
        password = (EditText) findViewById(R.id.password);
        cb=(CheckBox)findViewById(R.id.cb_remember);
        login=(Button)findViewById(R.id.login);
        //TODO 读取
        sharedPreferences=getSharedPreferences("1705A",MODE_PRIVATE);
        boolean ischeck= sharedPreferences.getBoolean("ischeck",false);
        if(ischeck){
            //读到用户名和密码展现在页面中,复选框被勾选
            String username1=sharedPreferences.getString("username","");
            String password1=sharedPreferences.getString("password","");
            username.setText(username1);
            password.setText(password1);
            cb.setChecked(true);
        }
        //TODO 写数据
        login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String username2=username.getText().toString().trim();
                String password2=password.getText().toString().trim();
                //用户名和密码是否正确
                if("sgf".equals(username2)&&"123456".equals(password2)){
                    //判断记住密码是否被选中
                    if(cb.isChecked()){//存
                        SharedPreferences.Editor edit = sharedPreferences.edit();
                        edit.putBoolean("ischeck",true);
                        edit.putString("username",username2);
                        edit.putString("password",password2);
                        edit.commit();

                    }else{//清空
                        SharedPreferences.Editor edit = sharedPreferences.edit();
                        edit.putBoolean("ischeck",false);
                        edit.commit();
                    }
                }
            }
        });
    }
}

案例2 轮播图广告

要求: 第二次启动app的时候,不加载轮播图.
关键 java代码(在昨天的案例基础上修改)
package com.example.day6;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Message;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;

public class MainActivity extends AppCompatActivity {
    private ViewPager viewPager;//ViewPager容器
    private TextView time_tv;//5秒倒计时
    private Button start;//开始体验按钮
    private MyPagerAdapter myPagerAdapter;//适配器
    private ArrayList<View> list=new ArrayList<>();//数据:4张View
    private ArrayList<ImageView> icon_list=new ArrayList<>();//小圆点图片
    private int current_item=0;//默认显示页
    private int time=5;//默认剩余时间
    private SharedPreferences preferences;//第2次打开不走向导页
    private Handler handler=new Handler(){
        @Override
        public void handleMessage(Message msg) {//handler:自动轮播+5秒到技术
            super.handleMessage(msg);
            if(msg.what==101){//自动轮播
                viewPager.setCurrentItem(current_item++);//设置滚动下一页
            }else  if(msg.what==102){//5秒倒计时
                time_tv.setText("剩余时间"+(--time));
                if(time==0){//页面跳转
                    Intent intent=new Intent(MainActivity.this,Main2Activity.class);
                    startActivity(intent);
                    finish();
                }
            }
        }
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        //设置二次打开不走向导页
        preferences= getSharedPreferences("welcome", MODE_PRIVATE);
        boolean flag=preferences.getBoolean("isdone",false);
        if(flag){//若是第二次打开直接页面跳转
            Intent intent=new Intent(MainActivity.this,Main2Activity.class);
            startActivity(intent);
        }


//        //TODO 加载视图
        initview();
//        //TODO 加载圆点
        initicon();
//        //TODO 加载数据
        initdata();
//        //TODO 设置适配器
        initadpter();
//        //TODO 设置事件监听
        initListener();



        SharedPreferences aaa = getSharedPreferences("welcome", MODE_PRIVATE);
        SharedPreferences.Editor welcome = aaa.edit();
        welcome.putBoolean("isdone",true);
        welcome.commit();



        //TODO 自动轮播
        final Timer timer=new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                if(current_item!=list.size()){//不是最后一页
                    handler.sendEmptyMessage(101);//发送一个空的消息
                }else{
                    timer.cancel();//如果是最后一页,直接取消定时器
                }
            }
        },0,2000);

    }

    private void initListener() {
        //开始按钮点击事件
        start.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,Main2Activity.class);
                startActivity(intent);
            }
        });
        //滑动viewPager的时候小圆点跟着走
        viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            //当页面滑动的时候调用
            @Override
            public void onPageScrolled(int i, float v, int i1) {
            }
            //当页面被选择的时候
            @Override
            public void onPageSelected(int i) {//1
                //TODO 将所有圆点变白,当前变灰
                for(int j=0;j<icon_list.size();j++){
                    icon_list.get(j).setImageResource(R.mipmap.bq2);
                }
                icon_list.get(i).setImageResource(R.mipmap.bq1);

                //TODO 当最后一个页面的时候显示按钮,和显示倒计时
                if(i==icon_list.size()-1){
                    start.setVisibility(View.VISIBLE);
                    time_tv.setVisibility(View.VISIBLE);
//                    //TODO 倒计时更新剩余时间
                    final Timer timer=new Timer();
                    timer.schedule(new TimerTask() {
                        @Override
                        public void run() {
                            if(time>0){
                                handler.sendEmptyMessage(102);
                            }else{
                                timer.cancel();
                            }
                        }
                    },0,1000);
                }else{
                    start.setVisibility(View.GONE);
                    time_tv.setVisibility(View.GONE);
                }
            }
            //当页面滑动状态改变的时候
            @Override
            public void onPageScrollStateChanged(int i) {
                switch(i){
                    case 0:
                        break;
                    case 1:
                        break;
                    case 2:
                        break;
                }
            }
        });
    }

    private void initadpter() {
        myPagerAdapter=new MyPagerAdapter(list,this);
        viewPager.setAdapter(myPagerAdapter);
    }

    private void initview() {
        viewPager=findViewById(R.id.pager);
        start=findViewById(R.id.start);
        time_tv=findViewById(R.id.time_tv);
    }

    private void initdata() {
        ImageView imageView1= new ImageView(this);
        imageView1.setImageResource(R.mipmap.miao1);
        list.add(imageView1);
        ImageView imageView2= new ImageView(this);
        imageView2.setImageResource(R.mipmap.miao3);
        list.add(imageView2);
        ImageView imageView3= new ImageView(this);
        imageView3.setImageResource(R.mipmap.miao4);
        list.add(imageView3);
        ImageView imageView4= new ImageView(this);
        imageView4.setImageResource(R.mipmap.miao5);
        list.add(imageView4);
        ImageView imageView5= new ImageView(this);
        imageView5.setImageResource(R.mipmap.miao6);
        list.add(imageView5);
    }
    private void initicon() {
        icon_list.add((ImageView) findViewById(R.id.icon1));
        icon_list.add((ImageView) findViewById(R.id.icon2));
        icon_list.add((ImageView) findViewById(R.id.icon3));
        icon_list.add((ImageView) findViewById(R.id.icon4));
        icon_list.add((ImageView) findViewById(R.id.icon5));
    }

}

文件存储:
内部文件存储
openFileOutput

与java 操作文件没有区别.只是路径是唯一的
 FileOutputStream fileOutputStream = null;
                try {
                    fileOutputStream = openFileOutput("aa.json", MODE_PRIVATE);
                    fileOutputStream.write("hello".getBytes());
                    fileOutputStream.flush();
                    fileOutputStream.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }

openFileInput

与java 操作文件没有区别.只是路径是唯一的
 FileInputStream fileInputStream = null;
        try {
            fileInputStream= openFileInput("aa.json");
            byte[] b = new byte[1024];
            int len = 0;
            while((len = fileInputStream.read(b)) != -1){
                Log.i(TAG, "onClick: "+new String(b,0,len));
            }

        } catch (Exception e) {
            e.printStackTrace();
        }


外部文件存储(SD卡)
SD卡介绍:
一般手机文件管理 根路径 /storage/emulated/0/或者/mnt/shell/emulated/0
在这里插入图片描述
2.重要代码:
(1)Environment.getExternalStorageState();// 判断SD卡是否
(2)Environment.getExternalStorageDirectory(); 获取SD卡的根目录
(3)Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); 获取SD卡公开目录pictures文件夹

3.必须要添加读写SD卡的权限

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
package com.example.day008;

import android.Manifest;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Map;

public class MainActivity extends AppCompatActivity {
    private Button login;
    private static final String TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        String externalStorageState = Environment.getExternalStorageState();
        Log.i(TAG, "onCreate: "+externalStorageState);
        File externalStorageDirectory = Environment.getExternalStorageDirectory();
        Log.i(TAG, "onCreate: "+externalStorageDirectory.toString());
        File externalStoragePublicDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
        Log.i(TAG, "onCreate: "+externalStoragePublicDirectory);

        login = findViewById(R.id.login);

        login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.i(TAG, "onClick: ");
				//运行时权限
                requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.READ_EXTERNAL_STORAGE},100);
                if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
                    //获取SD卡根路径:
                    File file = Environment.getExternalStorageDirectory();
                    FileOutputStream out = null;
                    try {
                        //创建输出流
                        out = new FileOutputStream(new File(file, "json.txt"));
                        out.write("呵呵呵俺哥哥".getBytes());
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    } finally {
                        if (out != null) {
                            try {
                                out.close();
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        }
                    }
                }
            }
        });
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if(requestCode == 100){
            if(grantResults != null && grantResults[0] == PackageManager.PERMISSION_GRANTED){
                Toast.makeText(this, "ok", Toast.LENGTH_SHORT).show();
            }else{
                Toast.makeText(this, "不行啊", Toast.LENGTH_SHORT).show();
            }
        }
    }
}


改进后的代码
把文件操作写到同意授权的回调方法里.

 @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if(requestCode == 100 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
            if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
                File file = Environment.getExternalStorageDirectory();
                FileOutputStream fileOutputStream = null;
                try {
                    fileOutputStream = new FileOutputStream(new File(file,"aa.json"));
                    fileOutputStream.write("aaa".getBytes());
                    fileOutputStream.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }else{
            Toast.makeText(this, "没有权限", Toast.LENGTH_SHORT).show();
        }
    }

代码案例
(1)添加读写SD卡的 权限
(2)FileUtils.java:四个方法:实现向SD卡中读写Bitmap图片和json字符串

 public class FileUtils {
    //方法1:向SD卡中写json串
    public static void write_json(String json)  {
        //判断是否挂载
        if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
            //获取SD卡根路径:mnt/shell/emulated/0
            File file=Environment.getExternalStorageDirectory();
            FileOutputStream out=null;
            try {
                //创建输出流
                out= new FileOutputStream(new File(file,"json.txt"));
                out.write(json.getBytes());
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }finally{
                if(out!=null){
                    try {
                        out.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }

        }
    }
    //方法2:从SD卡中读取json串
    public static String read_json() {
        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
            File file = Environment.getExternalStorageDirectory();
            FileInputStream inputStream = null;
            StringBuffer sb=new StringBuffer();
            try {
                inputStream=new FileInputStream(new File(file,"json.txt"));
                byte[] b=new byte[1024];
                int len=0;
                while((len=inputStream.read(b))!=-1){
                    sb.append(new String(b,0,len));
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }finally{
                if(inputStream!=null){
                    try {
                        inputStream.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
            return  sb.toString();
        }else{
            return "";
        }
    }

    //方法3:从SD卡中读取一张图片
    public  static  Bitmap read_bitmap(String filename) {//filename图片名字
        Bitmap bitmap=null;
        if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
            File file=Environment.getExternalStorageDirectory();
            File file1 = new File(file, filename);
            //BitmapFactory可以直接根据SD卡图片路径转成一个bitmap对象
             bitmap= BitmapFactory.decodeFile(file1.getAbsolutePath());
        }
        return bitmap;
    }
    //方法4:网络下载一张图片存储到SD卡中
    public  static  void write_bitmap(String url) {//网址
       new MyTask().execute(url);
    }
    static class MyTask extends AsyncTask<String,String,String> {
        @Override
        protected String doInBackground(String... strings) {
            FileOutputStream out=null;
            InputStream inputStream=null;//网络连接的输入流
            HttpURLConnection connection=null;//向SD卡写的输出流
            try {
                URL url= new URL(strings[0]);
                connection= (HttpURLConnection) url.openConnection();
                connection.setConnectTimeout(5*1000);
                connection.setReadTimeout(5*1000);
                if (connection.getResponseCode()==200){
                    inputStream = connection.getInputStream();
                    //TODO 获取SD卡的路径
                    if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {//是否挂载
                        File file = Environment.getExternalStorageDirectory();
                        out = new FileOutputStream(new File(file,"xiaoyueyue.jpg"));
                        byte[] bytes=new byte[1024];
                        int len=0;
                        while((len=inputStream.read(bytes))!=-1){
                            out.write(bytes,0,len);
                        }
                    }
                }
            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }finally {
                //关流
                if(out!=null){
                    try {
                        out.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                if(inputStream!=null){
                    try {
                        inputStream.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                if(connection!=null){
                    connection.disconnect();
                }
            }
            return null;
        }
    }
}


案例备注:

   private void checkAccess(String access,int code){
//Manifest.permission.READ_EXTERNAL_STORAGE
        //检查当前权限(若没有该权限,值为-1;若有该权限,值为0)
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            int hasAccess = ContextCompat.checkSelfPermission(getApplication(), access);
            Log.e("PERMISION_CODE", hasAccess + "***");
            if (hasAccess == PackageManager.PERMISSION_GRANTED) {
                // TODO: 2019/6/15 获得授权执行操作
                if (code == 1) {
                    write_json("json");
                }else if(code == 2){
                    read_json();
                }
            } else {
                //若没有授权,会弹出一个对话框(这个对话框是系统的,开发者不能自己定制),用户选择是否授权应用使用系统权限
                ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, code);
//            第1个参数,当前上下文环境;
//            第2个参数,需要授权的字符串数组;
//            第3个参数,请求码requestCode,在回调方法中会用到。

            }
        }else{
            // TODO: 2019/6/15 非6.0直接使用
            if (code == 1) {
                write_json("json");
            }else if(code == 2){
                read_json();
            }
        }
    }
    //用户选择是否同意授权后,会回调这个方法
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
//        第1个参数,请求码,对应上述方法的第3个参数;
//        第2个参数,请求权限数组;
//        第3个参数,请求权限的结果数组。
        if(requestCode==1) {
            if (permissions[0].equals(Manifest.permission.READ_EXTERNAL_STORAGE) && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                // TODO: 2019/6/15 获得授权执行操作
//http://www.qubaobei.com/ios/cf/dish_list.php?stage_id=1&limit=10&page=1
                write_json("json");

            } else {
                // TODO: 2019/6/15 未获得授权执行的操作 
                finish();

            }
        }else if(requestCode == 2){
            if (permissions[0].equals(Manifest.permission.READ_EXTERNAL_STORAGE) && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                // TODO: 2019/6/15 获得授权执行操作
//http://www.qubaobei.com/ios/cf/dish_list.php?stage_id=1&limit=10&page=1
                read_json();

            } else {
                // TODO: 2019/6/15 未获得授权执行的操作
                finish();
            }
        }
    }



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值