Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android will save the picture to see the album and timely     - Linux commands with browsing and downloading files (Linux)

- Linux processes in memory and memory cgroup statistics (Linux)

- in no backup ex: error: Xin Tourou ah backup child process has Singles DAT / US person / bin / in no backup ex (Database)

- Build their own recursive DNS server (Server)

- Archlinux installation tutorial (Linux)

- Oracle 12c R2 new feature dbca command to create a standby database (Database)

- The FreeBSD zfs: failed with error 6 Error Resolution (Linux)

- Android judgment toward camera pictures (Programming)

- Modifying the system registry protection server security (Linux)

- Linux Firewall Basics (Linux)

- ARM Linux system call (Linux)

- Oracle user password problem (Database)

- C ++ Replication Control: Assignment operators and destructors (Programming)

- Linux based exercises, interview questions (Linux)

- Installed in the desktop version of Ubuntu Unity Tweak Tool (Linux)

- Fatal NI connect error 12170 error in Alert Log (Database)

- Some common regular expressions (Linux)

- Distributed File System using MogileFS (Linux)

- Oracle 11g RAC root.sh execution error second node failure example (Database)

- Ubuntu install snmp packets Unlinked OID in IPATM-IPMC-MIB: marsMIB (Linux)

 
         
  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:      
 
- High-performance JavaScript loaded and executed (Programming)
- Nginx Keepalived Nginx monitoring scripts (Server)
- SSH automatic disconnection problem solving (Linux)
- ARP spoofing prevent Linux environment LAN (Linux)
- Oracle table space is too large processing time (Database)
- Linux Getting Started tutorial: hard disk partition and to deal with traps (Linux)
- MySQL to recover the data through binlog (Database)
- How to prevent page five invisible killer (Linux)
- Linux file time Comments ctime mtime atime (Linux)
- Ubuntu uses conky add desktop control (Linux)
- Percona MySQL 5.6 semi-synchronous replication (Database)
- Python 2.7.9 Installation on Linux CentOS 6.6 (Linux)
- How x2g0 install Remote Desktop on Linux VPS (Server)
- xCAT error Unable to dispatch hierarchical sub-command to NORESOLUTION: 3001 (Linux)
- Du and df show disk space usage inconsistent Causes and Treatment (Linux)
- Applications Linux leap second problem caused (Linux)
- Linux iptables: combat scenes (Linux)
- Oracle 11g creates virtual private directory RMAN-06004 ORA-00942 error handling (Database)
- C ++ Supplements - Smart Pointers (Programming)
- Oracle 11g contraction table space error ORA-03297: file contains used data beyondrequested RESIZE value (Database)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.