<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mehmet Gür on Medium]]></title>
        <description><![CDATA[Stories by Mehmet Gür on Medium]]></description>
        <link>https://medium.com/@mehmetgur?source=rss-b81a85e852fc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QFeLwwzRxS4gOJ6y6AMnpw.jpeg</url>
            <title>Stories by Mehmet Gür on Medium</title>
            <link>https://medium.com/@mehmetgur?source=rss-b81a85e852fc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 22:13:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mehmetgur/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Android Crash Guide]]></title>
            <link>https://medium.com/digigeek/android-crash-guide-1cf8af474049?source=rss-b81a85e852fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/1cf8af474049</guid>
            <category><![CDATA[google-play-store]]></category>
            <category><![CDATA[android-crash]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-development]]></category>
            <dc:creator><![CDATA[Mehmet Gür]]></dc:creator>
            <pubDate>Sun, 23 Nov 2025 15:12:37 GMT</pubDate>
            <atom:updated>2025-12-09T07:57:57.271Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cg3weBADgVH7caXk07zloA.png" /></figure><p>Google Play defines two <strong>bad behavior thresholds</strong> for crash metrics:</p><p><strong>Overall bad behavior threshold:</strong> If at least <strong>1.09%</strong> of daily active users experience a user-based crash across all device models.</p><p><strong>Per-device bad behavior threshold:</strong> If at least <strong>8%</strong> of daily active users on a specific device model experience a user-perceived crash.</p><p>If your app exceeds the <strong>overall</strong> bad behavior threshold, discoverability on the Play Store can be reduced across all devices.</p><p>If the <strong>per-device</strong> threshold is exceeded for some devices, discoverability may be reduced on those devices and a warning can be shown on the app’s Play Store page.</p><p>A <a href="https://www.dotcominfoway.com/blog/infographic-why-users-uninstall-your-app/">DCI study </a>found that <strong>62%</strong> of users who experience crashes uninstall the app.</p><h3>Common Crashes</h3><h4>1 - NullPointerException (NPE)</h4><p>Thrown when accessing a null reference. This is the most common Android crash type.</p><p><strong>Common causes</strong></p><ul><li>Incorrect use of safe call (?.) or forced non-null (!!) operators.</li><li>Data returned from a ViewModel or repository may be null.</li><li>remember or mutableStateOf variables used before initialization.</li><li>Accessing state without lifecycle synchronization.</li></ul><p><strong>Fixes</strong></p><ul><li>Prefer safe operators (?., ?:) and avoid !!.</li><li>Initialize ViewModel StateFlows with default (non-null) values.</li><li>Handle null in all checks.</li></ul><h4>2 - IndexOutOfBoundsException</h4><p>Occurs when trying to access outside the bounds of a list or array.</p><p><strong>Common causes</strong></p><ul><li>Index access on an empty list.</li><li>Off-by-one or incorrect indices in charAt, substring, etc.</li><li>Start index &lt; 0 or accessed index &gt;= list size.</li></ul><p><strong>Fixes</strong></p><ul><li>Use safe access helpers like list.getOrNull(1) instead of list[1] and validate sizes before indexing.</li></ul><h4>3 - OutOfMemoryError</h4><p>Raised when memory runs out. More common on older devices with limited RAM or when the OS needs memory for higher-priority tasks.</p><p><strong>Common causes</strong></p><ul><li>Decoding large bitmaps or loading unoptimized images in Compose.</li><li>Holding object references too long, causing memory leaks.</li><li>Poorly managed background/threaded work.</li></ul><p><strong>Fixes</strong></p><ul><li>Load images and large data efficiently, use appropriate formats and libraries, and use lazy loading.</li><li>Use Android Profiler to inspect memory and LeakCanary (CanaryLeak) to detect leaks.</li><li>Apply proper memory-release patterns: set unnecessary references to null, close/clear DB or SDK connections when done.</li><li>To test low-memory scenarios, create an emulator with low memory capacity.</li></ul><h4>4 - IllegalArgumentException</h4><p><strong>Common causes</strong></p><ul><li>Wrong argument types in Compose Navigation.</li><li>Passing parameters in incorrect format to APIs.</li><li>Forgetting to declare an Activity in the AndroidManifest.</li></ul><p><strong>Fixes</strong></p><ul><li>Validate navigation arguments and NavTypes and pass correct references.</li></ul><h4>5 - IllegalStateException</h4><p>Usually related to lifecycle management.</p><p><strong>Common causes</strong></p><ul><li>Running coroutines outside the appropriate ViewModel scope.</li><li>Accessing state before composition is finished in Compose.</li></ul><p><strong>Fixes</strong></p><ul><li>Use functions in the correct coroutine scopes.</li><li>Use Compose lifecycle-aware effects (LaunchedEffect, DisposableEffect) correctly.</li></ul><h4>6 - ClassCastException</h4><p>Thrown on invalid type conversion.</p><p><strong>Common causes</strong></p><ul><li>Unsafe use of the as operator.</li><li>Incorrect generic casts.</li></ul><p><strong>Fixes</strong></p><ul><li>Use safe casts (as?) and validate types before casting.</li></ul><h4>7 - Network Exceptions</h4><p>To simulate unexpected network changes when your app makes network calls, you can toggle airplane mode while testing or throttle network on the emulator. Another option is to reduce emulator network speed and add delay:</p><pre>emulator -avd [your-avd-image] -netdelay 20000 -netspeed gsm</pre><p>This example adds a <strong>20-second delay</strong> to all network requests and sets upload/download speed to <strong>14.4 Kbps</strong>, simulating a very slow network.</p><h3>Conclusion</h3><p>Crashes are one of the biggest factors impacting user trust, retention, and Play Store visibility. By understanding the most common crash types, their root causes, and how to prevent them, teams can significantly improve app stability and user satisfaction. Regular monitoring of Google Play crash metrics, proactive testing across device types and network conditions, and adopting best practices in memory, lifecycle, and state management will help ensure a more reliable Android experience for all users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cf8af474049" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digigeek/android-crash-guide-1cf8af474049">Android Crash Guide</a> was originally published in <a href="https://medium.com/digigeek">DigiGeek</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jetpack Compose Pagination with 3 Lines of Code]]></title>
            <link>https://mehmetgur.medium.com/jetpack-compose-pagination-with-3-lines-of-code-218f92ff5b52?source=rss-b81a85e852fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/218f92ff5b52</guid>
            <category><![CDATA[pagination]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Mehmet Gür]]></dc:creator>
            <pubDate>Fri, 06 Oct 2023 10:33:36 GMT</pubDate>
            <atom:updated>2023-10-06T10:36:03.581Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*iqe_wKSwLw4qNzjGXkNezg.png" /></figure><p>Implementing pagination on Android by using Paging Library is headache. It’s complex process and requires a loooot of codes to implement PagedListAdapter, PagingSource, refresh keys etc. The good news is we can get rid of this godforsaken library with just a few lines of code using Jetpack Compose.</p><p>Here is the example of ViewModel;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9179d6b547be603bacde97408a3be0ae/href">https://medium.com/media/9179d6b547be603bacde97408a3be0ae/href</a></iframe><p>Here we’re getting the response from the backend and checking if notification list is empty or not. Accordingly, we can decide whether to <strong>load more data or not.</strong></p><p>UI;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3369d67202abddb993858f4c3253f729/href">https://medium.com/media/3369d67202abddb993858f4c3253f729/href</a></iframe><p>In this composable function we get <strong><em>listState</em></strong> to detect if <strong>scroll</strong> event reached to the <strong>end of the list</strong>. If that’s is the case and <strong><em>shouldLoadMore</em></strong> is <strong><em>true </em></strong>(it means notificationList that comes from backend is not empty and there are new values) we again call the function and send request to backend with the <strong>page number</strong> to get the rest of the list.</p><p>That’s it. It’s over.</p><p>Thanks for reading and I hope it can help.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=218f92ff5b52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Uploading Files to AWS S3 with Progress - Kotlin]]></title>
            <link>https://medium.com/getir/uploading-files-to-aws-s3-with-progress-kotlin-f9a8e2ee2d5d?source=rss-b81a85e852fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9a8e2ee2d5d</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[s3-bucket]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Mehmet Gür]]></dc:creator>
            <pubDate>Wed, 24 Aug 2022 12:20:25 GMT</pubDate>
            <atom:updated>2022-08-24T12:20:25.758Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*cDHe5Q_RDkNt_g-KKxZVcw.png" /></figure><p>In this post we’ll use <strong>Kotlin Coroutines</strong> and <strong>Retrofit2</strong> to upload files to S3 Bucket on Android. In our case, we get S3 url from our backend server. So this post will be more about the file uploading part.</p><p>First, create a function to choose file :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0eae63292dba598ee1cf8e3838fb619/href">https://medium.com/media/c0eae63292dba598ee1cf8e3838fb619/href</a></iframe><p>We used registerForFiles.launch(this) to get the result of this intent. So now we need to create an <a href="https://developer.android.com/training/basics/intents/result"><strong>ActivityResultLauncher</strong></a><strong> </strong>named registerForFiles:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2239c9546268a574de55d89bd554dd1a/href">https://medium.com/media/2239c9546268a574de55d89bd554dd1a/href</a></iframe><p>In the above codes, we got the URI of selected file. We’ll use this URI to create a RequestBody. Why we need to create a RequestBody? Well! Normally files can be uploaded to server as MultipartBody.Part on Android but using MultiPartBody can cause problems as mentioned <a href="https://stackoverflow.com/questions/70820695/error-uploading-file-on-aws-android-retrofit">here</a>.</p><p>We will create our own RequestBody because later we’ll add some code to this class to show the progress of the uploading status. Let’s create a RequestBody:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b939b6eb9f2212c24a8239d49599bf30/href">https://medium.com/media/b939b6eb9f2212c24a8239d49599bf30/href</a></iframe><p>With that class we can get the media type and content length of the file from the file URI. writeTo() function opens an inputStream to the file and it’s used to transmit the file. We’re also using ContentResolver to access and operate on files.</p><p>Now we can create a Retrofit function to upload this RequestBody as a file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d83a25a6f13e4f4ac9a1ef3d90e0845/href">https://medium.com/media/3d83a25a6f13e4f4ac9a1ef3d90e0845/href</a></iframe><p>That’s it! Now we can call this function in a Fragment and upload files.</p><p>Note: In our case that contentType was handling from backend. So I didn’t need to send it to server but it might be required in your case. If it’s, you can get contentType from the file URI.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0fca7a3cb92ece0a9756ac2a36aae8e/href">https://medium.com/media/f0fca7a3cb92ece0a9756ac2a36aae8e/href</a></iframe><p><strong>Now we’re able to send the files to Amazon S3 Bucket. It’s done!!!</strong></p><p>If you want you can also add a progressBar to observe uploading status of the file according to uploaded bytes of the file. To do this we need to make some changes in our FileRequestBody class. So let’s do this!</p><p>First edit FileRequestBody class like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f70c59c6f8f076d2d86d94e52b99829/href">https://medium.com/media/7f70c59c6f8f076d2d86d94e52b99829/href</a></iframe><p>We added a higher-order function as parameter to observe uploading status of the files. writtenBytes represents the uploaded bytes to server and contentLength represents the total file size. Due to writeTo() function runs multiple times we can get proper writtenBytes values.</p><p>Transmitting the request body is performed by writing it to a Sink, we will wrap the default sink with our own one that counts the bytes that are transmitted and reports them back via a progress callback. We can wrap the default sink into our new CountingSink and write to a buffered version of that, in order to both transmit the file and observe its progress.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ef00887fb10ee20c323e36898bf71b2/href">https://medium.com/media/0ef00887fb10ee20c323e36898bf71b2/href</a></iframe><p>We are able to get written bytes of the file. Now all we have to do is update a progressBar according to this writtenBytes in UI:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17940e5e1e6647ec68ceccf975aa8d68/href">https://medium.com/media/17940e5e1e6647ec68ceccf975aa8d68/href</a></iframe><p>Set android:max=&quot;100&quot; attr of progressBar in XML. So the progressBar will be updated according to uploading status.</p><p>Thanks for reading! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9a8e2ee2d5d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/getir/uploading-files-to-aws-s3-with-progress-kotlin-f9a8e2ee2d5d">Uploading Files to AWS S3 with Progress - Kotlin</a> was originally published in <a href="https://medium.com/getir">Getir</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android-Kotlin Custom Snackbar]]></title>
            <link>https://medium.com/mobvenlab-eng/android-kotlin-custom-snackbar-4e879f776d3f?source=rss-b81a85e852fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e879f776d3f</guid>
            <category><![CDATA[snackbar]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[toast]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Mehmet Gür]]></dc:creator>
            <pubDate>Fri, 11 Mar 2022 12:30:46 GMT</pubDate>
            <atom:updated>2022-03-11T12:30:46.155Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*z2SRmRZ50pwjTLV0fAR41Q.jpeg" /></figure><p>We could use custom Toast to display a message on screen. But with Android API 30 custom toasts and <a href="https://developer.android.com/reference/android/widget/Toast#getView()">getView</a>() method are deprecated.</p><p>The official document says;</p><blockquote>Custom toast views are deprecated. Apps can create a standard text toast with the <a href="https://developer.android.com/reference/android/widget/Toast#makeText(android.content.Context,%20java.lang.CharSequence,%20int)"><strong>makeText(android.content.Context, java.lang.CharSequence, int)</strong></a> method, or use a <a href="https://developer.android.com/reference/com/google/android/material/snackbar/Snackbar">Snackbar</a> when in the foreground. Starting from Android <a href="https://developer.android.com/reference/android/os/Build.VERSION_CODES#R"><strong>Build.VERSION_CODES#R</strong></a>, apps targeting API level <a href="https://developer.android.com/reference/android/os/Build.VERSION_CODES#R"><strong>Build.VERSION_CODES#R</strong></a> or higher that are in the background will not have custom toast views displayed.</blockquote><p>So according to the document we can use custom SnackBar instead of custom toast for same purposes. Snackbars include user-actionable options, which can provide a better app experience.</p><p>Okayyy let’s create a layout file which will represent custom snackbar;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b2c907ab1b7515dd6756cd85642950f/href">https://medium.com/media/3b2c907ab1b7515dd6756cd85642950f/href</a></iframe><p>Now we can create a file named Context.kt for extensions and write an extension function for Context;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/77939eb1367927e8c1dad4605bef5db9/href">https://medium.com/media/77939eb1367927e8c1dad4605bef5db9/href</a></iframe><p>This function takes 2 parameter. Our message and a View to hold Snackbar’s view from the value given to container. Then, we add layout that we created and bind it with DataBinding(dataBinding part is optional). After that, we can create a snackbar and add view(our parameter named container) and duration(just like toast message) to it. At last of course call show() function of snackbar.</p><p>Finally we can call this function from a Fragment like that;</p><pre>requireContext().<em>showCustomSnackBar</em>(getString(R.string.saved),<br>    <em>activity</em>?.findViewById(android.R.id.<em>content</em>)<br>)</pre><p>We gave a message and root view for function parameters and now it’s ready to display a custom toast .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*XB7mt2-BxpVmdzgnbPg_EQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e879f776d3f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobvenlab-eng/android-kotlin-custom-snackbar-4e879f776d3f">Android-Kotlin Custom Snackbar</a> was originally published in <a href="https://medium.com/mobvenlab-eng">MobvenLab Eng</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android - Barcode Scanner with Google ML Kit]]></title>
            <link>https://medium.com/mobvenlab-eng/android-barcode-scanner-with-google-ml-kit-afa5c0fb6118?source=rss-b81a85e852fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/afa5c0fb6118</guid>
            <category><![CDATA[barcode-scanner]]></category>
            <category><![CDATA[ml-kit]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[Mehmet Gür]]></dc:creator>
            <pubDate>Fri, 03 Dec 2021 13:19:15 GMT</pubDate>
            <atom:updated>2021-12-03T13:19:15.499Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*MRHb2a9iaghBPRwR-qOh8g.png" /></figure><h4>What are Google ML Kit and CameraX Library?</h4><p><a href="https://developers.google.com/ml-kit/vision/barcode-scanning/android">ML Kit</a> is a powerful Machine Learning library optimized for mobile applications. There are a lot of APIs in this library like barcode scanning, face detection, image labeling, text recognition etc. With <strong>ML Kit’s barcode scanning API</strong>, we can read data encoded using most standard barcode formats. Barcode scanning happens on the device, and doesn’t require a network connection.</p><p><a href="https://developer.android.com/training/camerax">CameraX</a> is a Jetpack support library, built to help you make camera app development easier. It provides a consistent and easy-to-use API surface that works across most Android devices, with backward-compatibility to Android 5.0 (API level 21). For example it calculates the rotation value of the scanned image. So we don’t have to do anything for this calculation.</p><p><strong>Let’s start!</strong></p><h4>1- Dependencies and Manifest</h4><ul><li>Add the dependencies into application-level build.gradle file:</li></ul><pre>// Barcode scanning API<br>implementation &#39;com.google.mlkit:barcode-scanning:17.0.0&#39;<br><br>def camerax_version = &quot;1.0.1&quot;<br><em>// CameraX core library using camera2 implementation<br></em>implementation &quot;androidx.camera:camera-camera2:$camerax_version&quot;<br><em>// CameraX Lifecycle Library<br></em>implementation &quot;androidx.camera:camera-lifecycle:$camerax_version&quot;<br><em>// CameraX View class<br></em>implementation &quot;androidx.camera:camera-view:1.0.0-alpha27&quot;</pre><ul><li>Add the CAMERA permission into AndroidManifest.xml file:</li></ul><pre>&lt;uses-permission android:name=&quot;android.permission.CAMERA&quot; /&gt;</pre><h4><strong>2- </strong>ImageAnalyzer Class</h4><ul><li>Create a class that implement ImageAnalysis.Analyzer interface. This interface is used to receive images and perform custom processing by implementing analyze(ImageProxy)function. So we can do all the scanning logic here:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ee6872ad22e4e8ea571e6e5a3e8d419/href">https://medium.com/media/0ee6872ad22e4e8ea571e6e5a3e8d419/href</a></iframe><p>That’s it! Let’s explain this code block:</p><ul><li>First, we created <strong>scanBarcode </strong>function that takes <strong>ImageProxy</strong> parameter. Then we passed <strong>image</strong> and <strong>rotationDegrees</strong> properties of ImageProxy to inputImage value. “<strong>rotationDegree” </strong>is<strong> </strong>calculated automatically by CameraX.</li><li>We can choose which barcode type to be scanned. In this example only “FORMAT_QR_CODE<strong>” </strong>is added but there are a lot of supported <a href="https://developers.google.com/ml-kit/vision/barcode-scanning/android#1.-configure-the-barcode-scanner">types</a>. Actually this step is optional so if we don’t add any type, the Scanner scan for all barcode types. But choosing certain types is more optimized and faster.</li><li>In the last step, we passed <strong>addOnCompleteListener</strong> to <strong>scanner.process(inputImage)</strong>. It is important to call the image.close()<strong> </strong>method once the analysis is completed. This will free the analysis queue for other images to be processed. “addOnCompleteListener” gives a barcode list so if task is successful taking first item of the list will be enough. “<strong>barcode.rawValue” </strong>is our scanned barcode value and we can pass this to a listener to use in our Activity/Fragment.</li></ul><p><strong>Note</strong>: Instead of if/else block you can use “addOnSuccessListener” and “addOnFailureListener”. They will give same result. You can choose whatever you want.</p><h4>3- PreviewView</h4><p>PreviewView is responsible for displaying the camera preview on the screen.</p><pre>    &lt;androidx.camera.view.PreviewView<br>        android:id=&quot;@+id/preview_view&quot;<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;match_parent&quot; /&gt;</pre><h4>4- Camera Permissions</h4><p>In Fragment we need to take camera permission.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/493321d88fbfb01ecb78f0046c601545/href">https://medium.com/media/493321d88fbfb01ecb78f0046c601545/href</a></iframe><h4>5- Setup Preview</h4><ul><li>First add these values ​​at the top of the class:</li></ul><pre>private lateinit var <strong>cameraProviderFuture</strong>: ListenableFuture&lt;ProcessCameraProvider&gt;</pre><pre>private val <strong>cameraExecutor</strong> = Executors.newSingleThreadExecutor()</pre><pre>private var imageAnalyzer: ImageAnalyzer? = null</pre><p><strong>cameraProvideFuture </strong>will bind the camera lifecycle to the application.</p><p><strong>cameraExecutor </strong>will be responsible for tracking the tasks generated by the camera.</p><ul><li>Create a function that bind Preview use case with PreviewView we defined in our XML(<strong>binding.previewView</strong>).</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/38950d2904f848ee240ceb1f6d19d010/href">https://medium.com/media/38950d2904f848ee240ceb1f6d19d010/href</a></iframe><ul><li>First we configured camera settings and bind our previewView. Then added ideal target resolution values.</li><li>“<strong>setAnalyzer()</strong>” method of ImageAnalyzer is called here and required parameters added.</li><li>“<strong>cameraProvider.bindToLifeCycle()</strong>” method binds preview to the lifecycle of our Fragment/Activity.</li></ul><h4>6- Scanning Barcode</h4><p>Almost done! This is last step. We can create a function that invoke scanner listener we create in ImageAnalyzer class and configure <strong>cameraProvideFuture</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b1513fdae3888199aec3d220a7d5800/href">https://medium.com/media/1b1513fdae3888199aec3d220a7d5800/href</a></iframe><p>We called “<strong>bindPreview()”</strong> function in “cameraProviderFuture.addListener” and passed “cameraProviderFuture.get()” parameter. In “scannerListener” we display a toast message that shows barcode value.</p><p><strong>Note:</strong> Don’t forget to add these to “<strong>onDestroyView()</strong>”:</p><pre>override fun onDestroyView() {<br>    super.onDestroyView()<br>    if (::cameraProviderFuture.<em>isInitialized</em>) {<br>        cameraProviderFuture.get().unbindAll()<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GDcIUluzoNfvKDmwKYLbzA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afa5c0fb6118" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobvenlab-eng/android-barcode-scanner-with-google-ml-kit-afa5c0fb6118">Android - Barcode Scanner with Google ML Kit</a> was originally published in <a href="https://medium.com/mobvenlab-eng">MobvenLab Eng</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[İnsanoğlunun Uzay Gecikmişliği]]></title>
            <link>https://mehmetgur.medium.com/i%CC%87nsano%C4%9Flunun-uzay-gecikmi%C5%9Fli%C4%9Fi-a80d5e01caa7?source=rss-b81a85e852fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a80d5e01caa7</guid>
            <category><![CDATA[uzay]]></category>
            <category><![CDATA[mars]]></category>
            <category><![CDATA[bilim]]></category>
            <category><![CDATA[tarih]]></category>
            <dc:creator><![CDATA[Mehmet Gür]]></dc:creator>
            <pubDate>Sun, 10 Jan 2021 20:06:17 GMT</pubDate>
            <atom:updated>2021-11-14T22:01:08.868Z</atom:updated>
            <content:encoded><![CDATA[<h3>Uzay Gecikmişliği</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YWVpa6keh8U_Q1R5Ze7oWg.jpeg" /></figure><p>Bu yazıya <strong>“Otostopçunun Galaksi Rehberi”</strong> adlı kitaptan kısa bir kesitle başlamak istiyorum. Bu kitap, Dünya uzaylılar tarafından yok edildikten sonra bir şekilde kurtulmayı başaran bir insanın ve onun uzaylı arkadaşının(otostopçu) yaşadığı yıldızlararası macerayı anlatmaktadır.</p><blockquote>Devasa gemileriyle gökyüzünde beliren uzaylılar tüm yerkürede duyulabilecek bir anons yaparlar. Güneş Sistemi’nden geçecek olan bir kestirme yol inşa edilmesi nedeniyle Dünya’nın yok edileceğini açıklarlar. İnsanların yaptığı panik sonucunda uzaylılar tekrar anons yapar ve bu yıkım emrinin 50 yıl boyunca <strong>Alfa Centauri</strong>’deki planlama dairesinde asılı olduğunu, insanların şikayette bulunmaları için bol vakitleri olduğunu ve artık bu konuda yaygara koparmak için çok geç kaldıklarını söylerler.</blockquote><blockquote>Bu arada birileri bu uzay gemisine bir şekilde mesaj gönderip gezegen adına bir ricada bulunur. Bunun üzerine son kez anons yapılır ve bu sefer ses öfkelidir:</blockquote><blockquote>“Alfa Centauri’ye giden kimse olmadı da ne demek? Tanrı aşkına, insanoğlu, biliyorsunuz ki orası <strong>sadece dört ışık yılı uzaklıkta</strong>. Kusura bakmayın ama çevrenizde olanlarla ilgilenmeye zahmet etmiyorsanız, bu sizin sorununuz. Sizi kahrolası ilgisiz gezegen, sizlere karşı hiçbir sempati beslemiyorum.” :D</blockquote><blockquote>Ve Dünya yok edilir…</blockquote><p>Otostopçunun Galaksi Rehberi, her ne kadar mizah-bilim kurgu türünde olsa da yer yer önemli mesajlar vermektedir. İnsanların Dünya’dan tam olarak çıkamamış olmaları trajik bir şekilde sonuçlanmaktadır. Öyle ki bu kitap <strong>Elon Musk, Jeff Bezos</strong> gibi önemli kişileri de etkilemiştir.</p><p>İnsanoğlunun uzay serüveni, 1957 yılında Sovyetler Birliği’nin <strong>Sputnik 1</strong> adlı ilk yapay uyduyu yörüngeye fırlatmasıyla başlar. Yine Sovyetler, 1961 yılında uzaya insan(<strong>Yuri Gagarin</strong>) göndermeyi başararak bir kez daha ilke imza atar. Bu önemli gelişmeler karşısında Sovyetler ile Soğuk Savaş’da rekabet halinde olan ABD, uzay çalışmalarına daha fazla önem ve hız verir. İki devlet arasındaki bu rekabette Sovyetler başlangıçta açık ara üstün durumdadır. Fakat ABD’nin başlattığı <strong>Apollo Programı</strong> 1969&#39;da başarıyla hedefine ulaşır ve astronot <strong>Neil Armstrong </strong>Ay’da yürüyen ilk insan olur. ABD o dönemin şartlarında çok zor olan bu görevi başarıyla gerçekleştirerek Uzay Yarışı’nda öne geçer. Bu dönemden sonra iki devlet de uzay istasyonu kurarak çalışmalarına devam ederler. Fakat bu dönemlerden sonra özellikle ekonomik nedenlerden dolayı uzay çalışmarındaki hız büyük oranda azalır. 90&#39;lı yıllarda Sovyetler Birliği dağıldığından dolayı uzay yarışındaki rekabet tamamen biter. Rekabet az ise gelişim de azdır. Bu dönemde NASA’nın çalışmaları da azalır. Özellikle ABD, NASA’ya uzay çalışmaları için ayırdığı bütçeyi büyük oranda azaltır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*--MT8a6Au7aK_lTBlgTofw.png" /><figcaption>NASA’ya ayrılan bütçe oranının yıllık değişimi</figcaption></figure><p>Gelin iki dönemi kıyaslayan önemli bir karşılaştırma yapalım; Ay’a ilk ayak bastığımız tarihten 50 yıl öncesine gidelim. <strong>1919</strong> yılında uçaklar ilkel bir formdaydı ve genelde bu planörlü uçaklar savaşta keşif amacıyla kullanılmıştı. O dönemde yaşayan insanların aklından 50 yıl içinde Ay’a ulaşacak bir araç yapılması geçmiyordu muhtemelen. Fakat 50 yıl sonra bunun gerçekleştiği görüldü. Şimdi günümüzden 50 yıl geriye gittiğimizde ise zaten Ay’a insan gönderilmiş, birçok önemli uzay çalışması yapılmıştı. O dönemdeki insanların 50 yıl sonra Mars’ta koloni kurulacağını düşünmeleri gayet normal olurdu.</p><p>Günümüze baktığımızda 90&#39;lardan itibaren hızı kesilen uzay çalışmaları neticesinde pek de bir yere varamadığımızı görüyoruz. Çoğu hükümet, insan geleceği hakkındaki uzun dönem yatırımlara çok fazla ilgi duymamaktadır. Neyse ki son dönemlerde özel sektör firmalarının, uzay çalışmalarında önemli işler yaptığını gördük. <strong>SpaceX</strong>, <strong>Blue Origin </strong>gibi şirketler kendi aralarında yeni bir uzay yarışı başlattı. Bazı vizyoner kişilerin sayesinde önümüzdeki yıllarda Ay’da koloni kurmanın ve daha sonraki yıllarda Mars’a gitmenin planları yapılıyor. Umarım ülkemizde de bu çalışmalara yeterince önem ve hız verilip bu yarışta yer alınır.</p><p>Gezegenimize hakimiz gibi geliyor ama değiliz. :) Tamamen yok olmamız küçük bir gök taşına(göreceli olarak) veya yaratıcı bir virüse bakar. Sonuç olarak uzay çalışmaları önemlidir ve insanlar yeni yerler keşfetmeyi ister. Önümüzdeki yıllar bu konuda çok hareketli geçecek gibi gözüküyor. Yakın zamanda kolonileşme dileğiyle… :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a80d5e01caa7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>