28 Feb 2014

Best Android resources.

Hello Friends,

There is a lots of resources available for making graphics in mobile application.

here is some resources link.

Android Graphics Resources | Android Graphics tools:

http://angrytools.com/
http://dabuttonfactory.com/
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html
https://www.buzzingandroid.com/tools/android-layout-finder/

Image Editing :

On line Photo Editor  : https://pixlr.com/
Compass Images        : https://tinypng.com/
Resize images            : http://www.picresize.com/
Batch Resize images  :http://www.picresize.com/batch.php

Customize Tab Layout using Fragment in Android:

http://androidcodeblogspot.blogspot.in/2014/02/android-fragment-tab-example-bottom.html
http://adanware.blogspot.in/2012/04/android-custom-tab-layouts-just-using.html
http://mrbool.com/how-to-customize-tab-layout-in-android/28153
http://natieklopper.blogspot.in/2011/08/iphone-styled-bottom-aligned-tab-bar.html
https://github.com/iamjayanth/FragmentTabStudy

Android resources


Audio and video recording
https://github.com/steelkiwi/AndroidRecording

Bluetooth
http://arissa34.github.io/Android-Bluetooth-Library/

ImageSlider With animation
https://github.com/daimajia/AndroidImageSlider

Location
https://github.com/mrmans0n/smart-location-lib

Face changer
https://github.com/lafosca/AndroidFaceCropper

Emoji
https://github.com/n8fr8/AndroidEmojiInput
http://rockerhieu.com/emojicon/

FreeFlow
https://github.com/Comcast/FreeFlow

Mediachosser
https://github.com/learnNcode/MediaChooser

SocialNetworks
https://github.com/antonkrasov/AndroidSocialNetworks

Aauth-client
https://github.com/wuman/android-oauth-client

Webcaching
https://github.com/leocadiotine/WebCachedImageView

Wheelview
https://github.com/LukeDeighton/WheelView

Android-Wheel-Menu
https://github.com/anupcowkur/Android-Wheel-Menu

cards view
http://www.appance.com/cards/

PDF view:
http://www.joanzapata.com/android-pdfview/

AnimatedGridView
https://github.com/mikepenz/AnimatedGridView

Auto-scroll-view-pager
https://github.com/Trinea/android-auto-scroll-view-pager

swipe layout delete
https://github.com/daimajia/AndroidSwipeLayout

arcMenu
https://github.com/oguzbilgener/CircularFloatingActionMenu




I will be happy if you will provide your feedback or follow this blog. Any suggestion and help will be appreciated.
Thank you :)

25 Feb 2014

Display Image in Round Corner android

Hello Friends,

Today i am going to post Display Image in Shape/Round Corner. here you change corner value as per your requirement.

OutPut Screen:

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.widget.ImageView;

public class MainActivity extends Activity 
{
 ImageView imageView;
 
 @Override
 protected void onCreate(Bundle savedInstanceState) 
 {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  
  imageView=(ImageView) findViewById(R.id.img);
  
  Bitmap bitmapFromDrawable = BitmapFactory.decodeResource(getResources(),R.drawable.kukulkan);
  imageView.setImageBitmap(roundCorner(bitmapFromDrawable,20));
 }
 
 
 public static Bitmap roundCorner(Bitmap src, float round) 
 {
     // image size
     int width = src.getWidth();
     int height = src.getHeight();
     // create bitmap output
     Bitmap result = Bitmap.createBitmap(width, height, Config.ARGB_8888);
     // set canvas for painting
     Canvas canvas = new Canvas(result);
     canvas.drawARGB(0, 0, 0, 0);
  
     // config paint
     final Paint paint = new Paint();
     paint.setAntiAlias(true);
     paint.setColor(Color.BLACK);
  
     // config rectangle for embedding
     final Rect rect = new Rect(0, 0, width, height);
     final RectF rectF = new RectF(rect);
  
     // draw rect to canvas
     canvas.drawRoundRect(rectF, round, round, paint);
  
     // create Xfer mode
     paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
     // draw source image to canvas
     canvas.drawBitmap(src, rect, rect, paint);
  
     // return final image
     return result;
 }

}



You may also like this post 
More reference link


I will be happy if you will provide your feedback or follow this blog. Any suggestion and help will be appreciated.
Thank you :)

20 Feb 2014

Passing object by Intent in android(Serializable,Parcelable)

In this post, I will show you an simple example of how to pass object by intent in Android application. Parcelable and Serialization are used for marshaling and unmarshaling Java objects.

Differences between Serialization and Parcelable:

1. In Parcelable, developers write custom code for marshaling and unmarshaling so it creates less garbage         objects in comparison to Serialization.
2. The performance of Parcelable over Serialization dramatically improves (around two times faster),                 because of this custom implementation.

Serialization is a marker interface, which implies the user cannot marshal the data according to their requirements. In Serialization, a marshaling operation is performed on a Java Virtual Machine (JVM) using the Java reflection API. This helps identify the Java objects member and behavior, but also ends up creating a lot of garbage objects. Due to this, the Serialization process is slow in comparison to Parcelable.

Step 1: main.xml for the layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:gravity="center_horizontal"
        android:text="Serializable,Parcelable Example" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center"
        android:orientation="vertical" >

        <Button
            android:id="@+id/button1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Serializable" />

        <Button
            android:id="@+id/button2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="20dp"
            android:text="Parcelable" />
    </LinearLayout>

</LinearLayout>

Step 2: Create Person.java which implement serializable

import java.io.Serializable;  
public class Person implements Serializable 
{  
 private static final long serialVersionUID = -7060210544600464481L;   
 private String name;  
 private int age;  
 public String getName() {  
  return name;  
 }  
 public void setName(String name) {  
  this.name = name;  
 }  
 public int getAge() {  
  return age;  
 }  
 public void setAge(int age) {  
  this.age = age;  
 }
}

Step 3: Create Book.java which implement Parcelable

 import android.os.Parcel;  
 import android.os.Parcelable;  
 public class Book implements Parcelable {  
     private String bookName;  
     private String author;  
     private int publishTime;  

     public String getBookName() {  
  return bookName;  
     }  
     public void setBookName(String bookName) {  
  this.bookName = bookName;  
     }  
     public String getAuthor() {  
  return author;  
     }  
     public void setAuthor(String author) {  
  this.author = author;  
     }  
     public int getPublishTime() {  
  return publishTime;  
     }  
     public void setPublishTime(int publishTime) {  
  this.publishTime = publishTime;  
     }  

     public static final Parcelable.Creator<Book> CREATOR = new Creator<Book>() {  
  public Book createFromParcel(Parcel source) {  
      Book mBook = new Book();  
      mBook.bookName = source.readString();  
      mBook.author = source.readString();  
      mBook.publishTime = source.readInt();  
      return mBook;  
  }  
  public Book[] newArray(int size) {  
      return new Book[size];  
  }  
     };  

     public int describeContents() {  
  return 0;  
     }  
     public void writeToParcel(Parcel parcel, int flags) {  
  parcel.writeString(bookName);  
  parcel.writeString(author);  
  parcel.writeInt(publishTime);  
     }  
 }

Step 4: Create The MainActivity.java which is the main Activity class 

import hb.aa_serializableparcelable.bean.Book;
import hb.aa_serializableparcelable.bean.Person;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener 
{

    private Button sButton,pButton;  
    public  final static String SER_KEY = "ser";  
    public  final static String PAR_KEY = "par";
    
    public void onCreate(Bundle savedInstanceState) 
    {  
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.activity_main);     
        setupViews();

    }  

    public void setupViews()
    {  
        sButton = (Button)findViewById(R.id.button1);  
        pButton = (Button)findViewById(R.id.button2);  
        sButton.setOnClickListener(this);  
        pButton.setOnClickListener(this);  
    }  

    public void SerializeMethod()
    {  
        Person mPerson = new Person();  
        mPerson.setName("Leon");  
        mPerson.setAge(25);  
        Intent mIntent = new Intent(this,ObjectPassDemo1.class);  
        Bundle mBundle = new Bundle();  
        mBundle.putSerializable(SER_KEY,mPerson);  
        mIntent.putExtras(mBundle);  

        startActivity(mIntent);  
    }  

    public void PacelableMethod()
    {  
        Book mBook = new Book();  
        mBook.setBookName("Android Developer Guide");  
        mBook.setAuthor("Leon");  
        mBook.setPublishTime(2014);  
        Intent mIntent = new Intent(this,ObjectPassDemo2.class);  
        Bundle mBundle = new Bundle();  
        mBundle.putParcelable(PAR_KEY, mBook);  
        mIntent.putExtras(mBundle);  

        startActivity(mIntent);  
    }  

    public void onClick(View v) 
    {  
        if(v == sButton)
        {  
            SerializeMethod();  
        }
        else
        {  
            PacelableMethod();  
        }  
    }  
}

Step 5: create 2 more activity classes: ObjectPassDemo1.java use for display person ObjectPassDemo2.java use for display book

ObjectPassDemo2.java
import hb.aa_serializableparcelable.bean.Person;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class ObjectPassDemo1 extends Activity 
{  
 @Override  
 public void onCreate(Bundle savedInstanceState) 
 {  
  super.onCreate(savedInstanceState);  

  TextView mTextView = new TextView(this);  
  Person mPerson = (Person)getIntent().getSerializableExtra(MainActivity.SER_KEY);  
  mTextView.setText("You name is: " + mPerson.getName() + "/n"+ "You age is: " + mPerson.getAge());  

  setContentView(mTextView);  
 }  
}

ObjectPassDemo2.java
import hb.aa_serializableparcelable.bean.Book;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class ObjectPassDemo2 extends Activity 
{  

 public void onCreate(Bundle savedInstanceState) 
 {  
  super.onCreate(savedInstanceState);  
  TextView mTextView = new TextView(this);  
  Book mBook = (Book)getIntent().getParcelableExtra(MainActivity.PAR_KEY);  
  mTextView.setText("Book name is: " + mBook.getBookName()+"/n"+ 
    "Author is: " + mBook.getAuthor() + "/n" +  
    "PublishTime is: " + mBook.getPublishTime());  
  setContentView(mTextView);  
 }  
}


pass arraylist between activities android

I will be happy if you will provide your feedback or follow this blog. Any suggestion and help will be appreciated.
Thank you :)