<?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>Jony Chawla &#8211; MaXEster Technologies  | Technical Blog</title>
	<atom:link href="https://www.maxester.com/blog/author/johny/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>Change margin of a view programmatically?</title>
		<link>https://www.maxester.com/blog/2023/07/12/change-margin-of-a-view-programmatically/</link>
		<comments>https://www.maxester.com/blog/2023/07/12/change-margin-of-a-view-programmatically/#respond</comments>
		<pubDate>Wed, 12 Jul 2023 11:09:16 +0000</pubDate>
		<dc:creator><![CDATA[Jony Chawla]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[margin]]></category>
		<category><![CDATA[programmatically]]></category>
		<category><![CDATA[serMargin]]></category>
		<category><![CDATA[view margin]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=1123</guid>
		<description><![CDATA[<p>Let suppose view in a LinearLayout. First you have to get Layoutparams of the view and cast into to specific Layoutparams and modify the margins. As I remove margins by setting it all by 0. OR You can create a&#8230;</p>
<p><a href="https://www.maxester.com/blog/2023/07/12/change-margin-of-a-view-programmatically/" 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/2023/07/12/change-margin-of-a-view-programmatically/">Change margin of a view programmatically?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Let suppose view in a LinearLayout. First you have to get Layoutparams of the view and cast into to specific Layoutparams and modify the margins. As I remove margins by setting it all by 0.</p>



<pre class="wp-block-code"><code>((LinearLayout.LayoutParams) view.getLayoutParams()).setMargins(0,0,0,0);

               {or}

((LinearLayout.LayoutParams) view.getLayoutParams()).topMargin = 5;</code></pre>



<p style="text-align:center">OR</p>



<p>You can create a LayoutParams variable and set margins to it. And set LayoutParams back to the view. as below</p>



<pre class="wp-block-code"><code>LinearLayout.LayoutParams parmas = (LinearLayout.LayoutParams) holder.imageView.getLayoutParams();
            parmas.setMargins(0,5,0,0);
            holder.imageView.setLayoutParams(parmas);</code></pre>



<p style="text-align:center">OR</p>



<p>You can use it in more generic way without specifying the particular Layout. </p>



<p><br>If the view is inside RelativeLayout.  </p>



<pre class="wp-block-code"><code>RelativeLayout.LayoutParmas</code></pre>



<p>Or you can use generic ViewGroup.MarginLayoutParams without specifying parent</p>



<pre class="wp-block-code"><code>if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
        ViewGroup.MarginLayoutParams mp = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
        mp.setMargins(0,5,0,0);
        view.requestLayout();
    }</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2023/07/12/change-margin-of-a-view-programmatically/">Change margin of a view programmatically?</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/2023/07/12/change-margin-of-a-view-programmatically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android Name, Android Versions, and API level</title>
		<link>https://www.maxester.com/blog/2020/07/25/android-version-names-api-level-and-codenames/</link>
		<comments>https://www.maxester.com/blog/2020/07/25/android-version-names-api-level-and-codenames/#respond</comments>
		<pubDate>Sat, 25 Jul 2020 21:05:00 +0000</pubDate>
		<dc:creator><![CDATA[Jony Chawla]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Android API Level]]></category>
		<category><![CDATA[Android API list]]></category>
		<category><![CDATA[Android API Version List]]></category>
		<category><![CDATA[Android Codenames]]></category>
		<category><![CDATA[Android Name]]></category>
		<category><![CDATA[Android Version]]></category>
		<category><![CDATA[API list]]></category>
		<category><![CDATA[API Version Level]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=1006</guid>
		<description><![CDATA[<p>(adsbygoogle = window.adsbygoogle &#124;&#124; []).push({}); Android Version, Name and API level Android Name Version numbers API level Release date No name 1.0 1 September 23, 2008 No name 1.1 2 February 9, 2009 Cupcake 1.5 3 April 27, 2009 Donut&#8230;</p>
<p><a href="https://www.maxester.com/blog/2020/07/25/android-version-names-api-level-and-codenames/" 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/2020/07/25/android-version-names-api-level-and-codenames/">Android Name, Android Versions, and API level</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<!-- Fads -->
<ins class="adsbygoogle fads" data-ad-client="ca-pub-3804472713147276" data-ad-slot="1267368188"></ins>

     (adsbygoogle = window.adsbygoogle || []).push({});



<p>Android Version, Name and API level</p>



<table class="alt">
<tbody><tr>
	<th>Android Name</th>
	<th>Version numbers</th>
	<th>API level</th>
	<th>Release date</th>
</tr>
<tr>
	<td>No name</td>
	<td>1.0</td>
	<td>1</td>
	<td>September 23, 2008</td>
</tr>
<tr>
	<td>No name</td>
	<td>1.1</td>
	<td>2</td>
	<td>February 9, 2009</td>
</tr>
<tr>
	<td>Cupcake</td>
	<td>1.5</td>
	<td>3</td>
	<td>April 27, 2009</td>
</tr>
<tr>
	<td>Donut</td>
	<td>1.6</td>
	<td>4</td>
	<td>September 15, 2009</td>
</tr>
<tr>
	<td>Eclair</td>
	<td>2.0 &#8211; 2.1</td>
	<td>5 &#8211; 7</td>
	<td>October 26, 2009</td>
</tr>
<tr>
	<td>Froyo</td>
	<td>2.2 &#8211; 2.2.3</td>
	<td>8</td>
	<td>May 20, 2010</td>
</tr>
<tr>
	<td>Gingerbread</td>
	<td>2.3 &#8211; 2.3.7</td>
	<td>9 &#8211; 10</td>
	<td>December 6, 2010</td>
</tr>
<tr>
	<td>Honeycomb</td>
	<td>3.0 &#8211; 3.2.6</td>
	<td>11 &#8211; 13</td>
	<td>February 22, 2011</td>
</tr>
<tr>
	<td>Ice Cream Sandwich</td>
	<td>4.0 &#8211; 4.0.4</td>
	<td>14 &#8211; 15</td>
	<td>October 18, 2011</td>
</tr>
<tr>
	<td>Jelly Bean</td>
	<td>4.1 &#8211; 4.3.1</td>
	<td>16 &#8211; 18</td>
	<td>July 9, 2012</td>
</tr>
<tr>
	<td>KitKat</td>
	<td>4.4 &#8211; 4.4.4</td>
	<td>19 &#8211; 20</td>
	<td>October 31, 2013</td>
</tr>
<tr>
	<td>Lollipop</td>
	<td>5.0 &#8211; 5.1.1</td>
	<td>21 &#8211; 22</td>
	<td>November 12, 2014</td>
</tr>
<tr>
	<td>Marshmallow</td>
	<td>6.0 &#8211; 6.0.1</td>
	<td>23</td>
	<td>October 5, 2015</td>
</tr>
<tr>
	<td>Nougat</td>
	<td>7.0</td>
	<td>24</td>
	<td>August 22, 2016</td>
</tr>
<tr>
	<td>Nougat</td>
	<td>7.1.0 &#8211; 7.1.2</td>
	<td>25</td>
	<td>October 4, 2016</td>
</tr>
<tr>
	<td>Oreo</td>
	<td>8.0</td>
	<td>26</td>
	<td>August 21, 2017</td>
</tr>
<tr>
	<td>Oreo</td>
	<td>8.1</td>
	<td>27</td>
	<td>December 5, 2017</td>
</tr>
<tr>
	<td>Pie</td>
	<td>9.0</td>
	<td>28</td>
	<td>August 6, 2018</td>
</tr>
<tr>
	<td>Android 10 (Q)</td>
	<td>10.0</td>
	<td>29</td>
	<td>September 3, 2019</td>
</tr>
<tr>
	<td>Android 11 (R)</td>
	<td>11.0</td>
	<td>30</td>
	<td>September 8, 2020</td>
</tr>
<tr>
	<td>Android 12, 12L (S)</td>
	<td>12.0</td>
	<td>31 &#8211; 32</td>
	<td>October 4, 2021</td>
</tr>
<tr>
	<td>Android 13 (TIRAMISU)</td>
	<td>13.0</td>
	<td>33</td>
	<td>August 15, 2022</td>
</tr>
<tr>
	<td>Android 14 (UPSIDE_DOWN_CAKE)</td>
	<td>14.0</td>
	<td>34</td>
	<td>TBD</td>
</tr>
</tbody></table>



<!-- Fads -->
<ins class="adsbygoogle fads" data-ad-client="ca-pub-3804472713147276" data-ad-slot="1267368188"></ins>

     (adsbygoogle = window.adsbygoogle || []).push({});
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2020/07/25/android-version-names-api-level-and-codenames/">Android Name, Android Versions, and API level</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/2020/07/25/android-version-names-api-level-and-codenames/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add fragment specific menus in Android</title>
		<link>https://www.maxester.com/blog/2019/12/05/how-to-set-fragment-specific-menus-in-toolbar-in-android/</link>
		<comments>https://www.maxester.com/blog/2019/12/05/how-to-set-fragment-specific-menus-in-toolbar-in-android/#respond</comments>
		<pubDate>Thu, 05 Dec 2019 12:46:56 +0000</pubDate>
		<dc:creator><![CDATA[Jony Chawla]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[#fragment specific menus]]></category>
		<category><![CDATA[replace menus]]></category>
		<category><![CDATA[toolbar]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=779</guid>
		<description><![CDATA[<p>You can show new menus from fragment by onCreateOptionsMenu&#160;method First you need to setHasOptionsMenu(true)&#160;in onCreateView&#160;method&#160;as second you have to create menus.xml in res/menu/ folder And also you have to set menu in onCreateOptionsMenu&#160;method as If you want to replace menus&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/12/05/how-to-set-fragment-specific-menus-in-toolbar-in-android/" 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/05/how-to-set-fragment-specific-menus-in-toolbar-in-android/">How to add fragment specific menus 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> You can show new menus from fragment by  <strong>onCreateOptionsMenu</strong>&nbsp;method</p>



<p>First you need to <strong>setHasOptionsMenu(true)</strong>&nbsp;in <strong>onCreateView</strong>&nbsp;method&nbsp;as</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>




<pre class="wp-block-code"><code> @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment,
                container, false);
        this.view = view;


        setHasOptionsMenu(true);


        return view;
    }</code></pre>



<p>

second you have to create <strong>menus.xml</strong> in <strong>res/menu/</strong> folder

</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>




<pre class="wp-block-code"><code>&lt;?xml version="1.0" encoding="utf-8"?>
&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">


    &lt;item
        android:id="@+id/settings"
        android:icon="@drawable/settings_icon"
        android:orderInCategory="100"
        android:title="@string/settings"
        app:showAsAction="always" />


&lt;/menu></code></pre>



<p>And also you have to set menu in <strong>onCreateOptionsMenu</strong>&nbsp;method as</p>



<pre class="wp-block-code"><code> @Override
    public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
        inflater.inflate(R.menu.menus, menu);
        super.onCreateOptionsMenu(menu, inflater);
    }</code></pre>



<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>

If you want to replace menus with new menus then you just have to add <strong>menu.clear()</strong>&nbsp;&nbsp;before&nbsp;inflating&nbsp;new&nbsp;menus&nbsp;as

</p>



<pre class="wp-block-code"><code>@Override
    public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
        menu.clear(); 
        inflater.inflate(R.menu.menus, menu);
        super.onCreateOptionsMenu(menu, inflater);
    }</code></pre>



<p></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/12/05/how-to-set-fragment-specific-menus-in-toolbar-in-android/">How to add fragment specific menus 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/05/how-to-set-fragment-specific-menus-in-toolbar-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>
		<item>
		<title>How to set Error in Spinner in Android</title>
		<link>https://www.maxester.com/blog/2019/07/25/how-to-set-error-in-spinner-in-android/</link>
		<comments>https://www.maxester.com/blog/2019/07/25/how-to-set-error-in-spinner-in-android/#comments</comments>
		<pubDate>Thu, 25 Jul 2019 13:27:05 +0000</pubDate>
		<dc:creator><![CDATA[Jony Chawla]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[select spinner error]]></category>
		<category><![CDATA[seterror spinner android]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=597</guid>
		<description><![CDATA[<p>You know setError works on EditText and TextView. If the spinner has a list of TextView or EditText item, then you simply have to get the TextView or Editext from it. And then set error on it. You can get&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/07/25/how-to-set-error-in-spinner-in-android/" 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/07/25/how-to-set-error-in-spinner-in-android/">How to set Error in Spinner 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[
<pre class="wp-block-code"><code>ArrayAdapter&lt;String> adapter = new ArrayAdapter&lt;>(context, android.R.layout.simple_spinner_item, new String[]{"item 1,item 2,item 3"});
YourSpinner.setAdapter(adapter)</code></pre>



<p>You know setError works on EditText and TextView. If the spinner has a list of TextView or EditText item, then you simply have to get the TextView or Editext from it. And then set error on it. You can get TextView or EditText from Selected Spinner item view by this code demo below</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>




<pre class="wp-block-code"><code>TextView errorTextview = (TextView) YourSpinner.getSelectedView();
errorTextview.setError("Your Error Message here");</code></pre>



<div class="wp-block-image"><figure class="aligncenter is-resized"><img src="https://www.maxester.com/blog/wp-content/uploads/2019/07/spinner_setError.png" alt="" class="wp-image-598" width="508" height="102" srcset="https://www.maxester.com/blog/wp-content/uploads/2019/07/spinner_setError.png 697w, https://www.maxester.com/blog/wp-content/uploads/2019/07/spinner_setError-300x61.png 300w" sizes="(max-width: 508px) 100vw, 508px" /><figcaption><strong>Show Error&nbsp;In&nbsp;Spinner&nbsp;</strong></figcaption></figure></div>



<p>Now the condition that checks spinner item is selected or not, if not then show an error.</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>




<pre class="wp-block-code"><code>if (YourSpinner.getSelectedItemPosition() > 0) {
// get selected item value
String itemvalue = String.valueOf(YourSpinner.getSelectedItem());
} else {
// set error message on spinner
TextView errorTextview = (TextView) YourSpinner.getSelectedView();
errorTextview.setError("Your Error Message here");
}</code></pre>



<p>If the spinner not showing the error then you can pass the error message on the item with red color. see the code example below.</p>



<pre class="wp-block-code"><code> TextView errorTextview = (TextView) spdisposition.getSelectedView();
 errorTextview.setError("");
 errorTextview.setTextColor(Color.RED);
// for show error message on spinner
 errorTextview.setText("Your Error Message here");
                    </code></pre>



<div class="wp-block-image"><figure class="aligncenter"><img src="https://www.maxester.com/blog/wp-content/uploads/2019/07/spinner_setError_message-1.png" alt="" class="wp-image-605" srcset="https://www.maxester.com/blog/wp-content/uploads/2019/07/spinner_setError_message-1.png 697w, https://www.maxester.com/blog/wp-content/uploads/2019/07/spinner_setError_message-1-300x61.png 300w" sizes="(max-width: 697px) 100vw, 697px" /><figcaption><strong>show&nbsp;Error&nbsp;message&nbsp;Directly&nbsp;on&nbsp;spinner</strong></figcaption></figure></div>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/07/25/how-to-set-error-in-spinner-in-android/">How to set Error in Spinner 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/07/25/how-to-set-error-in-spinner-in-android/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to EditText accepts alphabets only in Android?</title>
		<link>https://www.maxester.com/blog/2019/07/11/how-to-edittext-accepts-alphabets-only-in-android/</link>
		<comments>https://www.maxester.com/blog/2019/07/11/how-to-edittext-accepts-alphabets-only-in-android/#respond</comments>
		<pubDate>Thu, 11 Jul 2019 14:15:44 +0000</pubDate>
		<dc:creator><![CDATA[Jony Chawla]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[edittext accepts alphabets only in android]]></category>
		<category><![CDATA[restrict numeric edittext in android]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=560</guid>
		<description><![CDATA[<p>Add this line in your EditText tag in layout(xml) file or you can read more about this here Full code EditText should be look like</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/07/11/how-to-edittext-accepts-alphabets-only-in-android/">How to EditText accepts alphabets only 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>Add this line in your EditText tag in layout(xml) file or you can read more about this <a href="https://developer.android.com/reference/android/widget/TextView.html#attr_android:digits">here</a></p>



<pre class="wp-block-code"><code>android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"</code></pre>



<p>Full code EditText should be look like</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>




<pre class="wp-block-code"><code>&lt;EditText 
android:id="@+id/edittext"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
android:layout_width="fill_parent"
android:hint="Enter Full Name"
android:layout_height="wrap_content" /></code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/07/11/how-to-edittext-accepts-alphabets-only-in-android/">How to EditText accepts alphabets only 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/07/11/how-to-edittext-accepts-alphabets-only-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show/Hide Password in EditText in Android</title>
		<link>https://www.maxester.com/blog/2019/05/28/show-hide-password-in-edittext-in-android/</link>
		<comments>https://www.maxester.com/blog/2019/05/28/show-hide-password-in-edittext-in-android/#comments</comments>
		<pubDate>Tue, 28 May 2019 12:27:52 +0000</pubDate>
		<dc:creator><![CDATA[Jony Chawla]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android show password edittext]]></category>
		<category><![CDATA[how to show and hide password in android using eye icon]]></category>
		<category><![CDATA[show/hide password]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=380</guid>
		<description><![CDATA[<p>To show/hide password in android simply change the attribute dynamically android:inputtype = "textpassword" or "text" using this setTransformationMethodFull code definition is below for show and hide password in edittext Here one edittext with input type = password and one eye&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/05/28/show-hide-password-in-edittext-in-android/" 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/05/28/show-hide-password-in-edittext-in-android/">Show/Hide Password in EditText 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[
<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-preformatted">To show/hide password in android simply change the attribute dynamically  <br><a href="https://developer.android.com/reference/android/widget/TextView.html#attr_android:password">android:inputtype</a> = "textpassword" or "text" using this <a href="https://developer.android.com/reference/android/widget/TextView.html#setTransformationMethod(android.text.method.TransformationMethod)">setTransformationMethod</a><br><br>Full code definition is below for show and hide password in edittext <br><br></pre>



<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>//Show Password
edit_password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());

//Hide Password
edit_password.setTransformationMethod(PasswordTransformationMethod.getInstance());</code></pre>



<p>Here one edittext with input type = password and one eye toggle ImageView button. We have to manage show/hide password using this Imageview onClick Action. </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>




<pre class="wp-block-code"><code>                    &lt;RelativeLayout
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp10">

                    &lt;EditText
                        android:id="@+id/edit_password"
                        android:layout_width="fill_parent"
                        android:layout_height="@dimen/dp45"
                        android:background="@drawable/edittext_bg"
                        android:hint="@string/employeelogin_form_password"
                        android:inputType="textPassword"
                        android:paddingLeft="@dimen/dp10"
                        android:paddingTop="@dimen/dp10"
                        android:paddingRight="@dimen/dp40"
                        android:paddingBottom="@dimen/dp10"
                        android:text=""
                        android:textColor="@color/postjob_bg"
                        android:textSize="@dimen/dp13" />

                    &lt;ImageView
                        android:id="@+id/show_pass_btn"
                        android:layout_width="@dimen/dp40"
                        android:layout_height="@dimen/dp40"
                        android:layout_alignParentRight="true"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="@dimen/dp5"
                        android:alpha=".5"
                        android:onClick="ShowHidePass"
                        android:padding="@dimen/dp5"
                        android:src="@drawable/show_password" />
                &lt;/RelativeLayout></code></pre>



<p>This is layout preview of Password Editext with Eye Icon On right</p>



<div class="wp-block-image"><figure class="aligncenter is-resized"><img src="https://www.maxester.com/blog/wp-content/uploads/2019/05/Show-Hide-Password-Editext-In-Andriod-1.png" alt="" class="wp-image-393" width="307" height="390" srcset="https://www.maxester.com/blog/wp-content/uploads/2019/05/Show-Hide-Password-Editext-In-Andriod-1.png 310w, https://www.maxester.com/blog/wp-content/uploads/2019/05/Show-Hide-Password-Editext-In-Andriod-1-236x300.png 236w" sizes="(max-width: 307px) 100vw, 307px" /></figure></div>



<p>In Imageview Tag XML we simply add Attribute android:onClick=&#8221;ShowHidePass&#8221; for calling onclick function  <br>ShowHidePass() directly in code</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>




<pre class="wp-block-code"><code>public void ShowHidePass(View view){

        if(view.getId()==R.id.show_pass_btn){

        if(edit_password.getTransformationMethod().equals(PasswordTransformationMethod.getInstance())){
        ((ImageView(view)).setImageResource(R.drawable.hide_password);

        //Show Password                 
        edit_password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
        }
        else{
        ((ImageView)(view)).setImageResource(R.drawable.show_password);

        //Hide Password
        edit_password.setTransformationMethod(PasswordTransformationMethod.getInstance());

        }
        }
        }</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/05/28/show-hide-password-in-edittext-in-android/">Show/Hide Password in EditText 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/05/28/show-hide-password-in-edittext-in-android/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PLACES API ACCESS NOT CONFIGURED</title>
		<link>https://www.maxester.com/blog/2019/02/22/places-api-access-not-configured/</link>
		<comments>https://www.maxester.com/blog/2019/02/22/places-api-access-not-configured/#respond</comments>
		<pubDate>Fri, 22 Feb 2019 14:11:07 +0000</pubDate>
		<dc:creator><![CDATA[Jony Chawla]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[IOS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blogs/?p=358</guid>
		<description><![CDATA[<p>Enable the google places API for Android in developer console. https://console.developers.google.com/apis/library</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/02/22/places-api-access-not-configured/">PLACES API ACCESS NOT CONFIGURED</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<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>Enable the google places API for Android in developer console.<br><br><a href="https://console.developers.google.com/apis/library" target="_blank" rel="noreferrer noopener" aria-label="https://console.developers.google.com/apis/library (opens in a new tab)">https://console.developers.google.com/apis/library</a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/02/22/places-api-access-not-configured/">PLACES API ACCESS NOT CONFIGURED</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/02/22/places-api-access-not-configured/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Failed to resolve: com.google.android.gms:play-services-places:16.0.0</title>
		<link>https://www.maxester.com/blog/2019/02/22/failed-to-resolve-com-google-android-gmsplay-services-places16-0-0/</link>
		<comments>https://www.maxester.com/blog/2019/02/22/failed-to-resolve-com-google-android-gmsplay-services-places16-0-0/#respond</comments>
		<pubDate>Fri, 22 Feb 2019 10:06:19 +0000</pubDate>
		<dc:creator><![CDATA[Jony Chawla]]></dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blogs/?p=310</guid>
		<description><![CDATA[<p>Just place google() before jcenter() In project build.gradle file or just copy and paste below build.gradle code in your project build.gradle file. And build project again see the problem is resolved. see build.grdle&#160;file If it says google() not found (not&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/02/22/failed-to-resolve-com-google-android-gmsplay-services-places16-0-0/" 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/02/22/failed-to-resolve-com-google-android-gmsplay-services-places16-0-0/">Failed to resolve: com.google.android.gms:play-services-places:16.0.0</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Just place google() before jcenter() In project build.gradle file or just copy and paste below build.gradle code in your project build.gradle file. And build project again see the problem is resolved.</p>



<p><em>see build.grdle&nbsp;file</em></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>




<pre class="wp-block-code"><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}</code></pre>



<p>If it says google() not found (not resolved or etc..) then replace google() with maven url see below.</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>




<pre class="wp-block-code"><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        maven {
            url "https://maven.google.com/"
        }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven {
            url "https://maven.google.com/"
        }
        jcenter()
    }
}</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/02/22/failed-to-resolve-com-google-android-gmsplay-services-places16-0-0/">Failed to resolve: com.google.android.gms:play-services-places:16.0.0</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/02/22/failed-to-resolve-com-google-android-gmsplay-services-places16-0-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
