<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"><channel><title>dreamlikehotels</title><description></description><managingEditor>noreply@blogger.com (Beverly Graham)</managingEditor><pubDate>Thu, 12 Oct 2023 03:35:26 -0700</pubDate><generator>Blogger http://www.blogger.com</generator><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">328</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">25</openSearch:itemsPerPage><link>https://dreamlikehotels.blogspot.com/</link><language>en-us</language><item><title>Get Start And End Of Week On Android</title><link>https://dreamlikehotels.blogspot.com/2023/10/get-start-and-end-of-week-on-android.html</link><category>Android</category><category>Date</category><category>Java</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Thu, 12 Oct 2023 03:34:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-8400491160217847801</guid><description>&lt;div class="question"&gt;I wonder how could I calculate start and end days of the current week ? I've found that this it not implemented in standard android libs or such lib as date4j. If there some easy a&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;It doesn't take much code to do this with date4j.
An example of calculating the first day of the week:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_0" class="hljs language-csharp"&gt;&lt;span class="hljs-function"&gt;&lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-keyword"&gt;void&lt;/span&gt;&lt;span class="hljs-title"&gt;firstDayOfThisWeek&lt;/span&gt;()&lt;/span&gt;{
    DateTime today = DateTime.today(TimeZone.getDefault()); 
    DateTime firstDayThisWeek = today; &lt;span class="hljs-comment"&gt;//start value &lt;/span&gt;&lt;span class="hljs-built_in"&gt;int&lt;/span&gt; todaysWeekday = today.getWeekDay();
    &lt;span class="hljs-built_in"&gt;int&lt;/span&gt; SUNDAY = &lt;span class="hljs-number"&gt;1&lt;/span&gt;;
    &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(todaysWeekday &amp;gt; SUNDAY){
      &lt;span class="hljs-built_in"&gt;int&lt;/span&gt; numDaysFromSunday = todaysWeekday - SUNDAY;
      firstDayThisWeek = today.minusDays(numDaysFromSunday);
    }
    System.&lt;span class="hljs-keyword"&gt;out&lt;/span&gt;.println(&lt;span class="hljs-string"&gt;"The first day of this week is : "&lt;/span&gt; + firstDayThisWeek);
  }
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_0')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;The above follows the convention that Sunday is the start of the week. In some jurisdictions, that convention doesn't apply, so you would need to change the code for such cases.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Maybe &lt;a rel="nofollow noreferrer noopener" href="https://developer.android.com/reference/android/util/MonthDisplayHelper.html#getWeekStartDay%28%29"&gt;MonthDisplayHelper&lt;/a&gt; could be of help for you.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;p&gt;Good luck!&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_3"&gt;Solution 3:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;This worked for me...&lt;/p&gt;&lt;pre&gt;&lt;code id="code_1" class="hljs language-php"&gt;Calendar cal = Calendar.getInstance();
&lt;span class="hljs-keyword"&gt;int&lt;/span&gt; year = cal.get(Calendar.YEAR);
cal.set(Calendar.DAY_OF_WEEK, cal.MONDAY);
&lt;span class="hljs-keyword"&gt;String&lt;/span&gt; firstWkDay = &lt;span class="hljs-keyword"&gt;String&lt;/span&gt;.valueOf(cal.getTime());
&lt;span class="hljs-comment"&gt;//cal.set(Calendar.DAY_OF_WEEK, cal.SUNDAY);&lt;/span&gt;
cal.add(Calendar.DAY_OF_WEEK, &lt;span class="hljs-number"&gt;6&lt;/span&gt;);
&lt;span class="hljs-keyword"&gt;String&lt;/span&gt; lastWkDay =  &lt;span class="hljs-keyword"&gt;String&lt;/span&gt;.valueOf(cal.getTime());
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_1')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;For last day of the week, you could use &lt;code&gt;cal.set(Calendar.DAY_OF_WEEK, cal.SUNDAY);&lt;/code&gt; but it returns previous sunday on some devices&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_4"&gt;Solution 4:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Try java.util.Calendar.getFirstDayOfWeek()... then it's easy to calculate the last day of week: &lt;a rel="nofollow noreferrer noopener" href="https://developer.android.com/reference/java/util/Calendar.html#getFirstDayOfWeek"&gt;http://developer.android.com/reference/java/util/Calendar.html#getFirstDayOfWeek&lt;/a&gt;()&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_5"&gt;Solution 5:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;This kind of date-time work is often easier using the &lt;a rel="nofollow noreferrer noopener" href="http://www.joda.org/joda-time/"&gt;Joda-Time&lt;/a&gt; 2.3 library.&lt;/p&gt;&lt;p&gt;Taken from &lt;a rel="nofollow noreferrer noopener" href="https://stackoverflow.com/a/4760468/642706"&gt;this answer&lt;/a&gt; to a similar question.&lt;/p&gt;&lt;pre&gt;&lt;code id="code_3" class="hljs language-csharp"&gt;LocalDate now = &lt;span class="hljs-keyword"&gt;new&lt;/span&gt; LocalDate();
System.&lt;span class="hljs-keyword"&gt;out&lt;/span&gt;.println( now.withDayOfWeek(DateTimeConstants.MONDAY) );
System.&lt;span class="hljs-keyword"&gt;out&lt;/span&gt;.println( now.withDayOfWeek(DateTimeConstants.SUNDAY) ); 
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_3')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;You can call &lt;a rel="nofollow noreferrer noopener" href="http://www.joda.org/joda-time/apidocs/org/joda/time/base/AbstractPartial.html#isBefore%28org.joda.time.ReadablePartial%29"&gt;isBefore&lt;/a&gt;/&lt;a rel="nofollow noreferrer noopener" href="http://www.joda.org/joda-time/apidocs/org/joda/time/base/AbstractPartial.html#isAfter%28org.joda.time.ReadablePartial%29"&gt;isAfter&lt;/a&gt; and &lt;a rel="nofollow noreferrer noopener" href="http://www.joda.org/joda-time/apidocs/org/joda/time/LocalDate.html#minusWeeks%28int%29"&gt;minusWeeks&lt;/a&gt;/&lt;a rel="nofollow noreferrer noopener" href="http://www.joda.org/joda-time/apidocs/org/joda/time/LocalDate.html#plusWeeks%28int%29"&gt;plusWeeks&lt;/a&gt; to get past/future values.&lt;/p&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Why Is The Google Play Billing Library Not Shown Up In The Sdk Manager?</title><link>https://dreamlikehotels.blogspot.com/2023/10/why-is-google-play-billing-library-not.html</link><category>Android</category><category>In App Billing</category><category>In App Purchase</category><category>Play Billing Library</category><category>Sdk</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Thu, 12 Oct 2023 02:03:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-2726280640783674376</guid><description>&lt;div class="question"&gt;I'd like to make an android application with in app purchases, I read often that I have to download the Google Play Billing Library from SDK Manager (e.g. http://www.techotopia.com&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Checking the &lt;a rel="nofollow noreferrer noopener" href="https://android-developers.googleblog.com/2017/09/google-play-billing-library-10-released.html"&gt;offical blog:&lt;/a&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Play Billing Library is available through Maven repository&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Just add:&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;pre&gt;&lt;code id="code_0" class="hljs language-python"&gt;dependencies {
    ...
    &lt;span class="hljs-built_in"&gt;compile&lt;/span&gt;&lt;span class="hljs-string"&gt;'com.android.billingclient:billing:1.0'&lt;/span&gt;
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_0')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;You can find more details about the library in the &lt;a rel="nofollow noreferrer noopener" href="https://developer.android.com/google/play/billing/billing_library.html"&gt;official doc.&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;You are referring to the old Google Play Billing library (v3), which if you really want to implement you can find it as part of the TrivialDrive demo app below. You can copy parts that you need (aidl, util) and change your app as per demo sample.
&lt;a rel="nofollow noreferrer noopener" href="https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive"&gt;https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive&lt;/a&gt;&lt;/p&gt;&lt;p&gt;~~~&lt;/p&gt;&lt;p&gt;The new version of Play Billing library v1.0 is covered by Garbriele Mariotti's answer (above). If you happen to use a platform that doesn't support Maven, Gradle or AARs I will be making it available soon (UPDAT to follow) as an Eclipse based project that you may be able to import into your IDE the same way you wanted to import the old library downloaded through SDK Manager (which probably doesn't include it anymore as they dev team doens't want you to use it anymore).&lt;/p&gt;&lt;p&gt;If you just want to download it and look at it, you can download it from here: 
&lt;a rel="nofollow noreferrer noopener" href="https://google.bintray.com/play-billing/com/android/billingclient/billing/1.0/"&gt;https://google.bintray.com/play-billing/com/android/billingclient/billing/1.0/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;~~~&lt;/p&gt;&lt;p&gt;Google Play Billing 1.0 library for Eclipse available from here:
&lt;a rel="nofollow noreferrer noopener" href="https://github.com/dandar3/android-google-services-billing/tree/1.0"&gt;https://github.com/dandar3/android-google-services-billing/tree/1.0&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_3"&gt;Solution 3:

&lt;/h2&gt;&lt;div class="answer-desc" style="height: auto !important;"&gt;&lt;p&gt;Play Billing Library is available through Maven repository.&lt;/p&gt;&lt;p&gt;Add in top level build.gradle file&lt;/p&gt;&lt;pre&gt;&lt;code id="code_1" class="hljs language-markdown"&gt;&lt;span class="hljs-code"&gt;    buildscript {
&lt;/span&gt;&lt;span class="hljs-code"&gt;    mavenCentral()     
    }
&lt;/span&gt;&lt;span class="hljs-code"&gt;    ................
    allprojects {
&lt;/span&gt;&lt;span class="hljs-code"&gt;    repositories {
&lt;/span&gt;&lt;span class="hljs-code"&gt;    mavenCentral()
       }
    }
&lt;/span&gt;&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_1')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Add dependency into module level build.gradle file.&lt;/p&gt;&lt;pre&gt;&lt;code id="code_2" class="hljs language-bash"&gt;   implementation &lt;span class="hljs-string"&gt;'com.android.billingclient:billing:1.0'&lt;/span&gt;&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_2')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Then After implement in app billing sample example into your project.&lt;/p&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="https://codelabs.developers.google.com/codelabs/play-billing-codelab/#0"&gt;https://codelabs.developers.google.com/codelabs/play-billing-codelab/#0&lt;/a&gt;&lt;/p&gt;&lt;p&gt;This link you can find sample code of in app billing example of google&lt;/p&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="https://github.com/googlesamples/android-play-billing"&gt;https://github.com/googlesamples/android-play-billing&lt;/a&gt;&lt;/p&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Android Set Default Keyboard</title><link>https://dreamlikehotels.blogspot.com/2023/10/android-set-default-keyboard.html</link><category>Android</category><category>Keyboard</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Thu, 12 Oct 2023 01:05:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-1470671192951339497</guid><description>&lt;div class="question"&gt;i want to set scandinavian keyboard as default keyboard on an android device and i want to do this by code. So i try with InputMethodManager : InputMethodManager mng = (InputMethod&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;blockquote&gt;&lt;p&gt;Hi everybody, i want to set scandinavian keyboard as default keyboard on an android device and i want to do this by code.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;You cannot modify the "default keyboard on an android device" via code from a standard SDK application. The user can choose their own keyboard and locale via the Settings application. You can send users to the proper Settings screen via &lt;code&gt;ACTION_INPUT_METHOD_SETTINGS&lt;/code&gt; and &lt;code&gt;ACTION_LOCALE_SETTINGS&lt;/code&gt;, which are activity &lt;code&gt;Intent&lt;/code&gt; actions defined on &lt;code&gt;android.provider.Settings&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;Applications that are part of the device firmware can use &lt;code&gt;DEFAULT_INPUT_METHOD&lt;/code&gt; on &lt;code&gt;android.provider.Settings.Secure&lt;/code&gt;.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How To Show Icons In Actionbar Overflow Menu?</title><link>https://dreamlikehotels.blogspot.com/2023/10/how-to-show-icons-in-actionbar-overflow.html</link><category>Actionbarsherlock</category><category>Android</category><category>Android Layout</category><category>Android Ui</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Thu, 12 Oct 2023 00:28:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-2612946195077494002</guid><description>&lt;div class="question"&gt;I want to display icon in addition to menu item title in overflow dropdown menu. Is is possible?&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;put your menu with property &lt;code&gt;android:showAsAction="always"&lt;/code&gt; and in xml file of menu add sub menus under that your menu like this&lt;/p&gt;&lt;pre&gt;&lt;code id="code_1" class="hljs language-xml"&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;item&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:id&lt;/span&gt;=&lt;span class="hljs-string"&gt;"@+id/mainMenu"&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:icon&lt;/span&gt;=&lt;span class="hljs-string"&gt;"@drawable/launcher"&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:showAsAction&lt;/span&gt;=&lt;span class="hljs-string"&gt;"always"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;menu&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;item&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:id&lt;/span&gt;=&lt;span class="hljs-string"&gt;"@+id/menu_logout"&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:icon&lt;/span&gt;=&lt;span class="hljs-string"&gt;"@drawable/log_out"&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:title&lt;/span&gt;=&lt;span class="hljs-string"&gt;"logout"&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;/&lt;span class="hljs-name"&gt;menu&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;/&lt;span class="hljs-name"&gt;item&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_1')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;this will show the icons in menus&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;There is actually an easy way to achieve it, since what you see is actually a TextView, so you set a span , for example:&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;pre&gt;&lt;code id="code_2" class="hljs language-cpp"&gt;&lt;span class="hljs-keyword"&gt;final&lt;/span&gt; MenuItem menuItem=...
&lt;span class="hljs-keyword"&gt;final&lt;/span&gt; ImageSpan imageSpan=&lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-built_in"&gt;ImageSpan&lt;/span&gt;(&lt;span class="hljs-keyword"&gt;this&lt;/span&gt;,R.drawable.ic_stat_app_icon);
&lt;span class="hljs-keyword"&gt;final&lt;/span&gt; CharSequence title=&lt;span class="hljs-string"&gt;" "&lt;/span&gt;+menuItem.&lt;span class="hljs-built_in"&gt;getTitle&lt;/span&gt;();
&lt;span class="hljs-keyword"&gt;final&lt;/span&gt; SpannableString spannableString=&lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-built_in"&gt;SpannableString&lt;/span&gt;(title);
spannableString.&lt;span class="hljs-built_in"&gt;setSpan&lt;/span&gt;(imageSpan,&lt;span class="hljs-number"&gt;0&lt;/span&gt;,&lt;span class="hljs-number"&gt;1&lt;/span&gt;,&lt;span class="hljs-number"&gt;0&lt;/span&gt;);
menuItem.&lt;span class="hljs-built_in"&gt;setTitle&lt;/span&gt;(spannableString);
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_2')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;This will put an icon at the beginning of the menu item, right before its original text.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_3"&gt;Solution 3:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Hate answers like this but I am not good enough to give a better answer. &lt;/p&gt;&lt;p&gt;The icon for the overflow items for menu is the submenu2 line "subMenu2Item.setIcon(R.drawable.ic_launcher);"
just replace ic_launcher with your icon file (in the res drawable directory of your program).
Hope you mean using ActionBarSherlock.&lt;/p&gt;&lt;p&gt;The line subMenu1Item.setIcon(R.drawable.ic_launcher); is for the ActionBar icon for the Menu button at the top.&lt;/p&gt;&lt;p&gt;in response to "This is not possible by design"&lt;/p&gt;&lt;p&gt;Many thanks to Google for attempting to take over the world and letting us ride it's coat tails, BUT ... Google is too inconsistent to be grumpy over inconsistencies.
It would be nice if Google could make an example for EVERY "set" of APIs they offer. There are API references to code, but no example about how to put them together, A whole completely working example that can be run as an APK is all I want. I can trick it out from there. If they can take the time to write the APK how much harder would it be to code a little example on a standard template? For 30% of everything it's not much to ask for.
I had this same argument with Microsoft back in the day and it didn't happened then either. And thus and so you get stackoverflow. : ) Its a shame it takes some guy (rock on Jake Wharton) working on his own to do a better job with a backwards compatible Action bar than Google can come up with its ridiculous Action Bar Patch thingy.&lt;/p&gt;&lt;pre&gt;&lt;code id="code_3" class="hljs language-java"&gt;&lt;span class="hljs-meta"&gt;@Override&lt;/span&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-type"&gt;boolean&lt;/span&gt;&lt;span class="hljs-title function_"&gt;onCreateOptionsMenu&lt;/span&gt;&lt;span class="hljs-params"&gt;(com.actionbarsherlock.view.Menu menu)&lt;/span&gt; {

    &lt;span class="hljs-type"&gt;SubMenu&lt;/span&gt;&lt;span class="hljs-variable"&gt;subMenu1&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt; menu.addSubMenu(&lt;span class="hljs-string"&gt;"Action Item"&lt;/span&gt;);
    subMenu1.add(&lt;span class="hljs-string"&gt;"Help"&lt;/span&gt;);
    subMenu1.add(&lt;span class="hljs-string"&gt;"About"&lt;/span&gt;);

    &lt;span class="hljs-type"&gt;MenuItem&lt;/span&gt;&lt;span class="hljs-variable"&gt;subMenu1Item&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt; subMenu1.getItem();
    subMenu1Item.setIcon(R.drawable.ic_launcher);
    subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

    &lt;span class="hljs-type"&gt;SubMenu&lt;/span&gt;&lt;span class="hljs-variable"&gt;subMenu2&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt; menu.addSubMenu(&lt;span class="hljs-string"&gt;"All Options"&lt;/span&gt;);
    subMenu2.add(&lt;span class="hljs-string"&gt;"Help"&lt;/span&gt;);
    subMenu2.add(&lt;span class="hljs-string"&gt;"About"&lt;/span&gt;);

    &lt;span class="hljs-type"&gt;MenuItem&lt;/span&gt;&lt;span class="hljs-variable"&gt;subMenu2Item&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt; subMenu2.getItem();
    subMenu2Item.setIcon(R.drawable.ic_launcher);

    &lt;span class="hljs-keyword"&gt;return&lt;/span&gt;&lt;span class="hljs-built_in"&gt;super&lt;/span&gt;.onCreateOptionsMenu(menu);
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_3')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="solution_4"&gt;Solution 4:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;pre&gt;&lt;code id="code_4" class="hljs language-java"&gt;&lt;span class="hljs-meta"&gt;@Override&lt;/span&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-type"&gt;boolean&lt;/span&gt;&lt;span class="hljs-title function_"&gt;onMenuOpened&lt;/span&gt;&lt;span class="hljs-params"&gt;(&lt;span class="hljs-type"&gt;int&lt;/span&gt; featureId, Menu menu)&lt;/span&gt;
{
    &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(featureId == Window.FEATURE_ACTION_BAR &amp;amp;&amp;amp; menu != &lt;span class="hljs-literal"&gt;null&lt;/span&gt;){
        &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(menu.getClass().getSimpleName().equals(&lt;span class="hljs-string"&gt;"MenuBuilder"&lt;/span&gt;)){
            &lt;span class="hljs-keyword"&gt;try&lt;/span&gt;{
                &lt;span class="hljs-type"&gt;Method&lt;/span&gt;&lt;span class="hljs-variable"&gt;m&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt; menu.getClass().getDeclaredMethod(
                    &lt;span class="hljs-string"&gt;"setOptionalIconsVisible"&lt;/span&gt;, Boolean.TYPE);
                m.setAccessible(&lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
                m.invoke(menu, &lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
            }
            &lt;span class="hljs-keyword"&gt;catch&lt;/span&gt;(NoSuchMethodException e){
                Log.e(TAG, &lt;span class="hljs-string"&gt;"onMenuOpened"&lt;/span&gt;, e);
            }
            &lt;span class="hljs-keyword"&gt;catch&lt;/span&gt;(Exception e){
                &lt;span class="hljs-keyword"&gt;throw&lt;/span&gt;&lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-title class_"&gt;RuntimeException&lt;/span&gt;(e);
            }
        }
    }
    &lt;span class="hljs-keyword"&gt;return&lt;/span&gt;&lt;span class="hljs-built_in"&gt;super&lt;/span&gt;.onMenuOpened(featureId, menu);
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_4')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Reference : &lt;a rel="nofollow noreferrer noopener" href="https://stackoverflow.com/questions/18374183/how-to-show-icons-in-overflow-menu-in-actionbar"&gt;How To show icons in Overflow menu in ActionBar&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_5"&gt;Solution 5:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Maybe you have the same problem as me. So for me solution was easy if you are using AppCompat just dont use this property:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_5" class="hljs language-vbnet"&gt;&lt;span class="hljs-symbol"&gt;android:&lt;/span&gt;showAsAction=&lt;span class="hljs-string"&gt;"always"&lt;/span&gt;&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_5')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;instead use it like this:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_6" class="hljs language-xml"&gt;&lt;span class="hljs-meta"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;menu&lt;/span&gt;&lt;span class="hljs-attr"&gt;xmlns:android&lt;/span&gt;=&lt;span class="hljs-string"&gt;"http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;span class="hljs-attr"&gt;xmlns:app&lt;/span&gt;=&lt;span class="hljs-string"&gt;"http://schemas.android.com/apk/res-auto"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;item&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:id&lt;/span&gt;=&lt;span class="hljs-string"&gt;"@+id/option"&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:title&lt;/span&gt;=&lt;span class="hljs-string"&gt;"@string/option"&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:icon&lt;/span&gt;=&lt;span class="hljs-string"&gt;"@drawable/option"&lt;/span&gt;&lt;span class="hljs-attr"&gt;app:showAsAction&lt;/span&gt;=&lt;span class="hljs-string"&gt;"always"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;/&lt;span class="hljs-name"&gt;item&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;/&lt;span class="hljs-name"&gt;menu&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_6')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;There is difference in aditional &lt;strong&gt;xmlns:app&lt;/strong&gt; and &lt;strong&gt;showAsAction&lt;/strong&gt; is property of &lt;strong&gt;app&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;Hope it helps someone.&lt;/p&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Textappearance.a Inherits From Textappearance.a.b Doesn't Cause A Circular Reference In Android Styles?</title><link>https://dreamlikehotels.blogspot.com/2023/10/textappearancea-inherits-from.html</link><category>Android</category><category>Inheritance</category><category>Styles</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 22:36:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-577301274988325638</guid><description>&lt;div class="question"&gt;I know that   we have not to use parent attribute. We prefix one style to another   style separating by a period(.)  so in this style, does it have a circular inheritance?   &lt;st&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Technically As per Android Documentation I dont think this is possible,
Because this will lead to duplication of style, If you refer to same as Diamond Problem it will be one of those, also android prevents you from inheriting from more than one style.&lt;/p&gt;&lt;p&gt;Further Imagine if you have one attribute which is defined in style A also in Style B, it will be a problem at compile time that which attribute to choose from both.&lt;/p&gt;&lt;p&gt;For More Details please refer to android documentation&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="https://developer.android.com/guide/topics/ui/look-and-feel/themes"&gt;https://developer.android.com/guide/topics/ui/look-and-feel/themes&lt;/a&gt;&lt;/p&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Android 5.1 Push Notification Icon Is Blank</title><link>https://dreamlikehotels.blogspot.com/2023/10/android-51-push-notification-icon-is.html</link><category>Android</category><category>Parse Platform</category><category>Push Notification</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 19:15:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-6651761484061559945</guid><description>&lt;div class="question"&gt;When using Parse for push notifications our app always displayed the application's launcher icon. In the latest Android 5.1 version, the icon appears to be blank (a white square).&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;You must use a transparent and white icon under Android Lollipop 5.0 or greater. You can extend ParsePushBroadcastReceiver class and override the two methods to get your notification icon compatible with these Android APIs.&lt;/p&gt;&lt;pre&gt;&lt;code id="code_0" class="hljs language-typescript"&gt;&lt;span class="hljs-meta"&gt;@Override&lt;/span&gt;&lt;span class="hljs-keyword"&gt;protected&lt;/span&gt; int &lt;span class="hljs-title function_"&gt;getSmallIconId&lt;/span&gt;(&lt;span class="hljs-params"&gt;Context context, Intent intent&lt;/span&gt;) {
    &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; R.&lt;span class="hljs-property"&gt;drawable&lt;/span&gt;.&lt;span class="hljs-property"&gt;your_notifiation_icon&lt;/span&gt;;
}

&lt;span class="hljs-meta"&gt;@Override&lt;/span&gt;&lt;span class="hljs-keyword"&gt;protected&lt;/span&gt;&lt;span class="hljs-title class_"&gt;Bitmap&lt;/span&gt;&lt;span class="hljs-title function_"&gt;getLargeIcon&lt;/span&gt;(&lt;span class="hljs-params"&gt;Context context, Intent intent&lt;/span&gt;) {
    &lt;span class="hljs-keyword"&gt;return&lt;/span&gt;&lt;span class="hljs-title class_"&gt;BitmapFactory&lt;/span&gt;.&lt;span class="hljs-title function_"&gt;decodeResource&lt;/span&gt;(context.&lt;span class="hljs-title function_"&gt;getResources&lt;/span&gt;(), R.&lt;span class="hljs-property"&gt;drawable&lt;/span&gt;.&lt;span class="hljs-property"&gt;your_notifiation_icon&lt;/span&gt;);
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_0')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Remember to customize your code to support Lollipop and previous APIs.&lt;/p&gt;&lt;pre&gt;&lt;code id="code_1" class="hljs language-kotlin"&gt;&lt;span class="hljs-keyword"&gt;if&lt;/span&gt; (android.os.Build.VERSION.SDK_INT &amp;gt;= android.os.Build.VERSION_CODES.LOLLIPOP) {
        &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; BitmapFactory.decodeResource(context.getResources(), R.drawable.your_notifiation_icon_lollipop);
    }
    &lt;span class="hljs-keyword"&gt;else&lt;/span&gt;{
        &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; BitmapFactory.decodeResource(context.getResources(), R.drawable.your_notifiation_icon);
    }
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_1')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;It is not related to Parse or push nitification, but just how Android 5.0 handles notification icons.
See this releated question for details:
&lt;a rel="nofollow noreferrer noopener" href="https://stackoverflow.com/questions/28387602/notification-bar-icon-turns-white-in-android-5-lollipop"&gt;Notification bar icon turns white in Android 5 Lollipop&lt;/a&gt;&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;/div&gt;&lt;h2 id="solution_3"&gt;Solution 3:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Although @Pelanes has the correct answer (and should be accepted), here's what I did. Note that the &lt;a rel="nofollow noreferrer noopener" href="https://www.parse.com/docs/android/api/com/parse/ParsePushBroadcastReceiver.html#getSmallIconId(android.content.Context,%20android.content.Intent)"&gt;Parse docs for getSmallIconId&lt;/a&gt; state the following:&lt;/p&gt;&lt;p&gt;&lt;code&gt;Retrieves the small icon to be used in a Notification. The default implementation uses the icon specified by com.parse.push.notification_icon meta-data in your AndroidManifest.xml with a fallback to the launcher icon for this package. To conform to Android style guides, it is highly recommended that developers specify an explicit push icon.&lt;/code&gt;&lt;/p&gt;&lt;p&gt;So it is not entirely necessary to override the getSmallIconId() and getLargeIcon() methods. &lt;/p&gt;&lt;p&gt;What I did to solve the problem was I just made a copy of my icon, punched transparent "holes" into the icon, and set the &lt;code&gt;com.parse.push.notification_icon&lt;/code&gt; meta-data in my manifest to point to this new icon. &lt;/p&gt;&lt;p&gt;For Android 5.0, it is required for your notification icon to be white and transparent, as others have mentioned. So creating the separate icon is necessary. One line in the manifest and one new drawable file is all it takes.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_4"&gt;Solution 4:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Try this code.&lt;/p&gt;&lt;pre&gt;&lt;code id="code_4" class="hljs language-java"&gt;&lt;span class="hljs-type"&gt;Bitmap&lt;/span&gt;&lt;span class="hljs-variable"&gt;largeIcon&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt; BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);

NotificationCompat.&lt;span class="hljs-type"&gt;Builder&lt;/span&gt;&lt;span class="hljs-variable"&gt;builder&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt;&lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-title class_"&gt;NotificationCompat&lt;/span&gt;.Builder(context)
                .setSmallIcon(R.drawable.ic_launcher)
                .setLargeIcon(largeIcon)
                .setContentText(data)
                .setContentTitle(&lt;span class="hljs-string"&gt;"Notification from Parse"&lt;/span&gt;)
                .setContentIntent(pendingIntent);
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_4')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Actionbar Like Evernote - Up Button And Tabs In One Row On Top With Menu Actions At Bottom</title><link>https://dreamlikehotels.blogspot.com/2023/10/actionbar-like-evernote-up-button-and.html</link><category>Actionbarsherlock</category><category>Android</category><category>Android Actionbar</category><category>Android Layout</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 18:21:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-4114408831272593631</guid><description>&lt;div class="question"&gt;I have app which has actionbar containing  1) up button which opens side bar menu for navigation just like google plus  2) 2 action menu buttons  3) 2 tabs implemented via view pag&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;//enabling embedded tabs&lt;/p&gt;&lt;pre&gt;&lt;code id="code_0" class="hljs language-php"&gt;&lt;span class="hljs-comment"&gt;//pre-ICS&lt;/span&gt;&lt;span class="hljs-keyword"&gt;if&lt;/span&gt; (actionBarSherlock &lt;span class="hljs-keyword"&gt;instanceof&lt;/span&gt; ActionBarImpl) {
    enableEmbeddedTabs(actionBarSherlock);

&lt;span class="hljs-comment"&gt;//ICS and forward&lt;/span&gt;
} &lt;span class="hljs-keyword"&gt;else&lt;/span&gt;&lt;span class="hljs-keyword"&gt;if&lt;/span&gt; (actionBarSherlock &lt;span class="hljs-keyword"&gt;instanceof&lt;/span&gt; ActionBarWrapper) {
    &lt;span class="hljs-keyword"&gt;try&lt;/span&gt; {
        Field actionBarField = actionBarSherlock.getClass().getDeclaredField(&lt;span class="hljs-string"&gt;"mActionBar"&lt;/span&gt;);
        actionBarField.setAccessible(&lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
        enableEmbeddedTabs(actionBarField.get(actionBarSherlock));
    } &lt;span class="hljs-keyword"&gt;catch&lt;/span&gt; (&lt;span class="hljs-built_in"&gt;Exception&lt;/span&gt; e) {
        Log.e(TAG, &lt;span class="hljs-string"&gt;"Error enabling embedded tabs"&lt;/span&gt;, e);
    }
}

&lt;span class="hljs-comment"&gt;//helper method&lt;/span&gt;&lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-keyword"&gt;void&lt;/span&gt; enableEmbeddedTabs(&lt;span class="hljs-keyword"&gt;Object&lt;/span&gt; actionBar) {
    &lt;span class="hljs-keyword"&gt;try&lt;/span&gt; {
        Method setHasEmbeddedTabsMethod = actionBar.getClass().getDeclaredMethod(&lt;span class="hljs-string"&gt;"setHasEmbeddedTabs"&lt;/span&gt;, &lt;span class="hljs-keyword"&gt;boolean&lt;/span&gt;.&lt;span class="hljs-keyword"&gt;class&lt;/span&gt;);
        setHasEmbeddedTabsMethod.setAccessible(&lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
        setHasEmbeddedTabsMethod.invoke(actionBar, &lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
    } &lt;span class="hljs-keyword"&gt;catch&lt;/span&gt; (&lt;span class="hljs-built_in"&gt;Exception&lt;/span&gt; e) {
        Log.e(TAG, &lt;span class="hljs-string"&gt;"Error marking actionbar embedded"&lt;/span&gt;, e);
    }
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_0')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;for further reference -
&lt;a rel="nofollow noreferrer noopener" href="https://groups.google.com/forum/#!topic/actionbarsherlock/hmmB1JqDeCk"&gt;https://groups.google.com/forum/#!topic/actionbarsherlock/hmmB1JqDeCk&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How To Kill Cocos2d-x Test App</title><link>https://dreamlikehotels.blogspot.com/2023/10/how-to-kill-cocos2d-x-test-app.html</link><category>Android</category><category>C++</category><category>Cocos2d X</category><category>Integration Testing</category><category>Testing</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 16:57:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-4154918756686809097</guid><description>&lt;div class="question"&gt;We are creating an SDK that is used in Cocos2d-x games (on Android/iOS). As part of development, we have setup a test framework for running various tests on a real device (Android&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;The sample project HelloCpp has an exit button in its example. Look at HelloWorldScene.cpp and at the function call back menuCloseCallback (function might vary a bit based on version of cocos2dx you are on)&lt;/p&gt;&lt;pre&gt;&lt;code id="code_0" class="hljs language-cpp"&gt;&lt;span class="hljs-function"&gt;&lt;span class="hljs-type"&gt;void&lt;/span&gt;&lt;span class="hljs-title"&gt;HelloWorld::menuCloseCallback&lt;/span&gt;&lt;span class="hljs-params"&gt;(CCObject* pSender)&lt;/span&gt;&lt;/span&gt;{
&lt;span class="hljs-meta"&gt;#&lt;span class="hljs-keyword"&gt;if&lt;/span&gt; (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)&lt;/span&gt;&lt;span class="hljs-built_in"&gt;CCMessageBox&lt;/span&gt;(&lt;span class="hljs-string"&gt;"You pressed the close button. Windows Store Apps do not implement a close button."&lt;/span&gt;,&lt;span class="hljs-string"&gt;"Alert"&lt;/span&gt;);
&lt;span class="hljs-meta"&gt;#&lt;span class="hljs-keyword"&gt;else&lt;/span&gt;&lt;/span&gt;
    CCDirector::&lt;span class="hljs-built_in"&gt;sharedDirector&lt;/span&gt;()-&amp;gt;&lt;span class="hljs-built_in"&gt;end&lt;/span&gt;();
&lt;span class="hljs-meta"&gt;#&lt;span class="hljs-keyword"&gt;if&lt;/span&gt; (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)&lt;/span&gt;&lt;span class="hljs-built_in"&gt;exit&lt;/span&gt;(&lt;span class="hljs-number"&gt;0&lt;/span&gt;);
&lt;span class="hljs-meta"&gt;#&lt;span class="hljs-keyword"&gt;endif&lt;/span&gt;&lt;/span&gt;&lt;span class="hljs-meta"&gt;#&lt;span class="hljs-keyword"&gt;endif&lt;/span&gt;&lt;/span&gt;
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_0')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;For android the answer would be CCDirector::sharedDirector()-&amp;gt;end();&lt;/p&gt;&lt;p&gt;Note that I don't think Apple will approve you if your app calls exit(0).&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How To Change Built-in C/c++ Paths Pointing To A Deleted Android-ndk-r9 Installation?</title><link>https://dreamlikehotels.blogspot.com/2023/10/how-to-change-built-in-cc-paths.html</link><category>Adt</category><category>Android</category><category>Android Ndk</category><category>Eclipse</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 15:42:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-6454880485155316793</guid><description>&lt;div class="question"&gt;I recently upgraded my NDK from android-ndk-r9 to android-ndk-r10 (r10d to be exact). Eclipse is 4.4 Luna (Luna Service Release 1 (4.4.1); Build id: 20140925-1800). Eclipse is full&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;blockquote&gt;&lt;p&gt;Where is the setting coming from?&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;It appears the information is held in the project's &lt;code&gt;pathInfo&lt;/code&gt; file. Below, the project is a sample JNI project called AndroidPrng.&lt;/p&gt;&lt;pre&gt;&lt;code id="code_1" class="hljs language-bash"&gt;$ &lt;span class="hljs-built_in"&gt;cat&lt;/span&gt; /Users/jww/Eclipse/.metadata/.plugins/com.android.ide.eclipse.ndk/AndroidPrng.pathInfo 
t,1421045575000
i,/opt/android-ndk-r9/sources/cxx-stl/stlport/stlport
i,/usr/local/cryptopp/android-armeabi/include
i,/opt/android-ndk-r9/sources/cxx-stl/system/include
i,/usr/local/cryptopp/android-armeabi/include/cryptopp
i,jni
i,/opt/android-ndk-r9/platforms/android-14/arch-arm/usr/include
i,/usr/local/cryptopp/android-x86/include
i,/usr/local/cryptopp/android-x86/include/cryptopp
i,/opt/android-ndk-r9/platforms/android-14/arch-x86/usr/include
i,/usr/local/cryptopp/android-mips/include
i,/usr/local/cryptopp/android-mips/include/cryptopp
i,/usr/local/cryptopp/android-armeabi-v7a/include
i,/usr/local/cryptopp/android-armeabi-v7a/include/cryptopp
i,/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/include
i,/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/include-fixed
i,/opt/android-ndk-r9/platforms/android-14/arch-mips/usr/include
d,__STDC__,1
d,__INT64_MAX__,9223372036854775807LL
d,__LDBL_HAS_QUIET_NAN__,1
d,__WINT_TYPE__,unsigned int
d,__ORDER_LITTLE_ENDIAN__,1234
d,__DEC64_MAX_EXP__,385
d,__UINT_LEAST32_TYPE__,unsigned int
d,__UINT_FAST64_TYPE__,long long unsigned int
d,__GXX_WEAK__,1
...
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_1')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;hr&gt;&lt;blockquote&gt;&lt;p&gt;I've grepped the following directories ... &lt;em&gt;"My Eclipse workspace, ~/.eclipse, "&lt;/em&gt; ...&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;/blockquote&gt;&lt;p&gt;There were two problems here. First, the project is located on my desktop, and not my workspace directory. Second, the 100's of entries in the log files under &lt;code&gt;org.eclipse.cdt.ui&lt;/code&gt; drowned out the entries 15 entries for &lt;code&gt;com.android.ide.eclipse.ndk&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;So, before you grep, perform:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_4" class="hljs language-bash"&gt;&lt;span class="hljs-built_in"&gt;rm&lt;/span&gt; Users/jww/Eclipse/.metadata/.plugins/org.eclipse.cdt.ui/*.&lt;span class="hljs-built_in"&gt;log&lt;/span&gt;&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_4')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;That will produce manageable grep results.&lt;/p&gt;&lt;hr&gt;&lt;blockquote&gt;&lt;p&gt;And how do I change it?&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Exercise left to the reader.&lt;/p&gt;&lt;p&gt;You can edit by hand; or you can delete it and Eclipse will recreate it with the new NDK-related paths.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;OP probably figured this out already but adding this here just for future reference.&lt;/p&gt;&lt;p&gt;Eclipse (currently) has issues with the r10d version (see the related discussion in &lt;a rel="nofollow noreferrer noopener" href="https://stackoverflow.com/a/28108753/1591421"&gt;https://stackoverflow.com/a/28108753/1591421&lt;/a&gt;). First, if possible one should rollback to an earlier version of the Android NDK (e.g. r10c seems to work just fine) and then make Eclipse point to the newly installed version of the NDK: &lt;strong&gt;Preferences&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Android&lt;/strong&gt; -&amp;gt; &lt;strong&gt;NDK&lt;/strong&gt; -&amp;gt; &lt;strong&gt;NDK Location&lt;/strong&gt;. To let Eclipse pick up these changes the project needs to be deleted from the workspace and then added back (at least I had to). After the project has been re-imported one should see the NDK paths updated: &lt;strong&gt;Project&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Properties&lt;/strong&gt; -&amp;gt; &lt;strong&gt;C/C++ General&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Paths and Symbols&lt;/strong&gt;. Rebuilding the C/C++ Index (&lt;strong&gt;Project&lt;/strong&gt; -&amp;gt; &lt;strong&gt;C/C++ Index&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Rebuild&lt;/strong&gt;) won't hurt either :)&lt;/p&gt;&lt;/div&gt; 


</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How To Make Draw Path Smooth While Drawing With Variable Width Stroke</title><link>https://dreamlikehotels.blogspot.com/2023/10/how-to-make-draw-path-smooth-while.html</link><category>Android</category><category>Android Canvas</category><category>Java</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 15:15:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-5348727038547073792</guid><description>&lt;div class="question"&gt;I created a sample drawing app where the user can draw using variable width stroke, So far drawing a path with variable stroke is working, but the lines drawn are not smooth. The c&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Instead of jumping immediately to a new stroke width when you detect a change, you could set a target and interpolate toward it until you reach it. Your &lt;code&gt;mStrokes&lt;/code&gt; would need to be &lt;code&gt;Float&lt;/code&gt;s instead of &lt;code&gt;Integer&lt;/code&gt;s.&lt;/p&gt;&lt;pre&gt;&lt;code id="code_3" class="hljs language-cpp"&gt;&lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-type"&gt;static&lt;/span&gt;&lt;span class="hljs-keyword"&gt;final&lt;/span&gt;&lt;span class="hljs-type"&gt;float&lt;/span&gt; STROKE_DELTA = &lt;span class="hljs-number"&gt;0.0001f&lt;/span&gt;; &lt;span class="hljs-comment"&gt;// for float comparison&lt;/span&gt;&lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-type"&gt;static&lt;/span&gt;&lt;span class="hljs-keyword"&gt;final&lt;/span&gt;&lt;span class="hljs-type"&gt;float&lt;/span&gt; STROKE_INCREMENT = &lt;span class="hljs-number"&gt;0.01f&lt;/span&gt;; &lt;span class="hljs-comment"&gt;// amount to interpolate&lt;/span&gt;&lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-type"&gt;float&lt;/span&gt; currentStroke = STROKE_WIDTH;
&lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-type"&gt;float&lt;/span&gt; targetStroke = STROKE_WIDTH;
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_3')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Where you currently create a new path for a new stroke width, do something like this:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_4" class="hljs language-javascript"&gt;&lt;span class="hljs-comment"&gt;// if current not roughly equal to target&lt;/span&gt;&lt;span class="hljs-keyword"&gt;if&lt;/span&gt;( &lt;span class="hljs-title class_"&gt;Math&lt;/span&gt;.&lt;span class="hljs-title function_"&gt;abs&lt;/span&gt;(targetStroke - currentStroke) &amp;gt; &lt;span class="hljs-variable constant_"&gt;STROKE_DELTA&lt;/span&gt; ) {
    &lt;span class="hljs-comment"&gt;// move towards target by the increment&lt;/span&gt;&lt;span class="hljs-keyword"&gt;if&lt;/span&gt;( targetStroke &amp;gt; currentStroke )
        currentStroke = &lt;span class="hljs-title class_"&gt;Math&lt;/span&gt;.&lt;span class="hljs-title function_"&gt;min&lt;/span&gt;(targetStroke, currentStroke + &lt;span class="hljs-variable constant_"&gt;STROKE_INCREMENT&lt;/span&gt;);
    &lt;span class="hljs-keyword"&gt;else&lt;/span&gt;
        currentStroke = &lt;span class="hljs-title class_"&gt;Math&lt;/span&gt;.&lt;span class="hljs-title function_"&gt;max&lt;/span&gt;(targetStroke, currentStroke - &lt;span class="hljs-variable constant_"&gt;STROKE_INCREMENT&lt;/span&gt;);
    mPath.&lt;span class="hljs-title function_"&gt;lineTo&lt;/span&gt;(mX, mY);

    mPath = &lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-title class_"&gt;Path&lt;/span&gt;();
    mPath.&lt;span class="hljs-title function_"&gt;moveTo&lt;/span&gt;(mX,mY);
    mPaths.&lt;span class="hljs-title function_"&gt;add&lt;/span&gt;(mPath);
    mStrokes.&lt;span class="hljs-title function_"&gt;add&lt;/span&gt;(currentStroke);
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_4')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;You would update &lt;code&gt;targetStroke&lt;/code&gt; where you currently set &lt;code&gt;variableWidthDelta&lt;/code&gt;.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Your current code translates pretty much every touch move event (above a certain delta distance) into a new path segment. To make a smooth path, you need to do some processing on this large number of initial points that the user touched, and turn it into a smaller number of quad or cubic path segments.&lt;/p&gt;&lt;p&gt;Have a look at the demo on this page: &lt;a rel="nofollow noreferrer noopener" href="http://paperjs.org/tutorials/paths/smoothing-simplifying-flattening/#simplifying-paths"&gt;http://paperjs.org/tutorials/paths/smoothing-simplifying-flattening/#simplifying-paths&lt;/a&gt; and the corresponding simplification code: &lt;a rel="nofollow noreferrer noopener" href="https://github.com/paperjs/paper.js/blob/master/src/path/PathFitter.js"&gt;https://github.com/paperjs/paper.js/blob/master/src/path/PathFitter.js&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Obviously it's in JavaScript not Java, but you'll need to use a similar algorithm. An added complication will be that you will probably have to break down your smoothed path segments into multiple sub-segments again after smoothing to support varying stroke width within a single segment.&lt;/p&gt;&lt;/div&gt; 


</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Why Android Does Not Handle A Deeplink Url Which Has # In The Path</title><link>https://dreamlikehotels.blogspot.com/2023/10/why-android-does-not-handle-deeplink.html</link><category>Android</category><category>Deep Linking</category><category>Deeplink</category><category>Uri</category><category>Url</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 13:27:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-3287666249748898843</guid><description>&lt;div class="question"&gt;The url http://javaexample.com/#/topics is a valid url?  I am try to deeplink the above url in the app using:    &lt;intent-filter android:label='@string/app_name'&gt;&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;The &lt;code&gt;#&lt;/code&gt; in a URL indicates the beginning of the &lt;a rel="nofollow noreferrer noopener" href="http://uri.thephpleague.com/4.0/components/overview/"&gt;fragment component&lt;/a&gt;, which cannot be used for deep link criteria. Even though you've structured the fragment to &lt;em&gt;look&lt;/em&gt; like a normal URL path to human eyes, the computer does not read it this way.&lt;/p&gt;&lt;p&gt;You'll need to reformat your URLs not to include any &lt;code&gt;#&lt;/code&gt; character before the path.&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Everything About Map</title><link>https://dreamlikehotels.blogspot.com/2023/10/everything-about-map.html</link><category>Android</category><category>Google Maps</category><category>Offline Caching</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 12:11:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-4033805914866615822</guid><description>&lt;div class="question"&gt;I am new in android programming. I want to know about GPS. I searched and i know a little about this. anyway, i want to use Map, before i used com.google.android.maps.MapView in my&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;To start on Google maps, You can refer this link &lt;a rel="nofollow noreferrer noopener" href="https://developers.google.com/maps/documentation/android/start"&gt;https://developers.google.com/maps/documentation/android/start&lt;/a&gt; also MapView is deprecated now, so You have to move with Google Map Version 2.&lt;/p&gt;&lt;p&gt;Example Code : &lt;a rel="nofollow noreferrer noopener" href="http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/"&gt;http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/&lt;/a&gt;
All the Best..&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;You should use Fragment. It is like that on layout;&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;pre&gt;&lt;code id="code_0" class="hljs language-bash"&gt;&amp;lt;fragment
   android:name=&lt;span class="hljs-string"&gt;"com.google.android.gms.maps.SupportMapFragment"&lt;/span&gt;
   android:&lt;span class="hljs-built_in"&gt;id&lt;/span&gt;=&lt;span class="hljs-string"&gt;"@+id/myMapView"&lt;/span&gt;
   android:layout_width=&lt;span class="hljs-string"&gt;"fill_parent"&lt;/span&gt;
   android:layout_height=&lt;span class="hljs-string"&gt;"fill_parent"&lt;/span&gt;
   android:clickable=&lt;span class="hljs-string"&gt;"true"&lt;/span&gt; /&amp;gt;
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_0')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;To use that you should add &lt;strong&gt;google-play-services_lib&lt;/strong&gt; project to your project build path.
Then in your class you should implement FragmentActivity like that;&lt;/p&gt;&lt;pre&gt;&lt;code id="code_1" class="hljs language-typescript"&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-keyword"&gt;class&lt;/span&gt;&lt;span class="hljs-title class_"&gt;Main&lt;/span&gt;&lt;span class="hljs-keyword"&gt;extends&lt;/span&gt;&lt;span class="hljs-title class_ inherited__"&gt;FragmentActivity&lt;/span&gt;{

&lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-title class_"&gt;GoogleMap&lt;/span&gt; mMap;

&lt;span class="hljs-title class_"&gt;UiSettings&lt;/span&gt; settings;
&lt;span class="hljs-title class_"&gt;MapController&lt;/span&gt; mapController;
&lt;span class="hljs-title class_"&gt;GeoPoint&lt;/span&gt; geopoint;
&lt;span class="hljs-title class_"&gt;Rect&lt;/span&gt;F oval;
&lt;span class="hljs-title class_"&gt;Canvas&lt;/span&gt; canvas;
int mRadius = &lt;span class="hljs-number"&gt;5&lt;/span&gt;;

&lt;span class="hljs-meta"&gt;@Override&lt;/span&gt;&lt;span class="hljs-keyword"&gt;protected&lt;/span&gt;&lt;span class="hljs-built_in"&gt;void&lt;/span&gt;&lt;span class="hljs-title function_"&gt;onCreate&lt;/span&gt;(&lt;span class="hljs-params"&gt;Bundle savedInstanceState&lt;/span&gt;) {

    &lt;span class="hljs-variable language_"&gt;super&lt;/span&gt;.&lt;span class="hljs-title function_"&gt;onCreate&lt;/span&gt;(savedInstanceState);
    &lt;span class="hljs-title function_"&gt;setContentView&lt;/span&gt;(R.&lt;span class="hljs-property"&gt;layout&lt;/span&gt;.&lt;span class="hljs-property"&gt;activity_main&lt;/span&gt;);
    &lt;span class="hljs-title function_"&gt;setUpMap&lt;/span&gt;();
}

&lt;span class="hljs-meta"&gt;@Override&lt;/span&gt;&lt;span class="hljs-keyword"&gt;protected&lt;/span&gt;&lt;span class="hljs-built_in"&gt;void&lt;/span&gt;&lt;span class="hljs-title function_"&gt;onResume&lt;/span&gt;(&lt;span class="hljs-params"&gt;&lt;/span&gt;){
    &lt;span class="hljs-variable language_"&gt;super&lt;/span&gt;.&lt;span class="hljs-title function_"&gt;onResume&lt;/span&gt;();
    &lt;span class="hljs-title function_"&gt;setUpMap&lt;/span&gt;();
}

&lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-built_in"&gt;void&lt;/span&gt;&lt;span class="hljs-title function_"&gt;setUpMap&lt;/span&gt;(&lt;span class="hljs-params"&gt;&lt;/span&gt;){
    &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; (mMap != &lt;span class="hljs-literal"&gt;null&lt;/span&gt;) {
        &lt;span class="hljs-keyword"&gt;return&lt;/span&gt;;
    }
    mMap=((&lt;span class="hljs-title class_"&gt;SupportMapFragment&lt;/span&gt;) &lt;span class="hljs-title function_"&gt;getSupportFragmentManager&lt;/span&gt;().&lt;span class="hljs-title function_"&gt;findFragmentById&lt;/span&gt;(R.&lt;span class="hljs-property"&gt;id&lt;/span&gt;.&lt;span class="hljs-property"&gt;myMapView&lt;/span&gt;)).&lt;span class="hljs-title function_"&gt;getMap&lt;/span&gt;();
    &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; (mMap == &lt;span class="hljs-literal"&gt;null&lt;/span&gt;) {
        &lt;span class="hljs-keyword"&gt;return&lt;/span&gt;;
    }
    mMap.&lt;span class="hljs-title function_"&gt;setMyLocationEnabled&lt;/span&gt;(&lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
    mMap.&lt;span class="hljs-title function_"&gt;getUiSettings&lt;/span&gt;().&lt;span class="hljs-title function_"&gt;setCompassEnabled&lt;/span&gt;(&lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
    mMap.&lt;span class="hljs-title function_"&gt;getUiSettings&lt;/span&gt;().&lt;span class="hljs-title function_"&gt;setMyLocationButtonEnabled&lt;/span&gt;(&lt;span class="hljs-literal"&gt;true&lt;/span&gt;);

    mMap.&lt;span class="hljs-title function_"&gt;animateCamera&lt;/span&gt;(&lt;span class="hljs-title class_"&gt;CameraUpdateFactory&lt;/span&gt;.&lt;span class="hljs-title function_"&gt;newLatLngZoom&lt;/span&gt;(place1, &lt;span class="hljs-number"&gt;15&lt;/span&gt;));
    mMap.&lt;span class="hljs-title function_"&gt;setTrafficEnabled&lt;/span&gt;(&lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
    mMap.&lt;span class="hljs-title function_"&gt;setMapType&lt;/span&gt;(&lt;span class="hljs-title class_"&gt;GoogleMap&lt;/span&gt;.&lt;span class="hljs-property"&gt;MAP_TYPE_HYBRID&lt;/span&gt;);           

}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_1')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;You should obtain an apikey for google maps from this &lt;a rel="nofollow noreferrer noopener" href="https://code.google.com/apis/console/"&gt;link&lt;/a&gt; or you can continue step by step from this &lt;a rel="nofollow noreferrer noopener" href="https://developers.google.com/maps/documentation/android/start"&gt;link&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Add your apikey and permissions to Manifest file like that;&lt;/p&gt;&lt;pre&gt;&lt;code id="code_2" class="hljs language-xml"&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;uses-permission&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:name&lt;/span&gt;=&lt;span class="hljs-string"&gt;"your_package.permission.MAPS_RECEIVE"&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;uses-permission&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:name&lt;/span&gt;=&lt;span class="hljs-string"&gt;"android.permission.INTERNET"&lt;/span&gt; /&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;uses-permission&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:name&lt;/span&gt;=&lt;span class="hljs-string"&gt;"com.google.android.providers.gsf.permission.READ_GSERVICES"&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;uses-permission&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:name&lt;/span&gt;=&lt;span class="hljs-string"&gt;"android.permission.ACCESS_FINE_LOCATION"&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;meta-data&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:name&lt;/span&gt;=&lt;span class="hljs-string"&gt;"com.google.android.maps.v2.API_KEY"&lt;/span&gt;&lt;span class="hljs-attr"&gt;android:value&lt;/span&gt;=&lt;span class="hljs-string"&gt;"your_api_key"&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_2')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Note: meta-data must be inside of &lt;strong&gt;application&lt;/strong&gt; in your manifest.&lt;/p&gt;&lt;/div&gt; 


</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Gson - Convert From Json To List&lt;&gt;</title><link>https://dreamlikehotels.blogspot.com/2023/10/gson-convert-from-json-to-list.html</link><category>Android</category><category>Gson</category><category>Json</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 11:30:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-2181302931323129549</guid><description>&lt;div class="question"&gt;i'm having an issue converting Json to List&lt;&gt;, I have tried different solutions but no clue  My json result looks like : {      'Return':0,    'List':[         {            '&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;In this JSON, you get a list of {Code, Label} objects, but in the &lt;code&gt;List&lt;/code&gt; property of an object.&lt;/p&gt;&lt;p&gt;You first need to encapsulate this list in an other object.
As in:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_1" class="hljs language-swift"&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-keyword"&gt;class&lt;/span&gt;&lt;span class="hljs-title class_"&gt;QuestionaireList&lt;/span&gt; {
  &lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-type"&gt;List&lt;/span&gt;&amp;lt;&lt;span class="hljs-type"&gt;Questionaire&lt;/span&gt;&amp;gt; &lt;span class="hljs-type"&gt;List&lt;/span&gt;;
}

&lt;span class="hljs-type"&gt;List&lt;/span&gt;&amp;lt;&lt;span class="hljs-type"&gt;Questionaire&lt;/span&gt;&amp;gt; qsts &lt;span class="hljs-operator"&gt;=&lt;/span&gt; gson.fromJson(result,  &lt;span class="hljs-type"&gt;QuestionaireList&lt;/span&gt;.class).&lt;span class="hljs-type"&gt;List&lt;/span&gt;;
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_1')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;You need another class that maps the full result&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;pre&gt;&lt;code id="code_2" class="hljs language-kotlin"&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-class"&gt;&lt;span class="hljs-keyword"&gt;class&lt;/span&gt;&lt;span class="hljs-title"&gt;MyJson&lt;/span&gt;&lt;/span&gt;{
     &lt;span class="hljs-meta"&gt;@SerializedName(&lt;span class="hljs-string"&gt;"List"&lt;/span&gt;)&lt;/span&gt;&lt;span class="hljs-keyword"&gt;private&lt;/span&gt; List&amp;lt;Questionaire&amp;gt; list;

    &lt;span class="hljs-meta"&gt;@SerializedName(&lt;span class="hljs-string"&gt;"Return"&lt;/span&gt;)&lt;/span&gt;&lt;span class="hljs-keyword"&gt;private&lt;/span&gt; Integer return1;

    &lt;span class="hljs-comment"&gt;//... getters and setters&lt;/span&gt;
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_2')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Your type then needs to bind to "MyJson" or whatever you name the class.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_3"&gt;Solution 3:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;I'm assuming it's the List part you want to map to 'qstList'. If so then you need to extract it from the rest of the json first:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_3" class="hljs language-java"&gt;&lt;span class="hljs-type"&gt;Gson&lt;/span&gt;&lt;span class="hljs-variable"&gt;gson&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt;&lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-title class_"&gt;Gson&lt;/span&gt;();
&lt;span class="hljs-type"&gt;JsonObject&lt;/span&gt;&lt;span class="hljs-variable"&gt;resultObj&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt; gson.fromJson(result, JsonObject.class);
&lt;span class="hljs-type"&gt;JsonArray&lt;/span&gt;&lt;span class="hljs-variable"&gt;jsonList&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt; resultObj.get(&lt;span class="hljs-string"&gt;"List"&lt;/span&gt;).getAsJsonArray();
&lt;span class="hljs-type"&gt;Type&lt;/span&gt;&lt;span class="hljs-variable"&gt;listType&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt;&lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-title class_"&gt;TypeToken&lt;/span&gt;&amp;lt;List&amp;lt;Questionaire&amp;gt;&amp;gt;(){}.getType();
qstList = gson.fromJson(jsonList, listType);
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_3')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Get My Location</title><link>https://dreamlikehotels.blogspot.com/2023/10/get-my-location.html</link><category>Android</category><category>Google Maps Android Api 2</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 11:00:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-7102709758492291057</guid><description>&lt;div class="question"&gt;I have a ListFragment and I want to get the my location. In my Manifest I have added this: &lt;uses-permission android:name='android.permission.ACCESS_FINE_LOCATION' /&gt;  and my&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;First you need to know about &lt;strong&gt;GPS, Network Provider, google MAP&lt;/strong&gt; to know getting location. Below example is for beginner to know how to get location(lanlat value) from the GPS and Network Provider&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Follow this link:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/"&gt;Getting location (latlong) &lt;/a&gt;&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;p&gt;If you want to get a location name then u must know about SHA code and all. &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Follow this Link:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="https://www.youtube.com/playlist?list=PLLk083vNjCXY-5Scs_pTTFlN9Cc-tmIDo"&gt;Getting location from googlemap&lt;/a&gt;&lt;/p&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Json Fetch Dosen't Work Correctly In Real Host But Work In Localhost</title><link>https://dreamlikehotels.blogspot.com/2023/10/json-fetch-dosent-work-correctly-in.html</link><category>Android</category><category>Android Volley</category><category>Host</category><category>Php</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 10:39:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-658052133445265140</guid><description>&lt;div class="question"&gt;I have this json in my free host : http://alibhm.epizy.com/fetch_turbine2.php As you seen fetching work correctly if run this in browser and fetch two parameter . But when put this&lt;/div&gt;

&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;
&lt;div class="answer-desc"&gt;&lt;p&gt;after one week i found answer :) my code don't have problem . everything cause by some free hosting protection . some free hosting have protection against bots . and my app known as bot for this host . i change my host and everything work like charm :) . i recommend use paid hosts to pass problems.&lt;/p&gt;&lt;/div&gt; 
&lt;br&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Is There An Api To Get Sales Report On Google Play?</title><link>https://dreamlikehotels.blogspot.com/2023/10/is-there-api-to-get-sales-report-on.html</link><category>Android</category><category>Google Play</category><category>Statistics</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 07:30:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-6469334061303883806</guid><description>&lt;div class="question"&gt;We have an Androïd app on Google Play and I'd like to retrieve the sales report programmatically. Apple provides the Autoingestion tool which allows a Java app to retrieve them, a&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Google Checkout (which is used by Play for billing) has an API, but you need a merchant key to use it, and it is not available in all countries. &lt;/p&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="https://developers.google.com/checkout/samplecode"&gt;https://developers.google.com/checkout/samplecode&lt;/a&gt;&lt;/p&gt;&lt;p&gt;As someone pointed out below, Google Checkout has been discontinued. The new Google Wallet site does not offer a real API, but you can download your reports, which are stored on Google Drive, using the Google Drive API or command line tools. Reports are in CSV format, so they are easy to parse. &lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;p&gt;Additionally, the Google Play Developer console now shows sales data. Checkout the Andlytics app, it can fetch and display sales numbers (available in the alpha version). It is also open source. &lt;/p&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="https://play.google.com/store/apps/details?id=com.github.andlyticsproject"&gt;https://play.google.com/store/apps/details?id=com.github.andlyticsproject&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Edit 2014/02/18&lt;/p&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="https://en.wikipedia.org/wiki/Google_Checkout"&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Google Checkout was discontinued on November 20, 2013. The company offered a new solution for certain payments called &lt;a rel="nofollow noreferrer noopener" href="https://developers.google.com/wallet/"&gt;Google Wallet&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;I only have seen Apps that show a webview of the Developer Console. I noticed the URL to the statistic is always the same, year + month, so you could try and read this in. Sadly it only shows sales and not downloads.
&lt;a rel="nofollow noreferrer noopener" href="https://play.google.com/apps/publish/salesreport/download?report_date=2012_05&amp;amp;report_type=sales_report&amp;amp;dev_acc=%%YOUR_ACC_NUMBER%%"&gt;https://play.google.com/apps/publish/salesreport/download?report_date=2012_05&amp;amp;report_type=sales_report&amp;amp;dev_acc=%%YOUR_ACC_NUMBER%%&lt;/a&gt;&lt;/p&gt;&lt;p&gt;But there seems to be some kind of api when you look at the ajax-requests in the developer console:
&lt;a rel="nofollow noreferrer noopener" href="https://play.google.com/apps/publish/statistics?dev_acc=%%YOUR_ACC_NUMBER%%"&gt;https://play.google.com/apps/publish/statistics?dev_acc=%%YOUR_ACC_NUMBER%%&lt;/a&gt;
POST: method -&amp;gt; "getCombinedStats"&lt;/p&gt;&lt;/div&gt; 


</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Music Player Play 2 Song At The Same Time</title><link>https://dreamlikehotels.blogspot.com/2023/10/music-player-play-2-song-at-same-time.html</link><category>Android</category><category>Android Activity</category><category>Listview</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 06:06:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-8669695888590363475</guid><description>&lt;div class="question"&gt;i'm a beginner and i have some trouble with my android app. my app have 2 activities. the first is PlayerActivity.java it will list all song in sdcard by a listView and when i clic&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;In &lt;code&gt;PlaysongActivity&lt;/code&gt;, override &lt;code&gt;onStop()&lt;/code&gt; and call &lt;a rel="nofollow noreferrer noopener" href="https://developer.android.com/reference/android/media/MediaPlayer.html#release%28%29"&gt;&lt;code&gt;release()&lt;/code&gt;&lt;/a&gt; on the &lt;code&gt;MediaPlayer&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;This will stop playback (and release resources) when you exit that activity.&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Can Reflection Be Used With Methods That Belong To Greater Than Minimum Sdk?</title><link>https://dreamlikehotels.blogspot.com/2023/10/can-reflection-be-used-with-methods.html</link><category>Android</category><category>Reflection</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 04:04:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-8142909907111905873</guid><description>&lt;div class="question"&gt;I am developing an app which has to support at minimum level 10 sdk. Today, I was coding when I came across a method setLayerType() which I need to use. But this method is introduc&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc" style="height: auto !important;"&gt;&lt;p&gt;No, of course the app will crash if you call a method that is not present in its API level. This is true whether you call by reflection or not.&lt;/p&gt;&lt;p&gt;The point of reflection is that you choose whether or not to call it based on the API level. Compare &lt;code&gt;http://developer.android.com/reference/android/os/Build.VERSION.html#SDK_INT&lt;/code&gt; to &lt;code&gt;http://developer.android.com/reference/android/os/Build.VERSION_CODES.html&lt;/code&gt; in your code and only proceed with the reflective call if the SDK number is high enough.&lt;/p&gt;&lt;p&gt;The point is that you isolate code with bytecode references to any method or constant or class that's not present in all API levels into a separate class that is only loaded by reflection.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;p&gt;Here's an example of some utility code I created just to manage this kind of thing; it loads one or the other implementation of an interface based on API level:&lt;/p&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="https://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/common/PlatformSupportManager.java?spec=svn2361&amp;amp;r=2361"&gt;https://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/common/PlatformSupportManager.java?spec=svn2361&amp;amp;r=2361&lt;/a&gt;&lt;/p&gt;&lt;p&gt;EDIT: @FD_'s answer works too which surprises me. Reflection is safer, but much more code. And it seems like the reflection approach is in fact unnecessary on recent, if not all, Android JVMs.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;You don't even need Reflection for that. Just specify your target sdk as high as possible, and your min sdk as low as it is now. Then, before calling a method that was introduced &lt;em&gt;after&lt;/em&gt; the min version, just check which api version your app is running on:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_2" class="hljs language-scss"&gt;if (android.os.Build.VERSION.SDK_INT &amp;gt;= &lt;span class="hljs-number"&gt;11&lt;/span&gt;) {
    &lt;span class="hljs-comment"&gt;//Your code here&lt;/span&gt;
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_2')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Trying to use methods that were introduced in a later api version will lead to a crash otherwise, whether you call it using Reflection or not.&lt;/p&gt;&lt;/div&gt; 


</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Docx Conversion</title><link>https://dreamlikehotels.blogspot.com/2023/10/docx-conversion.html</link><category>Android</category><category>Apache Poi</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Wed, 11 Oct 2023 00:40:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-3772931792785973110</guid><description>&lt;div class="question"&gt;I am doing simple docx conversion app in android.  File file = new File(path + 'Sample1.docx'); FileInputStream fis = new FileInputStream(file);   XWPFDocument document = new XWPFD&lt;/div&gt;
&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;
&lt;div class="answer-desc"&gt;&lt;p&gt;I was able to make &lt;a rel="nofollow noreferrer noopener" href="http://www.independentsoft.com"&gt;JWord&lt;/a&gt; working under Android. Had many issues with Apache POI like you have (Conversion to Dalvik format failed).&lt;/p&gt;&lt;/div&gt; 
&lt;br&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Does This Custom Compare Method Contain A Logical Error</title><link>https://dreamlikehotels.blogspot.com/2023/10/does-this-custom-compare-method-contain.html</link><category>Android</category><category>Java</category><category>Sorting</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Tue, 10 Oct 2023 23:57:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-3888676251364932506</guid><description>&lt;div class="question"&gt;In an android application, I have a list of locations. I need to sort them based on their distance with the user location. for that I implemented a custom comparator: Collections.s&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;As &lt;strong&gt;Peter Lawrey&lt;/strong&gt; said, you should use &lt;code&gt;Double.compare(x, y)&lt;/code&gt; or &lt;code&gt;Float.compare(x, y)&lt;/code&gt; instead of casting to int. Here the explanation:&lt;/p&gt;&lt;p&gt;Comparator MUST be transitive, i.e. whenever A == B and B == C, then also A == C. Lets imagine we have three points &lt;code&gt;A&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt; with the distances to the user location 0.2, 0.4 and 1.3. &lt;/p&gt;&lt;ol&gt;&lt;li&gt;(int) (0.2 - 0.4) = (int) (-0.2) = 0 =&amp;gt; &lt;code&gt;A == B&lt;/code&gt;&lt;/li&gt;&lt;li&gt;(int) (0.4 - 1.3) = (int) (-0.9) = 0 =&amp;gt; &lt;code&gt;B == C&lt;/code&gt;&lt;/li&gt;&lt;li&gt;(int) (0.2 - 1.3) = (int) (-1.1) = -1 =&amp;gt; &lt;code&gt;A &amp;lt; C&lt;/code&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;As you can see the comparator is not transitive.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;If &lt;code&gt;userLocation == null&lt;/code&gt; then &lt;code&gt;house1.equals(house2)&lt;/code&gt; should give true.&lt;/p&gt;&lt;/div&gt; 


</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Handling Dvm Killing Your Activity</title><link>https://dreamlikehotels.blogspot.com/2023/10/handling-dvm-killing-your-activity.html</link><category>Android</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Tue, 10 Oct 2023 23:16:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-1149572476596419371</guid><description>&lt;div class="question"&gt;I have an activity which fetches huge set of data from the network and i want to handle the scenario for this activity if the DVM decides to destroy this activity (due to low memor&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Depending on the data you need to savior you could pass in the data (if it's primitive types) into the Bundle of the Activity and override the onPause method of the activity. The onPause method will be called whenever the Activity closes.&lt;/p&gt;&lt;p&gt;See the activity lifecycle for reference &lt;a rel="nofollow noreferrer noopener" href="https://developer.android.com/reference/android/app/Activity.html"&gt;http://developer.android.com/reference/android/app/Activity.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;There are other ways to save the data - you could write it directly to a file on the SD card and then close the stream in the onPause method if the Activity is closed by the OS without finishing the data.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;p&gt;Then when the Activity is opened again you call the onResume method of the Activity and read the data saved inside the Bundle or the file written to the SD card.&lt;/p&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Android Backstack Clear But Keep Root</title><link>https://dreamlikehotels.blogspot.com/2023/10/android-backstack-clear-but-keep-root.html</link><category>Android</category><category>Back Stack</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Tue, 10 Oct 2023 21:58:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-8324765711969288174</guid><description>&lt;div class="question"&gt;I am currently writing a chat app. It is basically very similar to WhatsApp:  On Startup there is last conversation overview.  When I want to start a new conversation with somebody&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Define Activity A1's &lt;code&gt;android:launchMode&lt;/code&gt; as &lt;code&gt;singleTop&lt;/code&gt; at your manifest.
Handle back button press at Activity A4 and &lt;b&gt;start&lt;/b&gt; your Activity A1 like below:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_2" class="hljs language-cpp"&gt;Intent intent = &lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-built_in"&gt;Intent&lt;/span&gt;(A4.&lt;span class="hljs-keyword"&gt;this&lt;/span&gt;,  A1.&lt;span class="hljs-keyword"&gt;class&lt;/span&gt;);
intent.&lt;span class="hljs-built_in"&gt;addFlags&lt;/span&gt;(Intent.FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
&lt;span class="hljs-built_in"&gt;startActivity&lt;/span&gt;(intent); 
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_2')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;With this your A2, A3 will be cleared from stack.&lt;/p&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="https://developer.android.com/reference/android/content/Intent.html"&gt;See more for intents.&lt;/a&gt;&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;p&gt;Edit: This will work for your [A1, A2, A3 , A4] -&amp;gt; back -&amp;gt; [A1] requirement&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Try to do it consistent with the Android design. The back button goes back one activity. &lt;/p&gt;&lt;p&gt;Instead use the home button of the &lt;a rel="nofollow noreferrer noopener" href="https://developer.android.com/design/patterns/actionbar.html"&gt;Action Bar&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a rel="nofollow noreferrer noopener" href="https://developer.android.com/design/patterns/navigation.html"&gt;Android design pattern for navigation&lt;/a&gt;;&lt;/p&gt;&lt;p&gt;Create the ActionBar:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_3" class="hljs language-java"&gt;&lt;span class="hljs-keyword"&gt;final&lt;/span&gt;&lt;span class="hljs-type"&gt;ActionBar&lt;/span&gt;&lt;span class="hljs-variable"&gt;actionBar&lt;/span&gt;&lt;span class="hljs-operator"&gt;=&lt;/span&gt; getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setDisplayHomeAsUpEnabled(&lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_3')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Go back to top intent when HomeButton got clicked:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_4" class="hljs language-cpp"&gt;&lt;span class="hljs-keyword"&gt;final&lt;/span&gt; Intent intent = &lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-built_in"&gt;Intent&lt;/span&gt;(&lt;span class="hljs-keyword"&gt;this&lt;/span&gt;, MainPage.&lt;span class="hljs-keyword"&gt;class&lt;/span&gt;);
intent.&lt;span class="hljs-built_in"&gt;addFlags&lt;/span&gt;(Intent.FLAG_ACTIVITY_CLEAR_TOP);
&lt;span class="hljs-built_in"&gt;startActivity&lt;/span&gt;(intent);
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_4')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt; 


</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How To Prevent Double Code Running By Clicking Twice Fast To A Button In Android</title><link>https://dreamlikehotels.blogspot.com/2023/10/how-to-prevent-double-code-running-by.html</link><category>Android</category><category>Android Button</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Tue, 10 Oct 2023 20:39:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-8824832668666647810</guid><description>&lt;div class="question"&gt;If i click fast to my button in my Android app, it seems that code behind it runs twice. If i click my menu button twice the activity that has to be launch onclick just starts twic&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;You can use following code: &lt;strong&gt;btn.setEnabled(false);&lt;/strong&gt;&lt;/p&gt;&lt;pre&gt;&lt;code id="code_0" class="hljs language-typescript"&gt;btn.&lt;span class="hljs-title function_"&gt;setOnclickListener&lt;/span&gt;(&lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-title class_"&gt;View&lt;/span&gt;.&lt;span class="hljs-title function_"&gt;onClickListener&lt;/span&gt;(&lt;span class="hljs-params"&gt;&lt;/span&gt;){

      &lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-built_in"&gt;void&lt;/span&gt;&lt;span class="hljs-title function_"&gt;onClick&lt;/span&gt;(&lt;span class="hljs-params"&gt;View v&lt;/span&gt;) {
            btn.&lt;span class="hljs-title function_"&gt;setEnabled&lt;/span&gt;(&lt;span class="hljs-literal"&gt;false&lt;/span&gt;);

      }
});
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_0')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="solution_2"&gt;Solution 2:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;You can Disable the view temporarily like this&lt;/p&gt;&lt;pre&gt;&lt;code id="code_1" class="hljs language-typescript"&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-keyword"&gt;static&lt;/span&gt;&lt;span class="hljs-built_in"&gt;void&lt;/span&gt;&lt;span class="hljs-title function_"&gt;disableTemporarly&lt;/span&gt;(&lt;span class="hljs-params"&gt;final View view&lt;/span&gt;) {

        view.&lt;span class="hljs-title function_"&gt;setEnabled&lt;/span&gt;(&lt;span class="hljs-literal"&gt;false&lt;/span&gt;);
        view.&lt;span class="hljs-title function_"&gt;post&lt;/span&gt;(&lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-title class_"&gt;Runnable&lt;/span&gt;() {
            &lt;span class="hljs-meta"&gt;@Override&lt;/span&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-built_in"&gt;void&lt;/span&gt;&lt;span class="hljs-title function_"&gt;run&lt;/span&gt;(&lt;span class="hljs-params"&gt;&lt;/span&gt;) {

                view.&lt;span class="hljs-title function_"&gt;setEnabled&lt;/span&gt;(&lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
            }
        });
    }
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_1')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;hr&gt;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;p&gt;The above solution will work fine.
But it will become even better when using the power of Kotlin&lt;/p&gt;&lt;p&gt;1) Create the SafeClikc Listener&lt;/p&gt;&lt;pre&gt;&lt;code id="code_2" class="hljs language-kotlin"&gt;&lt;span class="hljs-class"&gt;&lt;span class="hljs-keyword"&gt;class&lt;/span&gt;&lt;span class="hljs-title"&gt;SafeClickListener&lt;/span&gt;&lt;/span&gt;(
        &lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-keyword"&gt;var&lt;/span&gt; defaultInterval: &lt;span class="hljs-built_in"&gt;Int&lt;/span&gt; = &lt;span class="hljs-number"&gt;1000&lt;/span&gt;,
        &lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-keyword"&gt;val&lt;/span&gt; onSafeCLick: (View) -&amp;gt; &lt;span class="hljs-built_in"&gt;Unit&lt;/span&gt;
) : View.OnClickListener {

    &lt;span class="hljs-keyword"&gt;private&lt;/span&gt;&lt;span class="hljs-keyword"&gt;var&lt;/span&gt; lastTimeClicked: &lt;span class="hljs-built_in"&gt;Long&lt;/span&gt; = &lt;span class="hljs-number"&gt;0&lt;/span&gt;&lt;span class="hljs-keyword"&gt;override&lt;/span&gt;&lt;span class="hljs-function"&gt;&lt;span class="hljs-keyword"&gt;fun&lt;/span&gt;&lt;span class="hljs-title"&gt;onClick&lt;/span&gt;&lt;span class="hljs-params"&gt;(v: &lt;span class="hljs-type"&gt;View&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt; {
        &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; (SystemClock.elapsedRealtime() - lastTimeClicked &amp;lt; defaultInterval) {
            &lt;span class="hljs-keyword"&gt;return&lt;/span&gt;
        }
        lastTimeClicked = SystemClock.elapsedRealtime()
        onSafeCLick(v)
    }
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_2')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;2) Add extension function to make it works with any view, this will create a new SafeClickListener and delegate the work to it&lt;/p&gt;&lt;pre&gt;&lt;code id="code_3" class="hljs language-kotlin"&gt;&lt;span class="hljs-function"&gt;&lt;span class="hljs-keyword"&gt;fun&lt;/span&gt; View.&lt;span class="hljs-title"&gt;setSafeOnClickListener&lt;/span&gt;&lt;span class="hljs-params"&gt;(onSafeClick: (&lt;span class="hljs-type"&gt;View&lt;/span&gt;) -&amp;gt; &lt;span class="hljs-type"&gt;Unit&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt; {

    &lt;span class="hljs-keyword"&gt;val&lt;/span&gt; safeClickListener = SafeClickListener {
        onSafeClick(it)
    }
    setOnClickListener(safeClickListener)
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_3')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;3) Now it is very easy to use it&lt;/p&gt;&lt;pre&gt;&lt;code id="code_4" class="hljs language-scss"&gt;settingsButton&lt;span class="hljs-selector-class"&gt;.setSafeOnClickListener&lt;/span&gt; {
    &lt;span class="hljs-built_in"&gt;showSettingsScreen&lt;/span&gt;()
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_4')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Happy Kotlin ;)&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_3"&gt;Solution 3:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;pre&gt;&lt;code id="code_5" class="hljs language-typescript"&gt;&lt;span class="hljs-title class_"&gt;Button&lt;/span&gt;.&lt;span class="hljs-title function_"&gt;setOnClickListener&lt;/span&gt;(&lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-title class_"&gt;View&lt;/span&gt;.&lt;span class="hljs-property"&gt;OnClickListener&lt;/span&gt; {  
   &lt;span class="hljs-meta"&gt;@Override&lt;/span&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-built_in"&gt;void&lt;/span&gt;&lt;span class="hljs-title function_"&gt;onClick&lt;/span&gt;(&lt;span class="hljs-params"&gt;final View v&lt;/span&gt;) {
        v.&lt;span class="hljs-title function_"&gt;setEnabled&lt;/span&gt;(&lt;span class="hljs-literal"&gt;false&lt;/span&gt;);
        v.&lt;span class="hljs-title function_"&gt;postDelayed&lt;/span&gt;(&lt;span class="hljs-keyword"&gt;new&lt;/span&gt;&lt;span class="hljs-title class_"&gt;Runnable&lt;/span&gt;() {
         &lt;span class="hljs-meta"&gt;@Override&lt;/span&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-built_in"&gt;void&lt;/span&gt;&lt;span class="hljs-title function_"&gt;run&lt;/span&gt;(&lt;span class="hljs-params"&gt;&lt;/span&gt;) {
            v.&lt;span class="hljs-title function_"&gt;setEnabled&lt;/span&gt;(&lt;span class="hljs-literal"&gt;true&lt;/span&gt;);
         }
        },&lt;span class="hljs-number"&gt;150&lt;/span&gt;); &lt;span class="hljs-comment"&gt;//150 is in milliseconds&lt;/span&gt;
    }
 });  
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_5')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="solution_4"&gt;Solution 4:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;Well, that's the expected behaviour... &lt;/p&gt;&lt;p&gt;Launch your new acvitity with SINGLE_TOP flag&lt;/p&gt;&lt;p&gt;Or try setting &lt;code&gt;android:launchMode="singleInstance"&lt;/code&gt; for Top20 activity in your AndroidManifest.xml&lt;/p&gt;&lt;/div&gt;&lt;h2 id="solution_5"&gt;Solution 5:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;This solves the issue of multiple Instances of activity, and still play the default animation&lt;/p&gt;&lt;pre&gt;&lt;code id="code_7" class="hljs language-scss"&gt;intent&lt;span class="hljs-selector-class"&gt;.setFlags&lt;/span&gt;(Intent.FLAG_ACTIVITY_CLEAR_TOP);
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_7')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Ffmpeg Jni In Android?</title><link>https://dreamlikehotels.blogspot.com/2023/10/ffmpeg-jni-in-android.html</link><category>Android</category><category>Ffmpeg</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Tue, 10 Oct 2023 19:27:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-7566370814218587165</guid><description>&lt;div class="question"&gt;I have built FFMPEG executables and libraries as provided by Bambuser (http://bambuser.com/opensource). So I managed to build the Android executables and libraties. How can I link&lt;/div&gt;&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;&lt;div class="answer-desc"&gt;&lt;p&gt;You have to write some C glue code using the JNI conventions to expose the FFmpeg functionalities to Java code. Here's an example of a JNI method implemented in C from the Android NDK samples:&lt;/p&gt;&lt;pre&gt;&lt;code id="code_0" class="hljs language-bash"&gt;jstring
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* &lt;span class="hljs-built_in"&gt;env&lt;/span&gt;,
                                                  jobject thiz )
{
    &lt;span class="hljs-built_in"&gt;return&lt;/span&gt; (*&lt;span class="hljs-built_in"&gt;env&lt;/span&gt;)-&amp;gt;NewStringUTF(&lt;span class="hljs-built_in"&gt;env&lt;/span&gt;, &lt;span class="hljs-string"&gt;"Hello from JNI !"&lt;/span&gt;);
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_0')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;You also need some Java code to load the library and declare the native method.&lt;/p&gt;&lt;pre&gt;&lt;code id="code_1" class="hljs language-csharp"&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt;&lt;span class="hljs-keyword"&gt;class&lt;/span&gt;&lt;span class="hljs-title"&gt;HelloJni&lt;/span&gt;
{
    &lt;span class="hljs-function"&gt;&lt;span class="hljs-keyword"&gt;public&lt;/span&gt; native String  &lt;span class="hljs-title"&gt;stringFromJNI&lt;/span&gt;()&lt;/span&gt;;

     &lt;span class="hljs-keyword"&gt;static&lt;/span&gt; {
        System.loadLibrary(&lt;span class="hljs-string"&gt;"hello-jni"&lt;/span&gt;);
    }
}
&lt;/code&gt;&lt;button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,'code_1')"&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;I found &lt;a rel="nofollow noreferrer noopener" href="http://jffmpeg.sourceforge.net/"&gt;this project on sourceforge&lt;/a&gt; which already has implemented some JNI interface to ffmpeg to integrate it with the Java Media Framework. You may find it useful.&lt;/p&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;p&gt;There's another Java FFI technology called JNA (Java Native Access) that allows you to declare native function prototypes in Java and call them directly. Using it may require less boilerplate code. See &lt;a rel="nofollow noreferrer noopener" href="https://code.google.com/p/javacv/wiki/JNAOnAndroid"&gt;this project&lt;/a&gt; for an Android implementation. (I have never used it myself)&lt;/p&gt;&lt;/div&gt; 

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Opengl Es 3.0 Matrix Array Only Using First Matrix</title><link>https://dreamlikehotels.blogspot.com/2023/10/opengl-es-30-matrix-array-only-using.html</link><category>Android</category><category>Glsl</category><category>Glsles</category><category>Opengl Es</category><author>noreply@blogger.com (Beverly Graham)</author><pubDate>Tue, 10 Oct 2023 18:42:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-1108893505436407755.post-1853373151941023402</guid><description>&lt;div class="question"&gt;I am doing GPU skinning in my vertex shader which works fine on PC, and which I'm porting to Android. My vertex shader is below, and the problem is that the creation of the matTran&lt;/div&gt;

&lt;h2 id="solution_1"&gt;Solution 1:

&lt;/h2&gt;
&lt;div class="answer-desc"&gt;&lt;p&gt;In the end this looks to be a limitation of the Adreno driver, which doesn't support indexing a uniform array of matrices without a constant integer contrary to what is mandatory within the OpenGL ES spec. A workaround however is to just use a uniform array of vec4s, as it does seem to support indexing these with variables (as is done within their SDK).&lt;/p&gt;&lt;/div&gt; 
&lt;br&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item></channel></rss>