<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1108893505436407755</id><updated>2023-10-12T03:35:26.523-07:00</updated><category term="Android"/><category term="Java"/><category term="Android Layout"/><category term="Android Studio"/><category term="Firebase"/><category term="Google Maps"/><category term="Android Activity"/><category term="Eclipse"/><category term="Android Listview"/><category term="Gradle"/><category term="Android Ndk"/><category term="Firebase Realtime Database"/><category term="Listview"/><category term="Android Fragments"/><category term="Android Recyclerview"/><category term="C#"/><category term="Javascript"/><category term="Sqlite"/><category term="Xamarin"/><category term="Android Actionbar"/><category term="Android Alertdialog"/><category term="Android Gradle Plugin"/><category term="Android Intent"/><category term="Broadcastreceiver"/><category term="Cordova"/><category term="Exception"/><category term="Google Play"/><category term="Ios"/><category term="Kotlin"/><category term="Layout"/><category term="Push Notification"/><category term="Webview"/><category term="Xml"/><category term="Actionbarsherlock"/><category term="Adt"/><category term="Android Emulator"/><category term="Android Softkeyboard"/><category term="Android Videoview"/><category term="Background"/><category term="Bitmap"/><category term="Button"/><category term="Checkbox"/><category term="Firebase Authentication"/><category term="Get"/><category term="Google Maps Android Api 2"/><category term="Gridview"/><category term="Image"/><category term="Json"/><category term="Linux"/><category term="Macos"/><category term="Post"/><category term="Service"/><category term="Aar"/><category term="Adb"/><category term="Android Asynctask"/><category term="Android Button"/><category term="Android Camera"/><category term="Android Canvas"/><category term="Android Constraintlayout"/><category term="Android Edittext"/><category term="Android Lifecycle"/><category term="Android Mediaplayer"/><category term="Android Scroll"/><category term="Android Scrollview"/><category term="Android Sdk Tools"/><category term="Android Sqlite"/><category term="Android Support Library"/><category term="Android Ui"/><category term="Android Volley"/><category term="Android Webview"/><category term="Api"/><category term="Build.gradle"/><category term="C++"/><category term="Cpu Usage"/><category term="Date"/><category term="Expandablelistview"/><category term="File"/><category term="Firebase Cloud Messaging"/><category term="Fragment"/><category term="Google Cloud Messaging"/><category term="Google Oauth"/><category term="Google Play Services"/><category term="Gps"/><category term="Graphics"/><category term="Http"/><category term="Keyboard"/><category term="Manifest"/><category term="Maps"/><category term="Mysql"/><category term="Notifications"/><category term="Nullpointerexception"/><category term="Opengl Es"/><category term="Php"/><category term="React Native"/><category term="Reactjs"/><category term="Realm"/><category term="Reflection"/><category term="Retrofit"/><category term="Retrofit2"/><category term="Sdk"/><category term="Sharedpreferences"/><category term="Sql"/><category term="Statusbar"/><category term="Tabs"/><category term="Text"/><category term="View"/><category term="Windows"/><category term="Xamarin.android"/><category term="Aapt"/><category term="Accelerometer"/><category term="Achartengine"/><category term="Activity Finish"/><category term="Address Sanitizer"/><category term="Amazon S3"/><category term="Amazon Web Services"/><category term="Anchor"/><category term="Android 4.0 Ice Cream Sandwich"/><category term="Android 4.4 Kitkat"/><category term="Android Actionbar Compat"/><category term="Android Arrayadapter"/><category term="Android Camera Intent"/><category term="Android Camera2"/><category term="Android Checkbox"/><category term="Android Contacts"/><category term="Android Context"/><category term="Android Cursor"/><category term="Android Custom View"/><category term="Android Design Library"/><category term="Android Developer Api"/><category term="Android Download Manager"/><category term="Android Fragmentactivity"/><category term="Android Gridview"/><category term="Android Immersive"/><category term="Android Linearlayout"/><category term="Android Manifest"/><category term="Android Maps"/><category term="Android Maps Extensions"/><category term="Android Maps V2"/><category term="Android Mediascanner"/><category term="Android Package Managers"/><category term="Android Permissions"/><category term="Android Print Framework"/><category term="Android Room"/><category term="Android Sdk Manager"/><category term="Android Securityexception"/><category term="Android Sensors"/><category term="Android Service"/><category term="Android Source"/><category term="Android Studio 3.0"/><category term="Android Styles"/><category term="Android Tabhost"/><category term="Android View"/><category term="Android Viewholder"/><category term="Android Viewmodel"/><category term="Android Youtube Api"/><category term="Android.mk"/><category term="Animation"/><category term="Ant"/><category term="Antialiasing"/><category term="Apache Poi"/><category term="Api Key"/><category term="Appcompatactivity"/><category term="Asynchronous"/><category term="Attachment"/><category term="Audio"/><category term="Awss3transferutility"/><category term="Back Stack"/><category term="Background Color"/><category term="Baseadapter"/><category term="Bottom Sheet"/><category term="Butterknife"/><category term="Camera"/><category term="Canvas"/><category term="Certificate"/><category term="Charts"/><category term="Chrome Custom Tabs"/><category term="Cmd"/><category term="Cocos2d X"/><category term="Compatibility"/><category term="Compiler Errors"/><category term="Contacts"/><category term="Crash"/><category term="Crashlytics"/><category term="Crop"/><category term="Css"/><category term="Custom Adapter"/><category term="Dagger"/><category term="Dagger 2"/><category term="Dalvik"/><category term="Database"/><category term="Datecreated"/><category term="Datetime"/><category term="Datetime Format"/><category term="Deep Linking"/><category term="Deeplink"/><category term="Dependency Injection"/><category term="Device"/><category term="Dialog"/><category term="Dimensions"/><category term="Direction"/><category term="Eclipse Adt"/><category term="Eclipse Juno"/><category term="Eclipse Plugin"/><category term="Exception Handling"/><category term="Expandablelistadapter"/><category term="Expo"/><category term="Facebook"/><category term="Facebook Android Sdk"/><category term="Ffmpeg"/><category term="Fileoutputstream"/><category term="Filter"/><category term="Findbugs"/><category term="Flutter"/><category term="Freeze"/><category term="Garbage Collection"/><category term="Geofire"/><category term="Gesturedetector"/><category term="Gestures"/><category term="Glsl"/><category term="Glsles"/><category term="Google App Engine"/><category term="Google Cloud Endpoints"/><category term="Google Cloud Platform"/><category term="Google Geocoder"/><category term="Google Maps Api 2"/><category term="Google Maps Api 3"/><category term="Google Static Maps"/><category term="Gradlew"/><category term="Graph"/><category term="Gson"/><category term="Handler"/><category term="Hash"/><category term="Here Api"/><category term="Host"/><category term="Html"/><category term="Http Post"/><category term="Http Response Codes"/><category term="Https"/><category term="Httpurlconnection"/><category term="Hyperlink"/><category term="Icons"/><category term="Ide"/><category term="Imagebutton"/><category term="Import"/><category term="In App Billing"/><category term="In App Purchase"/><category term="Inheritance"/><category term="Integration Testing"/><category term="Ioexception"/><category term="Ionic Framework"/><category term="Ipad"/><category term="Iphone"/><category term="Jacoco"/><category term="Java Native Interface"/><category term="Jquery Mobile"/><category term="Jsoup"/><category term="Junit"/><category term="Keytool"/><category term="Kill"/><category term="Kivy"/><category term="Ksoap2"/><category term="Last Modified"/><category term="Layout Animation"/><category term="Library Project"/><category term="Location"/><category term="Locationlistener"/><category term="Long Click"/><category term="Mailto"/><category term="Makefile"/><category term="Mapbox"/><category term="Material Design"/><category term="Mediarecorder"/><category term="Memory Leaks"/><category term="Message"/><category term="Meta Tags"/><category term="Mms"/><category term="Mobile Website"/><category term="Mockk"/><category term="Moshi"/><category term="Motion"/><category term="Mpandroidchart"/><category term="Multi Module"/><category term="Multi Select"/><category term="Multi Touch"/><category term="Nine Patch"/><category term="Object"/><category term="Observable"/><category term="Offline Caching"/><category term="Okhttp"/><category term="Onclick"/><category term="Onfling"/><category term="Ontouch"/><category term="Ontouchlistener"/><category term="Opengl Es 2.0"/><category term="Osx Mavericks"/><category term="Overheating"/><category term="Parse Platform"/><category term="Parsing"/><category term="Passwords"/><category term="Perl"/><category term="Permissions"/><category term="Play Billing Library"/><category term="Popup"/><category term="Preferences"/><category term="Preferencescreen"/><category term="Printers"/><category term="Printing"/><category term="Progressdialog"/><category term="Proguard"/><category term="Properties File"/><category term="Protocolexception"/><category term="Python"/><category term="Python 3.x"/><category term="Qemu"/><category term="Radio Group"/><category term="React Native Android"/><category term="Release"/><category term="Request"/><category term="Resolution"/><category term="Resources"/><category term="Restore"/><category term="Rounded Corners"/><category term="Rtf"/><category term="Rx Java"/><category term="Samsung Mobile"/><category term="Save"/><category term="Scale"/><category term="Schedule"/><category term="Screen"/><category term="Screen Orientation"/><category term="Scrollview"/><category term="Securityexception"/><category term="Seekbar"/><category term="Select"/><category term="Serviceconnection"/><category term="Settings"/><category term="Shader"/><category term="Sorting"/><category term="Spinner"/><category term="Split"/><category term="Ssl"/><category term="Sslhandshakeexception"/><category term="Stack Trace"/><category term="Staledataexception"/><category term="State"/><category term="Static"/><category term="Statistics"/><category term="Storage"/><category term="Styles"/><category term="Submenu"/><category term="Surface"/><category term="Swipe"/><category term="Synchronization"/><category term="Tabactivity"/><category term="Telephony"/><category term="Testing"/><category term="Textview"/><category term="Timer"/><category term="Toast"/><category term="Touch Event"/><category term="Tracking"/><category term="Ubuntu"/><category term="Ui Testing"/><category term="Unit Testing"/><category term="Unity3d"/><category term="Uri"/><category term="Url"/><category term="Usb Debugging"/><category term="User Permissions"/><category term="User Registration"/><category term="Vcf Vcard"/><category term="Versioning"/><category term="Viewport"/><category term="Visual Studio"/><category term="Wav"/><category term="Wear Os"/><category term="Web Services"/><category term="Widget"/><category term="Xamarin.forms"/><category term="Xml Parsing"/><category term="Yaxis"/><category term="Youtube"/><category term="Zooming"/><title type='text'>dreamlikehotels</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default?start-index=26&amp;max-results=25'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>328</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-8400491160217847801</id><published>2023-10-12T03:34:00.001-07:00</published><updated>2023-10-12T03:34:54.125-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Date"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Get Start And End Of Week On Android</title><content type='html'>&lt;div class=&quot;question&quot;&gt;I wonder how could I calculate start and end days of the current week ? I&#39;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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;It doesn&#39;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=&quot;code_0&quot; class=&quot;hljs language-csharp&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;hljs-title&quot;&gt;firstDayOfThisWeek&lt;/span&gt;()&lt;/span&gt;{
    DateTime today = DateTime.today(TimeZone.getDefault()); 
    DateTime firstDayThisWeek = today; &lt;span class=&quot;hljs-comment&quot;&gt;//start value &lt;/span&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;int&lt;/span&gt; todaysWeekday = today.getWeekDay();
    &lt;span class=&quot;hljs-built_in&quot;&gt;int&lt;/span&gt; SUNDAY = &lt;span class=&quot;hljs-number&quot;&gt;1&lt;/span&gt;;
    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt;(todaysWeekday &amp;gt; SUNDAY){
      &lt;span class=&quot;hljs-built_in&quot;&gt;int&lt;/span&gt; numDaysFromSunday = todaysWeekday - SUNDAY;
      firstDayThisWeek = today.minusDays(numDaysFromSunday);
    }
    System.&lt;span class=&quot;hljs-keyword&quot;&gt;out&lt;/span&gt;.println(&lt;span class=&quot;hljs-string&quot;&gt;&quot;The first day of this week is : &quot;&lt;/span&gt; + firstDayThisWeek);
  }
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_0&#39;)&quot;&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&#39;t apply, so you would need to change the code for such cases.&lt;/p&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_2&quot;&gt;Solution 2:

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

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;This worked for me...&lt;/p&gt;&lt;pre&gt;&lt;code id=&quot;code_1&quot; class=&quot;hljs language-php&quot;&gt;Calendar cal = Calendar.getInstance();
&lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; year = cal.get(Calendar.YEAR);
cal.set(Calendar.DAY_OF_WEEK, cal.MONDAY);
&lt;span class=&quot;hljs-keyword&quot;&gt;String&lt;/span&gt; firstWkDay = &lt;span class=&quot;hljs-keyword&quot;&gt;String&lt;/span&gt;.valueOf(cal.getTime());
&lt;span class=&quot;hljs-comment&quot;&gt;//cal.set(Calendar.DAY_OF_WEEK, cal.SUNDAY);&lt;/span&gt;
cal.add(Calendar.DAY_OF_WEEK, &lt;span class=&quot;hljs-number&quot;&gt;6&lt;/span&gt;);
&lt;span class=&quot;hljs-keyword&quot;&gt;String&lt;/span&gt; lastWkDay =  &lt;span class=&quot;hljs-keyword&quot;&gt;String&lt;/span&gt;.valueOf(cal.getTime());
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_1&#39;)&quot;&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=&quot;solution_4&quot;&gt;Solution 4:

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

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

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/8400491160217847801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/get-start-and-end-of-week-on-android.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/8400491160217847801'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/8400491160217847801'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/get-start-and-end-of-week-on-android.html' title='Get Start And End Of Week On Android'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-2726280640783674376</id><published>2023-10-12T02:03:00.001-07:00</published><updated>2023-10-12T02:03:16.477-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="In App Billing"/><category scheme="http://www.blogger.com/atom/ns#" term="In App Purchase"/><category scheme="http://www.blogger.com/atom/ns#" term="Play Billing Library"/><category scheme="http://www.blogger.com/atom/ns#" term="Sdk"/><title type='text'>Why Is The Google Play Billing Library Not Shown Up In The Sdk Manager?</title><content type='html'>&lt;div class=&quot;question&quot;&gt;I&#39;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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;Checking the &lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;https://android-developers.googleblog.com/2017/09/google-play-billing-library-10-released.html&quot;&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=&#39;more&#39;&gt;&lt;/a&gt;&lt;pre&gt;&lt;code id=&quot;code_0&quot; class=&quot;hljs language-python&quot;&gt;dependencies {
    ...
    &lt;span class=&quot;hljs-built_in&quot;&gt;compile&lt;/span&gt;&lt;span class=&quot;hljs-string&quot;&gt;&#39;com.android.billingclient:billing:1.0&#39;&lt;/span&gt;
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_0&#39;)&quot;&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;You can find more details about the library in the &lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developer.android.com/google/play/billing/billing_library.html&quot;&gt;official doc.&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_2&quot;&gt;Solution 2:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive&quot;&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&#39;s answer (above). If you happen to use a platform that doesn&#39;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&#39;t include it anymore as they dev team doens&#39;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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://google.bintray.com/play-billing/com/android/billingclient/billing/1.0/&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://github.com/dandar3/android-google-services-billing/tree/1.0&quot;&gt;https://github.com/dandar3/android-google-services-billing/tree/1.0&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_3&quot;&gt;Solution 3:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot; style=&quot;height: auto !important;&quot;&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=&quot;code_1&quot; class=&quot;hljs language-markdown&quot;&gt;&lt;span class=&quot;hljs-code&quot;&gt;    buildscript {
&lt;/span&gt;&lt;span class=&quot;hljs-code&quot;&gt;    mavenCentral()     
    }
&lt;/span&gt;&lt;span class=&quot;hljs-code&quot;&gt;    ................
    allprojects {
&lt;/span&gt;&lt;span class=&quot;hljs-code&quot;&gt;    repositories {
&lt;/span&gt;&lt;span class=&quot;hljs-code&quot;&gt;    mavenCentral()
       }
    }
&lt;/span&gt;&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_1&#39;)&quot;&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=&quot;code_2&quot; class=&quot;hljs language-bash&quot;&gt;   implementation &lt;span class=&quot;hljs-string&quot;&gt;&#39;com.android.billingclient:billing:1.0&#39;&lt;/span&gt;&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_2&#39;)&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://codelabs.developers.google.com/codelabs/play-billing-codelab/#0&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://github.com/googlesamples/android-play-billing&quot;&gt;https://github.com/googlesamples/android-play-billing&lt;/a&gt;&lt;/p&gt;&lt;/div&gt; 

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/2726280640783674376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/why-is-google-play-billing-library-not.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/2726280640783674376'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/2726280640783674376'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/why-is-google-play-billing-library-not.html' title='Why Is The Google Play Billing Library Not Shown Up In The Sdk Manager?'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-1470671192951339497</id><published>2023-10-12T01:05:00.001-07:00</published><updated>2023-10-12T01:05:32.267-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Keyboard"/><title type='text'>Android Set Default Keyboard</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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 &quot;default keyboard on an android device&quot; 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=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt; 

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/1470671192951339497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/android-set-default-keyboard.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/1470671192951339497'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/1470671192951339497'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/android-set-default-keyboard.html' title='Android Set Default Keyboard'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-2612946195077494002</id><published>2023-10-12T00:28:00.001-07:00</published><updated>2023-10-12T00:28:38.074-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Actionbarsherlock"/><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Android Layout"/><category scheme="http://www.blogger.com/atom/ns#" term="Android Ui"/><title type='text'>How To Show Icons In Actionbar Overflow Menu?</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;put your menu with property &lt;code&gt;android:showAsAction=&quot;always&quot;&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=&quot;code_1&quot; class=&quot;hljs language-xml&quot;&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:id&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;@+id/mainMenu&quot;&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:icon&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;@drawable/launcher&quot;&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:showAsAction&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;always&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;menu&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:id&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;@+id/menu_logout&quot;&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:icon&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;@drawable/log_out&quot;&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:title&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;logout&quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;menu&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;item&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_1&#39;)&quot;&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=&quot;solution_2&quot;&gt;Solution 2:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&#39;more&#39;&gt;&lt;/a&gt;&lt;pre&gt;&lt;code id=&quot;code_2&quot; class=&quot;hljs language-cpp&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;final&lt;/span&gt; MenuItem menuItem=...
&lt;span class=&quot;hljs-keyword&quot;&gt;final&lt;/span&gt; ImageSpan imageSpan=&lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;ImageSpan&lt;/span&gt;(&lt;span class=&quot;hljs-keyword&quot;&gt;this&lt;/span&gt;,R.drawable.ic_stat_app_icon);
&lt;span class=&quot;hljs-keyword&quot;&gt;final&lt;/span&gt; CharSequence title=&lt;span class=&quot;hljs-string&quot;&gt;&quot; &quot;&lt;/span&gt;+menuItem.&lt;span class=&quot;hljs-built_in&quot;&gt;getTitle&lt;/span&gt;();
&lt;span class=&quot;hljs-keyword&quot;&gt;final&lt;/span&gt; SpannableString spannableString=&lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;SpannableString&lt;/span&gt;(title);
spannableString.&lt;span class=&quot;hljs-built_in&quot;&gt;setSpan&lt;/span&gt;(imageSpan,&lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;,&lt;span class=&quot;hljs-number&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;);
menuItem.&lt;span class=&quot;hljs-built_in&quot;&gt;setTitle&lt;/span&gt;(spannableString);
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_2&#39;)&quot;&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=&quot;solution_3&quot;&gt;Solution 3:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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 &quot;subMenu2Item.setIcon(R.drawable.ic_launcher);&quot;
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 &quot;This is not possible by design&quot;&lt;/p&gt;&lt;p&gt;Many thanks to Google for attempting to take over the world and letting us ride it&#39;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 &quot;set&quot; 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&#39;s not much to ask for.
I had this same argument with Microsoft back in the day and it didn&#39;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=&quot;code_3&quot; class=&quot;hljs language-java&quot;&gt;&lt;span class=&quot;hljs-meta&quot;&gt;@Override&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;hljs-type&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;hljs-title function_&quot;&gt;onCreateOptionsMenu&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;(com.actionbarsherlock.view.Menu menu)&lt;/span&gt; {

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

    &lt;span class=&quot;hljs-type&quot;&gt;MenuItem&lt;/span&gt;&lt;span class=&quot;hljs-variable&quot;&gt;subMenu1Item&lt;/span&gt;&lt;span class=&quot;hljs-operator&quot;&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=&quot;hljs-type&quot;&gt;SubMenu&lt;/span&gt;&lt;span class=&quot;hljs-variable&quot;&gt;subMenu2&lt;/span&gt;&lt;span class=&quot;hljs-operator&quot;&gt;=&lt;/span&gt; menu.addSubMenu(&lt;span class=&quot;hljs-string&quot;&gt;&quot;All Options&quot;&lt;/span&gt;);
    subMenu2.add(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Help&quot;&lt;/span&gt;);
    subMenu2.add(&lt;span class=&quot;hljs-string&quot;&gt;&quot;About&quot;&lt;/span&gt;);

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

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

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

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;code_5&quot; class=&quot;hljs language-vbnet&quot;&gt;&lt;span class=&quot;hljs-symbol&quot;&gt;android:&lt;/span&gt;showAsAction=&lt;span class=&quot;hljs-string&quot;&gt;&quot;always&quot;&lt;/span&gt;&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_5&#39;)&quot;&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=&quot;code_6&quot; class=&quot;hljs language-xml&quot;&gt;&lt;span class=&quot;hljs-meta&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;menu&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;xmlns:android&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;xmlns:app&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;http://schemas.android.com/apk/res-auto&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:id&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;@+id/option&quot;&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:title&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;@string/option&quot;&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:icon&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;@drawable/option&quot;&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;app:showAsAction&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;always&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;item&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;menu&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_6&#39;)&quot;&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; 

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/2612946195077494002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/how-to-show-icons-in-actionbar-overflow.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/2612946195077494002'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/2612946195077494002'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/how-to-show-icons-in-actionbar-overflow.html' title='How To Show Icons In Actionbar Overflow Menu?'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-577301274988325638</id><published>2023-10-11T22:36:00.001-07:00</published><updated>2023-10-11T22:36:52.660-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Inheritance"/><category scheme="http://www.blogger.com/atom/ns#" term="Styles"/><title type='text'>Textappearance.a Inherits From Textappearance.a.b Doesn&#39;t Cause A Circular Reference In Android Styles?</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&#39;more&#39;&gt;&lt;/a&gt;&lt;p&gt;&lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developer.android.com/guide/topics/ui/look-and-feel/themes&quot;&gt;https://developer.android.com/guide/topics/ui/look-and-feel/themes&lt;/a&gt;&lt;/p&gt;&lt;/div&gt; 

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/577301274988325638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/textappearancea-inherits-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/577301274988325638'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/577301274988325638'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/textappearancea-inherits-from.html' title='Textappearance.a Inherits From Textappearance.a.b Doesn&#39;t Cause A Circular Reference In Android Styles?'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-6651761484061559945</id><published>2023-10-11T19:15:00.001-07:00</published><updated>2023-10-11T19:15:07.322-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Parse Platform"/><category scheme="http://www.blogger.com/atom/ns#" term="Push Notification"/><title type='text'>Android 5.1 Push Notification Icon Is Blank</title><content type='html'>&lt;div class=&quot;question&quot;&gt;When using Parse for push notifications our app always displayed the application&#39;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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;code_0&quot; class=&quot;hljs language-typescript&quot;&gt;&lt;span class=&quot;hljs-meta&quot;&gt;@Override&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;protected&lt;/span&gt; int &lt;span class=&quot;hljs-title function_&quot;&gt;getSmallIconId&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;Context context, Intent intent&lt;/span&gt;) {
    &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; R.&lt;span class=&quot;hljs-property&quot;&gt;drawable&lt;/span&gt;.&lt;span class=&quot;hljs-property&quot;&gt;your_notifiation_icon&lt;/span&gt;;
}

&lt;span class=&quot;hljs-meta&quot;&gt;@Override&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;hljs-title class_&quot;&gt;Bitmap&lt;/span&gt;&lt;span class=&quot;hljs-title function_&quot;&gt;getLargeIcon&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;Context context, Intent intent&lt;/span&gt;) {
    &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;hljs-title class_&quot;&gt;BitmapFactory&lt;/span&gt;.&lt;span class=&quot;hljs-title function_&quot;&gt;decodeResource&lt;/span&gt;(context.&lt;span class=&quot;hljs-title function_&quot;&gt;getResources&lt;/span&gt;(), R.&lt;span class=&quot;hljs-property&quot;&gt;drawable&lt;/span&gt;.&lt;span class=&quot;hljs-property&quot;&gt;your_notifiation_icon&lt;/span&gt;);
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_0&#39;)&quot;&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=&quot;code_1&quot; class=&quot;hljs language-kotlin&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; (android.os.Build.VERSION.SDK_INT &amp;gt;= android.os.Build.VERSION_CODES.LOLLIPOP) {
        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; BitmapFactory.decodeResource(context.getResources(), R.drawable.your_notifiation_icon_lollipop);
    }
    &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt;{
        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; BitmapFactory.decodeResource(context.getResources(), R.drawable.your_notifiation_icon);
    }
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_1&#39;)&quot;&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_2&quot;&gt;Solution 2:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://stackoverflow.com/questions/28387602/notification-bar-icon-turns-white-in-android-5-lollipop&quot;&gt;Notification bar icon turns white in Android 5 Lollipop&lt;/a&gt;&lt;/p&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_3&quot;&gt;Solution 3:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;Although @Pelanes has the correct answer (and should be accepted), here&#39;s what I did. Note that the &lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;https://www.parse.com/docs/android/api/com/parse/ParsePushBroadcastReceiver.html#getSmallIconId(android.content.Context,%20android.content.Intent)&quot;&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 &quot;holes&quot; 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=&quot;solution_4&quot;&gt;Solution 4:

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

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

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/6651761484061559945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/android-51-push-notification-icon-is.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/6651761484061559945'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/6651761484061559945'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/android-51-push-notification-icon-is.html' title='Android 5.1 Push Notification Icon Is Blank'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-4114408831272593631</id><published>2023-10-11T18:21:00.001-07:00</published><updated>2023-10-11T18:21:23.713-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Actionbarsherlock"/><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Android Actionbar"/><category scheme="http://www.blogger.com/atom/ns#" term="Android Layout"/><title type='text'>Actionbar Like Evernote - Up Button And Tabs In One Row On Top With Menu Actions At Bottom</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

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

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

&lt;span class=&quot;hljs-comment&quot;&gt;//helper method&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;void&lt;/span&gt; enableEmbeddedTabs(&lt;span class=&quot;hljs-keyword&quot;&gt;Object&lt;/span&gt; actionBar) {
    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt; {
        Method setHasEmbeddedTabsMethod = actionBar.getClass().getDeclaredMethod(&lt;span class=&quot;hljs-string&quot;&gt;&quot;setHasEmbeddedTabs&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-keyword&quot;&gt;boolean&lt;/span&gt;.&lt;span class=&quot;hljs-keyword&quot;&gt;class&lt;/span&gt;);
        setHasEmbeddedTabsMethod.setAccessible(&lt;span class=&quot;hljs-literal&quot;&gt;true&lt;/span&gt;);
        setHasEmbeddedTabsMethod.invoke(actionBar, &lt;span class=&quot;hljs-literal&quot;&gt;true&lt;/span&gt;);
    } &lt;span class=&quot;hljs-keyword&quot;&gt;catch&lt;/span&gt; (&lt;span class=&quot;hljs-built_in&quot;&gt;Exception&lt;/span&gt; e) {
        Log.e(TAG, &lt;span class=&quot;hljs-string&quot;&gt;&quot;Error marking actionbar embedded&quot;&lt;/span&gt;, e);
    }
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_0&#39;)&quot;&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;for further reference -
&lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;https://groups.google.com/forum/#!topic/actionbarsherlock/hmmB1JqDeCk&quot;&gt;https://groups.google.com/forum/#!topic/actionbarsherlock/hmmB1JqDeCk&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/4114408831272593631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/actionbar-like-evernote-up-button-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/4114408831272593631'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/4114408831272593631'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/actionbar-like-evernote-up-button-and.html' title='Actionbar Like Evernote - Up Button And Tabs In One Row On Top With Menu Actions At Bottom'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-4154918756686809097</id><published>2023-10-11T16:57:00.001-07:00</published><updated>2023-10-11T16:57:26.789-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="Cocos2d X"/><category scheme="http://www.blogger.com/atom/ns#" term="Integration Testing"/><category scheme="http://www.blogger.com/atom/ns#" term="Testing"/><title type='text'>How To Kill Cocos2d-x Test App</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;code_0&quot; class=&quot;hljs language-cpp&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-type&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;hljs-title&quot;&gt;HelloWorld::menuCloseCallback&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;(CCObject* pSender)&lt;/span&gt;&lt;/span&gt;{
&lt;span class=&quot;hljs-meta&quot;&gt;#&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)&lt;/span&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;CCMessageBox&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&quot;You pressed the close button. Windows Store Apps do not implement a close button.&quot;&lt;/span&gt;,&lt;span class=&quot;hljs-string&quot;&gt;&quot;Alert&quot;&lt;/span&gt;);
&lt;span class=&quot;hljs-meta&quot;&gt;#&lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt;&lt;/span&gt;
    CCDirector::&lt;span class=&quot;hljs-built_in&quot;&gt;sharedDirector&lt;/span&gt;()-&amp;gt;&lt;span class=&quot;hljs-built_in&quot;&gt;end&lt;/span&gt;();
&lt;span class=&quot;hljs-meta&quot;&gt;#&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)&lt;/span&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;exit&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;);
&lt;span class=&quot;hljs-meta&quot;&gt;#&lt;span class=&quot;hljs-keyword&quot;&gt;endif&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;hljs-meta&quot;&gt;#&lt;span class=&quot;hljs-keyword&quot;&gt;endif&lt;/span&gt;&lt;/span&gt;
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_0&#39;)&quot;&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&#39;t think Apple will approve you if your app calls exit(0).&lt;/p&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt; 

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/4154918756686809097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/how-to-kill-cocos2d-x-test-app.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/4154918756686809097'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/4154918756686809097'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/how-to-kill-cocos2d-x-test-app.html' title='How To Kill Cocos2d-x Test App'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-6454880485155316793</id><published>2023-10-11T15:42:00.001-07:00</published><updated>2023-10-11T15:42:46.831-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Adt"/><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Android Ndk"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><title type='text'>How To Change Built-in C/c++ Paths Pointing To A Deleted Android-ndk-r9 Installation?</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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&#39;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=&quot;code_1&quot; class=&quot;hljs language-bash&quot;&gt;$ &lt;span class=&quot;hljs-built_in&quot;&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=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_1&#39;)&quot;&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;hr&gt;&lt;blockquote&gt;&lt;p&gt;I&#39;ve grepped the following directories ... &lt;em&gt;&quot;My Eclipse workspace, ~/.eclipse, &quot;&lt;/em&gt; ...&lt;/p&gt;&lt;a name=&#39;more&#39;&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&#39;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=&quot;code_4&quot; class=&quot;hljs language-bash&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;rm&lt;/span&gt; Users/jww/Eclipse/.metadata/.plugins/org.eclipse.cdt.ui/*.&lt;span class=&quot;hljs-built_in&quot;&gt;log&lt;/span&gt;&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_4&#39;)&quot;&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=&quot;solution_2&quot;&gt;Solution 2:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://stackoverflow.com/a/28108753/1591421&quot;&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&#39;t hurt either :)&lt;/p&gt;&lt;/div&gt; 


</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/6454880485155316793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/how-to-change-built-in-cc-paths.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/6454880485155316793'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/6454880485155316793'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/how-to-change-built-in-cc-paths.html' title='How To Change Built-in C/c++ Paths Pointing To A Deleted Android-ndk-r9 Installation?'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-5348727038547073792</id><published>2023-10-11T15:15:00.001-07:00</published><updated>2023-10-11T15:15:28.654-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Android Canvas"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>How To Make Draw Path Smooth While Drawing With Variable Width Stroke</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;code_3&quot; class=&quot;hljs language-cpp&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;hljs-type&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;final&lt;/span&gt;&lt;span class=&quot;hljs-type&quot;&gt;float&lt;/span&gt; STROKE_DELTA = &lt;span class=&quot;hljs-number&quot;&gt;0.0001f&lt;/span&gt;; &lt;span class=&quot;hljs-comment&quot;&gt;// for float comparison&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;hljs-type&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;final&lt;/span&gt;&lt;span class=&quot;hljs-type&quot;&gt;float&lt;/span&gt; STROKE_INCREMENT = &lt;span class=&quot;hljs-number&quot;&gt;0.01f&lt;/span&gt;; &lt;span class=&quot;hljs-comment&quot;&gt;// amount to interpolate&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;hljs-type&quot;&gt;float&lt;/span&gt; currentStroke = STROKE_WIDTH;
&lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;hljs-type&quot;&gt;float&lt;/span&gt; targetStroke = STROKE_WIDTH;
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_3&#39;)&quot;&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=&quot;code_4&quot; class=&quot;hljs language-javascript&quot;&gt;&lt;span class=&quot;hljs-comment&quot;&gt;// if current not roughly equal to target&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt;( &lt;span class=&quot;hljs-title class_&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;hljs-title function_&quot;&gt;abs&lt;/span&gt;(targetStroke - currentStroke) &amp;gt; &lt;span class=&quot;hljs-variable constant_&quot;&gt;STROKE_DELTA&lt;/span&gt; ) {
    &lt;span class=&quot;hljs-comment&quot;&gt;// move towards target by the increment&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt;( targetStroke &amp;gt; currentStroke )
        currentStroke = &lt;span class=&quot;hljs-title class_&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;hljs-title function_&quot;&gt;min&lt;/span&gt;(targetStroke, currentStroke + &lt;span class=&quot;hljs-variable constant_&quot;&gt;STROKE_INCREMENT&lt;/span&gt;);
    &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt;
        currentStroke = &lt;span class=&quot;hljs-title class_&quot;&gt;Math&lt;/span&gt;.&lt;span class=&quot;hljs-title function_&quot;&gt;max&lt;/span&gt;(targetStroke, currentStroke - &lt;span class=&quot;hljs-variable constant_&quot;&gt;STROKE_INCREMENT&lt;/span&gt;);
    mPath.&lt;span class=&quot;hljs-title function_&quot;&gt;lineTo&lt;/span&gt;(mX, mY);

    mPath = &lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;hljs-title class_&quot;&gt;Path&lt;/span&gt;();
    mPath.&lt;span class=&quot;hljs-title function_&quot;&gt;moveTo&lt;/span&gt;(mX,mY);
    mPaths.&lt;span class=&quot;hljs-title function_&quot;&gt;add&lt;/span&gt;(mPath);
    mStrokes.&lt;span class=&quot;hljs-title function_&quot;&gt;add&lt;/span&gt;(currentStroke);
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_4&#39;)&quot;&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=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_2&quot;&gt;Solution 2:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;http://paperjs.org/tutorials/paths/smoothing-simplifying-flattening/#simplifying-paths&quot;&gt;http://paperjs.org/tutorials/paths/smoothing-simplifying-flattening/#simplifying-paths&lt;/a&gt; and the corresponding simplification code: &lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;https://github.com/paperjs/paper.js/blob/master/src/path/PathFitter.js&quot;&gt;https://github.com/paperjs/paper.js/blob/master/src/path/PathFitter.js&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Obviously it&#39;s in JavaScript not Java, but you&#39;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; 


</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/5348727038547073792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/how-to-make-draw-path-smooth-while.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/5348727038547073792'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/5348727038547073792'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/how-to-make-draw-path-smooth-while.html' title='How To Make Draw Path Smooth While Drawing With Variable Width Stroke'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-3287666249748898843</id><published>2023-10-11T13:27:00.001-07:00</published><updated>2023-10-11T13:27:19.128-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Deep Linking"/><category scheme="http://www.blogger.com/atom/ns#" term="Deeplink"/><category scheme="http://www.blogger.com/atom/ns#" term="Uri"/><category scheme="http://www.blogger.com/atom/ns#" term="Url"/><title type='text'>Why Android Does Not Handle A Deeplink Url Which Has # In The Path</title><content type='html'>&lt;div class=&quot;question&quot;&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=&#39;@string/app_name&#39;&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;The &lt;code&gt;#&lt;/code&gt; in a URL indicates the beginning of the &lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;http://uri.thephpleague.com/4.0/components/overview/&quot;&gt;fragment component&lt;/a&gt;, which cannot be used for deep link criteria. Even though you&#39;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&#39;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=&#39;more&#39;&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/3287666249748898843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/why-android-does-not-handle-deeplink.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/3287666249748898843'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/3287666249748898843'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/why-android-does-not-handle-deeplink.html' title='Why Android Does Not Handle A Deeplink Url Which Has # In The Path'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-4033805914866615822</id><published>2023-10-11T12:11:00.001-07:00</published><updated>2023-10-11T12:11:34.966-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Google Maps"/><category scheme="http://www.blogger.com/atom/ns#" term="Offline Caching"/><title type='text'>Everything About Map</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;To start on Google maps, You can refer this link &lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developers.google.com/maps/documentation/android/start&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/&quot;&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=&quot;solution_2&quot;&gt;Solution 2:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;You should use Fragment. It is like that on layout;&lt;/p&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;pre&gt;&lt;code id=&quot;code_0&quot; class=&quot;hljs language-bash&quot;&gt;&amp;lt;fragment
   android:name=&lt;span class=&quot;hljs-string&quot;&gt;&quot;com.google.android.gms.maps.SupportMapFragment&quot;&lt;/span&gt;
   android:&lt;span class=&quot;hljs-built_in&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;@+id/myMapView&quot;&lt;/span&gt;
   android:layout_width=&lt;span class=&quot;hljs-string&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;
   android:layout_height=&lt;span class=&quot;hljs-string&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;
   android:clickable=&lt;span class=&quot;hljs-string&quot;&gt;&quot;true&quot;&lt;/span&gt; /&amp;gt;
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_0&#39;)&quot;&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=&quot;code_1&quot; class=&quot;hljs language-typescript&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;hljs-title class_&quot;&gt;Main&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;hljs-title class_ inherited__&quot;&gt;FragmentActivity&lt;/span&gt;{

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

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

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

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

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

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

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

}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_1&#39;)&quot;&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;You should obtain an apikey for google maps from this &lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;https://code.google.com/apis/console/&quot;&gt;link&lt;/a&gt; or you can continue step by step from this &lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developers.google.com/maps/documentation/android/start&quot;&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=&quot;code_2&quot; class=&quot;hljs language-xml&quot;&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;uses-permission&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:name&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;your_package.permission.MAPS_RECEIVE&quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;uses-permission&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:name&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;android.permission.INTERNET&quot;&lt;/span&gt; /&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;uses-permission&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:name&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;com.google.android.providers.gsf.permission.READ_GSERVICES&quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;uses-permission&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:name&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;android.permission.ACCESS_FINE_LOCATION&quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;meta-data&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:name&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;com.google.android.maps.v2.API_KEY&quot;&lt;/span&gt;&lt;span class=&quot;hljs-attr&quot;&gt;android:value&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot;&gt;&quot;your_api_key&quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_2&#39;)&quot;&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; 


</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/4033805914866615822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/everything-about-map.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/4033805914866615822'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/4033805914866615822'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/everything-about-map.html' title='Everything About Map'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-2181302931323129549</id><published>2023-10-11T11:30:00.001-07:00</published><updated>2023-10-11T11:30:32.285-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Gson"/><category scheme="http://www.blogger.com/atom/ns#" term="Json"/><title type='text'>Gson - Convert From Json To List&lt;&gt;</title><content type='html'>&lt;div class=&quot;question&quot;&gt;i&#39;m having an issue converting Json to List&lt;&gt;, I have tried different solutions but no clue  My json result looks like : {      &#39;Return&#39;:0,    &#39;List&#39;:[         {            &#39;&lt;/div&gt;&lt;h2 id=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;code_1&quot; class=&quot;hljs language-swift&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;hljs-title class_&quot;&gt;QuestionaireList&lt;/span&gt; {
  &lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;hljs-type&quot;&gt;List&lt;/span&gt;&amp;lt;&lt;span class=&quot;hljs-type&quot;&gt;Questionaire&lt;/span&gt;&amp;gt; &lt;span class=&quot;hljs-type&quot;&gt;List&lt;/span&gt;;
}

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

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

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

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

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

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/2181302931323129549/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/gson-convert-from-json-to-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/2181302931323129549'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/2181302931323129549'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/gson-convert-from-json-to-list.html' title='Gson - Convert From Json To List&lt;&gt;'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-7102709758492291057</id><published>2023-10-11T11:00:00.001-07:00</published><updated>2023-10-11T11:00:52.616-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Google Maps Android Api 2"/><title type='text'>Get My Location</title><content type='html'>&lt;div class=&quot;question&quot;&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=&#39;android.permission.ACCESS_FINE_LOCATION&#39; /&gt;  and my&lt;/div&gt;&lt;h2 id=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/&quot;&gt;Getting location (latlong) &lt;/a&gt;&lt;/p&gt;&lt;a name=&#39;more&#39;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://www.youtube.com/playlist?list=PLLk083vNjCXY-5Scs_pTTFlN9Cc-tmIDo&quot;&gt;Getting location from googlemap&lt;/a&gt;&lt;/p&gt;&lt;/div&gt; 

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/7102709758492291057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/get-my-location.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/7102709758492291057'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/7102709758492291057'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/get-my-location.html' title='Get My Location'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-658052133445265140</id><published>2023-10-11T10:39:00.001-07:00</published><updated>2023-10-11T10:39:31.936-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Android Volley"/><category scheme="http://www.blogger.com/atom/ns#" term="Host"/><category scheme="http://www.blogger.com/atom/ns#" term="Php"/><title type='text'>Json Fetch Dosen&#39;t Work Correctly In Real Host But Work In Localhost</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;
&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;after one week i found answer :) my code don&#39;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;
</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/658052133445265140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/json-fetch-dosent-work-correctly-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/658052133445265140'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/658052133445265140'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/json-fetch-dosent-work-correctly-in.html' title='Json Fetch Dosen&#39;t Work Correctly In Real Host But Work In Localhost'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-6469334061303883806</id><published>2023-10-11T07:30:00.001-07:00</published><updated>2023-10-11T07:30:25.597-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Google Play"/><category scheme="http://www.blogger.com/atom/ns#" term="Statistics"/><title type='text'>Is There An Api To Get Sales Report On Google Play?</title><content type='html'>&lt;div class=&quot;question&quot;&gt;We have an Androïd app on Google Play and I&#39;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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developers.google.com/checkout/samplecode&quot;&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=&#39;more&#39;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://play.google.com/store/apps/details?id=com.github.andlyticsproject&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://en.wikipedia.org/wiki/Google_Checkout&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developers.google.com/wallet/&quot;&gt;Google Wallet&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_2&quot;&gt;Solution 2:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;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%%&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://play.google.com/apps/publish/statistics?dev_acc=%%YOUR_ACC_NUMBER%%&quot;&gt;https://play.google.com/apps/publish/statistics?dev_acc=%%YOUR_ACC_NUMBER%%&lt;/a&gt;
POST: method -&amp;gt; &quot;getCombinedStats&quot;&lt;/p&gt;&lt;/div&gt; 


</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/6469334061303883806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/is-there-api-to-get-sales-report-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/6469334061303883806'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/6469334061303883806'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/is-there-api-to-get-sales-report-on.html' title='Is There An Api To Get Sales Report On Google Play?'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-8669695888590363475</id><published>2023-10-11T06:06:00.001-07:00</published><updated>2023-10-11T06:06:25.775-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Android Activity"/><category scheme="http://www.blogger.com/atom/ns#" term="Listview"/><title type='text'>Music Player Play 2 Song At The Same Time</title><content type='html'>&lt;div class=&quot;question&quot;&gt;i&#39;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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developer.android.com/reference/android/media/MediaPlayer.html#release%28%29&quot;&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=&#39;more&#39;&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/8669695888590363475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/music-player-play-2-song-at-same-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/8669695888590363475'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/8669695888590363475'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/music-player-play-2-song-at-same-time.html' title='Music Player Play 2 Song At The Same Time'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-8142909907111905873</id><published>2023-10-11T04:04:00.001-07:00</published><updated>2023-10-11T04:04:08.340-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Reflection"/><title type='text'>Can Reflection Be Used With Methods That Belong To Greater Than Minimum Sdk?</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot; style=&quot;height: auto !important;&quot;&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&#39;s not present in all API levels into a separate class that is only loaded by reflection.&lt;/p&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;p&gt;Here&#39;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=&quot;nofollow noreferrer noopener&quot; href=&quot;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&quot;&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_&#39;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=&quot;solution_2&quot;&gt;Solution 2:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;You don&#39;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=&quot;code_2&quot; class=&quot;hljs language-scss&quot;&gt;if (android.os.Build.VERSION.SDK_INT &amp;gt;= &lt;span class=&quot;hljs-number&quot;&gt;11&lt;/span&gt;) {
    &lt;span class=&quot;hljs-comment&quot;&gt;//Your code here&lt;/span&gt;
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_2&#39;)&quot;&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; 


</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/8142909907111905873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/can-reflection-be-used-with-methods.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/8142909907111905873'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/8142909907111905873'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/can-reflection-be-used-with-methods.html' title='Can Reflection Be Used With Methods That Belong To Greater Than Minimum Sdk?'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-3772931792785973110</id><published>2023-10-11T00:40:00.001-07:00</published><updated>2023-10-11T00:40:25.937-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Apache Poi"/><title type='text'>Docx Conversion</title><content type='html'>&lt;div class=&quot;question&quot;&gt;I am doing simple docx conversion app in android.  File file = new File(path + &#39;Sample1.docx&#39;); FileInputStream fis = new FileInputStream(file);   XWPFDocument document = new XWPFD&lt;/div&gt;
&lt;h2 id=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;
&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;I was able to make &lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;http://www.independentsoft.com&quot;&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;
</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/3772931792785973110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/docx-conversion.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/3772931792785973110'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/3772931792785973110'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/docx-conversion.html' title='Docx Conversion'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-3888676251364932506</id><published>2023-10-10T23:57:00.001-07:00</published><updated>2023-10-10T23:57:02.888-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Sorting"/><title type='text'>Does This Custom Compare Method Contain A Logical Error</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_2&quot;&gt;Solution 2:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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; 


</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/3888676251364932506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/does-this-custom-compare-method-contain.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/3888676251364932506'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/3888676251364932506'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/does-this-custom-compare-method-contain.html' title='Does This Custom Compare Method Contain A Logical Error'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-1149572476596419371</id><published>2023-10-10T23:16:00.001-07:00</published><updated>2023-10-10T23:16:49.074-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><title type='text'>Handling Dvm Killing Your Activity</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;Depending on the data you need to savior you could pass in the data (if it&#39;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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developer.android.com/reference/android/app/Activity.html&quot;&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=&#39;more&#39;&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; 

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/1149572476596419371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/handling-dvm-killing-your-activity.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/1149572476596419371'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/1149572476596419371'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/handling-dvm-killing-your-activity.html' title='Handling Dvm Killing Your Activity'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-8324765711969288174</id><published>2023-10-10T21:58:00.001-07:00</published><updated>2023-10-10T21:58:51.774-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Back Stack"/><title type='text'>Android Backstack Clear But Keep Root</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;Define Activity A1&#39;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=&quot;code_2&quot; class=&quot;hljs language-cpp&quot;&gt;Intent intent = &lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;Intent&lt;/span&gt;(A4.&lt;span class=&quot;hljs-keyword&quot;&gt;this&lt;/span&gt;,  A1.&lt;span class=&quot;hljs-keyword&quot;&gt;class&lt;/span&gt;);
intent.&lt;span class=&quot;hljs-built_in&quot;&gt;addFlags&lt;/span&gt;(Intent.FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
&lt;span class=&quot;hljs-built_in&quot;&gt;startActivity&lt;/span&gt;(intent); 
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_2&#39;)&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developer.android.com/reference/android/content/Intent.html&quot;&gt;See more for intents.&lt;/a&gt;&lt;/p&gt;&lt;a name=&#39;more&#39;&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=&quot;solution_2&quot;&gt;Solution 2:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developer.android.com/design/patterns/actionbar.html&quot;&gt;Action Bar&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;https://developer.android.com/design/patterns/navigation.html&quot;&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=&quot;code_3&quot; class=&quot;hljs language-java&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;final&lt;/span&gt;&lt;span class=&quot;hljs-type&quot;&gt;ActionBar&lt;/span&gt;&lt;span class=&quot;hljs-variable&quot;&gt;actionBar&lt;/span&gt;&lt;span class=&quot;hljs-operator&quot;&gt;=&lt;/span&gt; getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setDisplayHomeAsUpEnabled(&lt;span class=&quot;hljs-literal&quot;&gt;true&lt;/span&gt;);
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_3&#39;)&quot;&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=&quot;code_4&quot; class=&quot;hljs language-cpp&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;final&lt;/span&gt; Intent intent = &lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;Intent&lt;/span&gt;(&lt;span class=&quot;hljs-keyword&quot;&gt;this&lt;/span&gt;, MainPage.&lt;span class=&quot;hljs-keyword&quot;&gt;class&lt;/span&gt;);
intent.&lt;span class=&quot;hljs-built_in&quot;&gt;addFlags&lt;/span&gt;(Intent.FLAG_ACTIVITY_CLEAR_TOP);
&lt;span class=&quot;hljs-built_in&quot;&gt;startActivity&lt;/span&gt;(intent);
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_4&#39;)&quot;&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt; 


</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/8324765711969288174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/android-backstack-clear-but-keep-root.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/8324765711969288174'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/8324765711969288174'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/android-backstack-clear-but-keep-root.html' title='Android Backstack Clear But Keep Root'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-8824832668666647810</id><published>2023-10-10T20:39:00.001-07:00</published><updated>2023-10-10T20:39:25.568-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Android Button"/><title type='text'>How To Prevent Double Code Running By Clicking Twice Fast To A Button In Android</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;code_0&quot; class=&quot;hljs language-typescript&quot;&gt;btn.&lt;span class=&quot;hljs-title function_&quot;&gt;setOnclickListener&lt;/span&gt;(&lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;hljs-title class_&quot;&gt;View&lt;/span&gt;.&lt;span class=&quot;hljs-title function_&quot;&gt;onClickListener&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;&lt;/span&gt;){

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

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

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

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

                view.&lt;span class=&quot;hljs-title function_&quot;&gt;setEnabled&lt;/span&gt;(&lt;span class=&quot;hljs-literal&quot;&gt;true&lt;/span&gt;);
            }
        });
    }
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_1&#39;)&quot;&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=&#39;more&#39;&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=&quot;code_2&quot; class=&quot;hljs language-kotlin&quot;&gt;&lt;span class=&quot;hljs-class&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;hljs-title&quot;&gt;SafeClickListener&lt;/span&gt;&lt;/span&gt;(
        &lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; defaultInterval: &lt;span class=&quot;hljs-built_in&quot;&gt;Int&lt;/span&gt; = &lt;span class=&quot;hljs-number&quot;&gt;1000&lt;/span&gt;,
        &lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;val&lt;/span&gt; onSafeCLick: (View) -&amp;gt; &lt;span class=&quot;hljs-built_in&quot;&gt;Unit&lt;/span&gt;
) : View.OnClickListener {

    &lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; lastTimeClicked: &lt;span class=&quot;hljs-built_in&quot;&gt;Long&lt;/span&gt; = &lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;override&lt;/span&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;fun&lt;/span&gt;&lt;span class=&quot;hljs-title&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;(v: &lt;span class=&quot;hljs-type&quot;&gt;View&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt; {
        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; (SystemClock.elapsedRealtime() - lastTimeClicked &amp;lt; defaultInterval) {
            &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt;
        }
        lastTimeClicked = SystemClock.elapsedRealtime()
        onSafeCLick(v)
    }
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_2&#39;)&quot;&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=&quot;code_3&quot; class=&quot;hljs language-kotlin&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;fun&lt;/span&gt; View.&lt;span class=&quot;hljs-title&quot;&gt;setSafeOnClickListener&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;(onSafeClick: (&lt;span class=&quot;hljs-type&quot;&gt;View&lt;/span&gt;) -&amp;gt; &lt;span class=&quot;hljs-type&quot;&gt;Unit&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt; {

    &lt;span class=&quot;hljs-keyword&quot;&gt;val&lt;/span&gt; safeClickListener = SafeClickListener {
        onSafeClick(it)
    }
    setOnClickListener(safeClickListener)
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_3&#39;)&quot;&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=&quot;code_4&quot; class=&quot;hljs language-scss&quot;&gt;settingsButton&lt;span class=&quot;hljs-selector-class&quot;&gt;.setSafeOnClickListener&lt;/span&gt; {
    &lt;span class=&quot;hljs-built_in&quot;&gt;showSettingsScreen&lt;/span&gt;()
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_4&#39;)&quot;&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;Happy Kotlin ;)&lt;/p&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_3&quot;&gt;Solution 3:

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

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;Well, that&#39;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=&quot;singleInstance&quot;&lt;/code&gt; for Top20 activity in your AndroidManifest.xml&lt;/p&gt;&lt;/div&gt;&lt;h2 id=&quot;solution_5&quot;&gt;Solution 5:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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=&quot;code_7&quot; class=&quot;hljs language-scss&quot;&gt;intent&lt;span class=&quot;hljs-selector-class&quot;&gt;.setFlags&lt;/span&gt;(Intent.FLAG_ACTIVITY_CLEAR_TOP);
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_7&#39;)&quot;&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;/div&gt; 

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/8824832668666647810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/how-to-prevent-double-code-running-by.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/8824832668666647810'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/8824832668666647810'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/how-to-prevent-double-code-running-by.html' title='How To Prevent Double Code Running By Clicking Twice Fast To A Button In Android'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-7566370814218587165</id><published>2023-10-10T19:27:00.001-07:00</published><updated>2023-10-10T19:27:27.882-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Ffmpeg"/><title type='text'>Ffmpeg Jni In Android?</title><content type='html'>&lt;div class=&quot;question&quot;&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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;&lt;div class=&quot;answer-desc&quot;&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&#39;s an example of a JNI method implemented in C from the Android NDK samples:&lt;/p&gt;&lt;pre&gt;&lt;code id=&quot;code_0&quot; class=&quot;hljs language-bash&quot;&gt;jstring
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* &lt;span class=&quot;hljs-built_in&quot;&gt;env&lt;/span&gt;,
                                                  jobject thiz )
{
    &lt;span class=&quot;hljs-built_in&quot;&gt;return&lt;/span&gt; (*&lt;span class=&quot;hljs-built_in&quot;&gt;env&lt;/span&gt;)-&amp;gt;NewStringUTF(&lt;span class=&quot;hljs-built_in&quot;&gt;env&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&quot;Hello from JNI !&quot;&lt;/span&gt;);
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_0&#39;)&quot;&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=&quot;code_1&quot; class=&quot;hljs language-csharp&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;hljs-title&quot;&gt;HelloJni&lt;/span&gt;
{
    &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt; native String  &lt;span class=&quot;hljs-title&quot;&gt;stringFromJNI&lt;/span&gt;()&lt;/span&gt;;

     &lt;span class=&quot;hljs-keyword&quot;&gt;static&lt;/span&gt; {
        System.loadLibrary(&lt;span class=&quot;hljs-string&quot;&gt;&quot;hello-jni&quot;&lt;/span&gt;);
    }
}
&lt;/code&gt;&lt;button class=&quot;copy-btn btn btn-secondary btn-sm&quot; onclick=&quot;copyCode(this,&#39;code_1&#39;)&quot;&gt;Copy&lt;/button&gt;&lt;/pre&gt;&lt;p&gt;I found &lt;a rel=&quot;nofollow noreferrer noopener&quot; href=&quot;http://jffmpeg.sourceforge.net/&quot;&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=&#39;more&#39;&gt;&lt;/a&gt;&lt;p&gt;There&#39;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=&quot;nofollow noreferrer noopener&quot; href=&quot;https://code.google.com/p/javacv/wiki/JNAOnAndroid&quot;&gt;this project&lt;/a&gt; for an Android implementation. (I have never used it myself)&lt;/p&gt;&lt;/div&gt; 

</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/7566370814218587165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/ffmpeg-jni-in-android.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/7566370814218587165'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/7566370814218587165'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/ffmpeg-jni-in-android.html' title='Ffmpeg Jni In Android?'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1108893505436407755.post-1853373151941023402</id><published>2023-10-10T18:42:00.001-07:00</published><updated>2023-10-10T18:42:04.168-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Glsl"/><category scheme="http://www.blogger.com/atom/ns#" term="Glsles"/><category scheme="http://www.blogger.com/atom/ns#" term="Opengl Es"/><title type='text'>Opengl Es 3.0 Matrix Array Only Using First Matrix</title><content type='html'>&lt;div class=&quot;question&quot;&gt;I am doing GPU skinning in my vertex shader which works fine on PC, and which I&#39;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=&quot;solution_1&quot;&gt;Solution 1:

&lt;/h2&gt;
&lt;div class=&quot;answer-desc&quot;&gt;&lt;p&gt;In the end this looks to be a limitation of the Adreno driver, which doesn&#39;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;
</content><link rel='replies' type='application/atom+xml' href='https://dreamlikehotels.blogspot.com/feeds/1853373151941023402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/opengl-es-30-matrix-array-only-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/1853373151941023402'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1108893505436407755/posts/default/1853373151941023402'/><link rel='alternate' type='text/html' href='https://dreamlikehotels.blogspot.com/2023/10/opengl-es-30-matrix-array-only-using.html' title='Opengl Es 3.0 Matrix Array Only Using First Matrix'/><author><name>Beverly Graham</name><uri>http://www.blogger.com/profile/17705646485041071713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>