Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android will save the picture to see the album and timely     - Nginx is used to build the cache module srcache_nginx (Server)

- DRBD-based installation and configuration of CentOS 6.5 (Server)

- Xmanager Remote Desktop connection CentOS (Linux)

- Linux crontab command format example (Linux)

- To teach you how to safely send mail (Linux)

- Redis data types Introduction (Database)

- Red Hat Enterprise Linux Server 6.5 installation GCC 4.9.2 (Linux)

- Let OpenCV face detection score output codes (Programming)

- Install and use automated tools Ansible in CentOS 7 (Linux)

- MyCAT easy entry (Database)

- vector C ++ sequence containers (Programming)

- GitLab Installation Guide -Ubuntu 14.04 LTS (Server)

- Node.js simple interface server (Server)

- How to upgrade Docker 1.6 on Fedora / CentOS (Server)

- Install the system cleaning software under Linux: BleachBit 1.4 (Linux)

- ThinkPad X201i installation notes Debian 7.5 (Linux)

- Linux initialization init system - UpStart (Linux)

- Windows Server 2012 R2 Datacenter install SQL Server 2016 CTP (Database)

- MongoDB 3.2 Cluster Setup (Database)

- 64-bit Windows Server 2012 R2 install Oracle 10g Second Edition (Database)

 
         
  Android will save the picture to see the album and timely
     
  Add Date : 2018-11-21      
         
         
         
  Android will save the image to the SD card, the album will not be there to this picture, because there is no update its index, generally you need to boot several times. Of course, we can manually update its index.

1, first save the file to the SD card.

String filePath = "xxx"; // full path

saveImgToSDcard (filePath);

2, increasing the Android internal media index.

public boolean saveImgToGallery (String filePath) {

boolean sdCardExist = Environment.getExternalStorageState (). equals (

android.os.Environment.MEDIA_MOUNTED); // determine whether there sd card

if (! sdCardExist)

return false;

try {

ContentValues ​​values ​​= new ContentValues ​​();

values.put ( "datetaken", new Date () toString ().);

values.put ( "mime_type", "image / jpg");

values.put ( "_ data", filePath);

Application app = DoctorApplication.getInstance ();

ContentResolver cr = app.getContentResolver ();

cr.insert (MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

} Catch (Exception e) {

e.printStackTrace ();

}

return true;

}

3, the refresh filePath upper level directory

MediaScannerConnection.scanFile (MyLanJingCode.this, new String [] {Environment.getExternalStoragePublicDirectory (Environment.DIRECTORY_DCIM) .getPath () + "/" + filePath.getParentFile () getAbsolutePath ().}, Null, null);

This will increase in time to see the pictures in the album.
     
         
         
         
  More:      
 
- Oracle JDK installation under Ubuntu Linux (Linux)
- The basic method RHEL6 (CentOS6) used in the source package compiled RPM: Upgrade OpenSSH articles (Linux)
- Fatal: unable to connect to github.com problem solving (Linux)
- Red Hat Linux security settings document (Linux)
- Linux Basics Tutorial: Combining awk delete data before the specified date hdfs (Linux)
- Source install Python3.4 on CentOS (Linux)
- Use install_updates upgrade GAMIT / GLOBK (Linux)
- Lua4.0 interpreter entrance (Programming)
- Git you do not know about some of the things (Linux)
- Iptables Instructions (Linux)
- Dual system Linux (Ubuntu) into the Windows NTFS partition's mount error (Linux)
- DRBD daily management (Server)
- MySQL how to export files with the date format (Database)
- Java implementation chain store binary tree (Programming)
- Mac OS X 10.10 Yosemite compiling OpenJDK 9 (Linux)
- CentOS6.6 ordinary users to use sudo command to borrow root user privileges (Linux)
- Linux using RAID how to use Mdadm Tool Management Software RAID (Linux)
- Increase ssh security service under Linux (Linux)
- ORA-00020: No more process state objects available (Database)
- Ubuntu 14.04 Nvidia graphics driver installation and settings (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.