package com.ecom.park_jy;

import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;

import java.io.File;
import java.util.Calendar;

public class img_demo extends AppCompatActivity {
    ImageView img3;
    Calendar calendar;
    String path;

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

        getSupportActionBar().hide();
        img3 = (ImageView) findViewById(R.id.img3);
        Intent it = this.getIntent();
        Bundle bundle = it.getExtras();
        calendar = Calendar.getInstance();
        path = Environment.getExternalStorageDirectory() + "/Park_jy/photo/" + calendar.get(Calendar.YEAR);
        if (((calendar.get(Calendar.MONTH)) + 1) < 10) {
            path += "0";
        }
        path += calendar.get(Calendar.MONTH) + 1;
        if (calendar.get(Calendar.DATE) < 10) {
            path += "0";
        }
        path += calendar.get(Calendar.DAY_OF_MONTH);
        img3.setImageURI(Uri.fromFile(new File(path + "/" + bundle.getString("Img_name"))));
    }
}
