Skip to content

Instantly share code, notes, and snippets.

View prasad091's full-sized avatar
🦊
Focusing

prasad prasad091

🦊
Focusing
  • Coimbatore
View GitHub Profile
@prasad091
prasad091 / build.gradle
Created January 6, 2017 05:22
Sample Gradle main
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'me.tatarka:gradle-retrolambda:3.3.1'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.0'
@prasad091
prasad091 / MainActivity.java
Created January 9, 2017 09:43
Chat Android Socket IO
public Socket socket= null;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try{
socket = IO.socket("http://192.168.0.101:3000");
socket.connect();
socket.on("message", handleIncomingMessages);
}catch(URISyntaxException e){
@prasad091
prasad091 / soket
Created January 9, 2017 10:40
Socket IO website
https://github.com/sreejesh79/android-socket.io-client-demo/tree/master/app
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
public interface ApiService {
@NonNull
private RequestBody createPartFromString(String descriptionString) {
return RequestBody.create(
MediaType.parse(MULTIPART_FORM_DATA), descriptionString);
}
public class RealPathUtils {
@SuppressLint("NewApi")
public static String getRealPathFromURI_API19(Context context, Uri uri){
String filePath = "";
String wholeID = DocumentsContract.getDocumentId(uri);
// Split at colon, use second item in the array
String id = wholeID.split(":")[1];
package com.kgisl.sharetruck.hub.util;
/**
* Created by admin on 14-03-2017.
*/
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
package com.kgisl.sharetruck.hub.ui.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.kgisl.sharetruck.hub.R;
//copy your map_activity.xml in layout folder
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
public class MapActivity extends AppCompatActivity implements OnMapReadyCallback {
package com.kgisl.sharetruck.hub.util;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import android.support.annotation.RequiresApi;