Skip to content

Instantly share code, notes, and snippets.

View sreelallalu's full-sized avatar

sreelal sreelallalu

  • Trivandrum
View GitHub Profile
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
public void pdfcreates()
{
page = new AbstractViewRenderer(getApplicationContext(), R.layout.viewpd) {
private String _text;
public void setText(String text) {
_text = text;
}
try {
FileInputStream fis= new FileInputStream(Stringpath);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
try {for (int readNum; (readNum = fis.read(buf)) != -1; ) {
bos.write(buf, 0, readNum); //no doubt here is 0
//Writes len bytes from the specified byte array starting at offset off to this byte array output stream.
//System.out.println("read " + readNum + " bytes,");
}
byte[] bufzz = bos.toByteArray();
public void showsnackbar(String message){
Snackbar snackbar = Snackbar
.make(findViewById(R.id.update_relative(parentlayout id)), message, Snackbar.LENGTH_SHORT);
View sbView = snackbar.getView();
sbView.setBackgroundColor(Color.parseColor("#A981CA"));
TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text);
textView.setTextColor(Color.BLACK);
snackbar.show();
package student.napt.com.napt2.Activity;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
//change
apply plugin:'com.android.library'
//delete application id,version code ,version name
task deleteOldJar(type: Delete)
{
delete 'release/AndroidPlugin.jar'
}
task exportJar(type: Copy)
@sreelallalu
sreelallalu / circular image view
Created April 17, 2017 10:26
circular image view
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/avatar"
android:layout_width="@dimen/list_item_avatar_size"
android:layout_height="@dimen/list_item_avatar_size"
android:layout_marginRight="16dp"/>
library:
compile 'de.hdodenhof:circleimageview:1.3.0'
Imagecall
Activity:
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@sreelallalu
sreelallalu / gson and listview
Created May 10, 2017 11:01
Gson _ Listview
//gradle gson
compile 'com.google.code.gson:gson:2.8.0'
//convet listview to string
String save_ = new Gson().toJson(itemsList);
//reverse process
//add sharedpreference value
SharedPreferences.Editor editor = getSharedPreferences("CONTACT", MODE_PRIVATE).edit();
editor.putString("PHONE", save_to_shared_string);
editor.commit();
//get value from shredpreference