Posts

JSON: A Beginner's Guide to JavaScript Object Notation

Image
JSON JSON, which stands for JavaScript Object Notation, is a lightweight data interchange format. It is easy for humans to read and write, and easy for machines to parse and generate. JSON is a text format that is language-independent and uses conventions familiar to programmers of many languages, including C, C++, Java, Kotlin, Python, JavaScript, and others. JSON data is represented as key-value pairs, similar to how data is stored in a dictionary in Python or an object in JavaScript. The basic structure of JSON includes: JSON Object: An unordered collection of key-value pairs enclosed in curly braces {}. Each key is a string and is followed by a colon, then its corresponding value. Multiple key-value pairs are separated by commas. Example: { "name" : "Atif Pervaiz" , "age" : 27 , "city" : "Lahore" } JSON Array: An ordered list of values enclosed in square brackets []. Values in an array can be of any data type, including obje

Bitmap From ImageView | Android Studio | Java

Image
Exploring Bitmaps in Android Studio Using Java: A Comprehensive Guide Introduction: In the dynamic world of Android app development, understanding and effectively manipulating images are crucial skills for creating visually appealing and efficient applications. One fundamental aspect of image processing in Android is working with Bitmaps. In this blog post, we will delve into the world of Bitmaps, exploring their significance, and learning how to handle them using Java in Android Studio. What is a Bitmap?  To kick things off, we'll provide a clear definition of what a Bitmap is in the context of Android development. Readers will gain insights into how Android represents images as Bitmaps and why they are the go-to data structure for handling pixel information. Loading Bitmaps  Here, we will guide readers through the process of loading Bitmaps into their Android application. Whether it's loading from resources, assets, or the web, we'll cover the various methods available in

Bitmap From ImageView | Android Studio | Kotlin

Image
  Exploring Bitmaps in Android Studio Using Java: A Comprehensive Guide Introduction: In the dynamic world of Android app development, understanding and effectively manipulating images are crucial skills for creating visually appealing and efficient applications. One fundamental aspect of image processing in Android is working with Bitmaps. In this blog post, we will delve into the world of Bitmaps, exploring their significance, and learning how to handle them using Java in Android Studio. What is a Bitmap?  To kick things off, we'll provide a clear definition of what a Bitmap is in the context of Android development. Readers will gain insights into how Android represents images as Bitmaps and why they are the go-to data structure for handling pixel information. Loading Bitmaps  Here, we will guide readers through the process of loading Bitmaps into their Android application. Whether it's loading from resources, assets, or the web, we'll cover the various methods available

Unable to select a different account on Google login | Android Studio

Image
Problem: I have implemented Google Signing for the Android app. The user can successfully log in from the Google Login Button. This screen appears while selecting a Social Account:  So now the user has logged in successfully by selecting his/her account. Now, the user logs out and tries to sign in again by using Google Login Button. At this time, he is not asked with the option to choose an account, he is automatically logged in using the account he/she selected at the first time. At the time of logout, what should I do to clear the cache of the selected account? Solution: In Firebase documentation for Android, they only refer to the use of this: firebaseAuth .signOut() However, the next time the user logs in, the app will automatically select the previous email. To avoid this, you should use the following code as well: mGoogleSignInClient .signOut()

Google Map Intent | Android Studio | Kotlin

Image
How to open Google Maps with directions to a specific location (Latitude, Longitude)? You may have a scenario when you want to open a specific location on Google Maps by clicking a button. In this tutorial, we will input the latitude and longitude and by clicking a button we will open that location in Google Maps. >>Check For Java Complete Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.android.com/tools" xmlns:app= "http://schemas.android.com/apk/res-auto" android:layout_width= "match_parent" android:layout_height= "match_parent" android:orientation= "vertical" android:gravity= "center" android:padding= "10dp" tools:context= ".MainActivity" > <!--TextView: To show label--> <TextV

Google Map Intent | Android Studio | Java

Image
How to open Google Maps with directions to a specific location (Latitude, Longitude)? You may have a scenario when you want to open a specific location on Google Maps by clicking a button. In this tutorial, we will input the latitude and longitude and by clicking a button we will open that location in Google Maps.  >>Check For Kotlin Complete Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.android.com/tools" xmlns:app= "http://schemas.android.com/apk/res-auto" android:layout_width= "match_parent" android:layout_height= "match_parent" android:orientation= "vertical" android:gravity= "center" android:padding= "10dp" tools:context= ".MainActivity" > <!--TextView: To show label--> <Te

SMS Intent | Android Studio | Kotlin

Image
SMS Intent: We will use intent to open the sms screen with the phone number the user entered. In this example, we will input a phone number using an input field i.e. EditText, and open that phone number in the sms screen by clicking the button. >>Check For Java Code Snippet: val intent = Intent(Intent.ACTION_VIEW, Uri.parse( "sms:" + Uri.encode(phone))) startActivity(intent) Full Example: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:gravity= "center" android:orientation= "vertical" android:padding= "10dp" tools:context= ".MainActivity1" >