Skip to content

Instantly share code, notes, and snippets.

View devrath's full-sized avatar
💭
I'm grateful when for one drop in glass. Since I knw exactly what to do with it

Devrath devrath

💭
I'm grateful when for one drop in glass. Since I knw exactly what to do with it
View GitHub Profile
@devrath
devrath / InterfaceMechanismForSeperatingOfLogic
Created June 16, 2016 06:55
How to Create an Interface listener for custom implementaton
//How to Create an Interface listener.
.
.
//Our main class
public class ActProfile extends AppCompatActivity implements InterProfileUpdate {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.profile_info);
@devrath
devrath / SignInProcessForGradle
Created July 26, 2016 11:38
Sign In Process For Releasing the app
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
@devrath
devrath / HandleBackButton.java
Created October 2, 2016 12:00
Handling press twice to exit in android activity
private boolean doubleBackToExitPressedOnce = false;
@Override
public void onBackPressed() {
handleExitApp();
}
private void handleExitApp() {
if (doubleBackToExitPressedOnce) {
super.onBackPressed();
@devrath
devrath / ConnectivityUtil.java
Created January 1, 2017 01:47
Check Internet connection
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil
*
*/
The VCS client of Android Studio
The powerful Android Studio
Avoiding cold starts on Android
Mastering the Coordinator Layout
Squeezing your Gradle builds
When Iron Man becomes reactive, RxJava
When the Avengers meet Dagger2, RxJava and Retrofit in a clean way
A useful stack on android #3, compatibility
A useful stack on android #2, user interface
A useful stack on android #1, architecture
@devrath
devrath / RoundedImageView.java
Created April 20, 2017 07:56
Rounded Image View in Android
//We need picasso for this
Picasso.with(this)
.load("http://i.imgur.com/DvpvklR.png")
.transform(new RoundedTransformation(50, 4))
.resize(100, 100)
.centerCrop().into(imageView1);
////////////////////////////////////////////////////////////////////////////////////////////
@devrath
devrath / XamarinClickEventWithBinding.java
Created May 8, 2017 10:45
Xamarin_ClickEvent_withBinding
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="40dp"
@devrath
devrath / ShowViewModel.cs
Created May 15, 2017 07:17
Showing a new View Model from current view model
namespace Stella.Core.ViewModels
{
public class FirstViewModel
: MvxViewModel
{
public FirstViewModel()
{
HomeClick = new MvxCommand<string>(param =>{
ShowViewModel<HomeViewModel>();
@devrath
devrath / CreateService.cs
Created May 17, 2017 09:38
Calling a Server by checking Connectivity
RestService.cs
namespace Stella.Core.Services
{
public class RestService : IntIRestService
{
public async Task<StellaData> GetSalesPeopleAsync()
{
try
{
@devrath
devrath / XamarinHttpRequest.cs
Created May 28, 2017 08:53
Three types of http requests in Xamarin Core
TYPE-1
------------------------------------------------------------------------------------------------------------------------
//Declare a Http client
var client = new HttpClient();
//Add a Base URl
//client.BaseAddress = new Uri(Constants.MUrl);
//Add the response type
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(Constants.ResponseType));
//Add the API
var response =await client.GetStringAsync(new Uri(Constants.mUrl));