<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>How to save image file in Android Q &#8211; MaXEster Technologies  | Technical Blog</title>
	<atom:link href="https://www.maxester.com/blog/tag/how-to-save-image-file-in-android-q/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.maxester.com/blog</link>
	<description>Tutorials, Examples and Implementation code for Developers Help</description>
	<lastBuildDate>Mon, 17 Feb 2025 09:17:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.22</generator>
	<item>
		<title>getExternalStoragePublicDirectory is deprecated in Android</title>
		<link>https://www.maxester.com/blog/2019/12/03/getexternalstoragepublicdirectory-is-deprecated-in-android-in-api-level-29/</link>
		<comments>https://www.maxester.com/blog/2019/12/03/getexternalstoragepublicdirectory-is-deprecated-in-android-in-api-level-29/#respond</comments>
		<pubDate>Tue, 03 Dec 2019 15:53:53 +0000</pubDate>
		<dc:creator><![CDATA[Jony Chawla]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Android Q]]></category>
		<category><![CDATA[Api level 29]]></category>
		<category><![CDATA[deprecated]]></category>
		<category><![CDATA[getExternalStoragePublicDirectory]]></category>
		<category><![CDATA[How to save image file in Android Q]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=770</guid>
		<description><![CDATA[<p>The contract between the media provider and applications. Contains definitions for the supported URIs and columns. The media provider provides an indexed collection of media types, such as Audio, Video, and Images, from storage devices. Each collection is organized by&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/12/03/getexternalstoragepublicdirectory-is-deprecated-in-android-in-api-level-29/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/12/03/getexternalstoragepublicdirectory-is-deprecated-in-android-in-api-level-29/">getExternalStoragePublicDirectory is deprecated in Android</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>The contract between the media provider and applications. Contains definitions for the supported URIs and columns.</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>The media provider provides an indexed collection of media types, such as Audio, Video, and Images, from storage devices. Each collection is organized by primary MIME type of the content; for example, image/* content is indexed for Images. </p>



<p>

The Files collection provides a broad view for all collections, and does not filter by any MIME type.

</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>ContentValue class lets you to put information inside an object of Key-Value pairs for columns and their value. The object can then be pass to the<strong>&nbsp;insert&nbsp;</strong>method of an instance of the SQLiteDatabase class to insert or update your&nbsp;<strong>WritableDatabase.</strong></p>



<h4><br>Example Code for Save image file in Android Q</h4>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>        final String relativePath = Environment.DIRECTORY_PICTURES + File.separator + "Your Directory"; // save directory
        String fileName = "Your_File_Name"; // file name to save file with
        String mimeType = "image/*"; // Mime Types define here
        Bitmap bitmap = null; // your bitmap file to save

        final ContentValues contentValues = new ContentValues();
        contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, fileName);
        contentValues.put(MediaStore.MediaColumns.MIME_TYPE, mimeType);
        contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, relativePath);

        final ContentResolver resolver = context.getContentResolver();

        OutputStream stream = null;
        Uri uri = null;

        try {
            final Uri contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
            uri = resolver.insert(contentUri, contentValues);

            if (uri == null) {
                Log.d("error", "Failed to create new  MediaStore record.");
                return;
            }

            stream = resolver.openOutputStream(uri);

            if (stream == null) {
                Log.d("error", "Failed to get output stream.");
            }

            boolean saved = bitmap.compress(Bitmap.CompressFormat.JPEG, 90, stream);
            if (!saved) {
                Log.d("error", "Failed to save bitmap.");
            }
        } catch (IOException e) {
            if (uri != null) {
                resolver.delete(uri, null, null);
            }

        } finally {
            if (stream != null) {
                stream.close();
            }
        }</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/12/03/getexternalstoragepublicdirectory-is-deprecated-in-android-in-api-level-29/">getExternalStoragePublicDirectory is deprecated in Android</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/12/03/getexternalstoragepublicdirectory-is-deprecated-in-android-in-api-level-29/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
