Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android will save the picture to see the album and timely     - To setup a ftp server under Linux (Server)

- Install JDK 1.7 + Eclipse in CentOS 6.4 in (Linux)

- learning Linux ls command examples (Linux)

- Command filter MySQL slow query log (Database)

- Linux System Getting Started Learning: the curl set custom HTTP header (Linux)

- Using 30 seconds to write a detailed analysis of garbage removal system (Linux)

- MySQL 5.6 use GTIDs build the master database (Database)

- Linux Workstation Security Checklist - from the Linux Foundation Internal (Linux)

- Ubuntu under shadowsocks configuration instructions (Linux)

- [JavaScript] catch (ex) statements of ex (Programming)

- Quota for Vsftpd do use disk quotas (Server)

- Debian users to install FFmpeg 2.2.2 (Linux)

- How to install Kernel 4.0.2 on CentOS 7 (Linux)

- Java developers question (Programming)

- Lua4.0 interpreter entrance (Programming)

- Linux common commands MEMO (Linux)

- Ubuntu 12.04 installation OpenCV2.4.1 and compile test (Linux)

- Run Windows in FreeBSD bhyve (Linux)

- The Gitlab migrated to Docker container (Server)

- How to Disable Linux IPv6 (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:      
 
- QEMU image file used: qcow2 and raw (Linux)
- Linux argument references and command substitution (Linux)
- Oracle index visible and hidden (visible / invisible) (Database)
- Linux / Unix system-level IO (Linux)
- Ubuntu 14.10 used ifconfig commands to manage your network configuration (Linux)
- OGG-03510 Problem (Database)
- Use the command line MySQL database backup and recovery (Database)
- MySQL Slave synchronization problem solving (Database)
- Java framework for parallel study - ForkJoin (Programming)
- Linux Mint under tty.js Installation Guide (Linux)
- MySQLbinlog combat on using data recovery (Database)
- MySQL and Oracle time zone settings compare (Database)
- hadoop 2.7.1 High Availability Setup Deployment (Server)
- 12 Linux Process Management Commands (Linux)
- Android Dynamic efficiency articles: a brilliant Loading Analysis and Implementation (Programming)
- CentOS 6.x and CentOS7 installation RPMforge (Linux)
- 64-bit Ubuntu 15.10 How to compile the latest version of the 32 Wine 1.7.53 (Linux)
- 10 Regulation of painless SQL Schema (Database)
- Let your PHP 7 faster (GCC PGO) (Linux)
- Overall Physical Migration of Oracle Database with (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.