Skip to content

Instantly share code, notes, and snippets.

View rohitjakhar's full-sized avatar
💭
Android Developer

Rohit Jakhar rohitjakhar

💭
Android Developer
View GitHub Profile
@hardiksachan
hardiksachan / README.md
Last active December 28, 2023 06:52
Jetpack Compose Expandable Search Bar (Top Bar)

Sample

Test Driven Development
Main Principle: Write the test case before the implementation of the function (only for unit tests)
Convention:
1. You should only have one assertion per test case
- Why? Because we immediately want to know the cause of the failed test case
- Note: Sometimes there is no way around having multiple assertions.
Steps:

Android Interview Questions

Q1: Explain activity lifecycle ☆☆

Answer: As a user navigates through, out of, and back to your app, the Activity instances in your app transition through different states in their lifecycle.

To navigate transitions between stages of the activity lifecycle, the Activity class provides a core set of six callbacks: onCreate(), onStart(), onResume(), onPause(), onStop(), and onDestroy(). The system invokes each of these callbacks as an activity enters a new state.

Interview Questions

Kotlin

Q1: What is a primary constructor in Kotlin? ☆☆

Answer: The primary constructor is part of the class header. Unlike Java, you don't need to declare a constructor in the body of the class. Here's an example:

@valdio
valdio / ApiEndpointInterface.java
Created October 6, 2016 21:35
Retrofit Multiple Query Parameter with custom QueryMap .... Example: ?tag[5]=12&tag[20]=3&tag[11]=5
public interface ApiEndpointInterface {
//Example of the implementation
@FormUrlEncoded
@POST("{token}/pay/cash?sandbox=1")
Call<ResponseBody> orderProducts(@Path("token") String token,
@QueryMap Map<String, String> map,
@Field("address") String addressId);
}
@kyktommy
kyktommy / app.rb
Created November 9, 2013 11:38
Behance Project Images downloader `ruby app.rb http://www.behance.net/gallery/Web-SPIT-Mx/10331815 ~/Desktop`
require 'nokogiri'
require 'open-uri'
class ImageFetcher
EXCLUDES = [
"http://a2.behance.net/img/site/grey.png"
]
def self.get_all_img_src(url)