Wednesday 26 June 2013

Android ViewPager Swipe Images Using Your Finger like Image Gallery Android

Simply make Image Gallery using ViewPager.When you slide Finger over image and swipe left to right used ViewPager.Many other controller available but i think it is very easy to maintain and create gallery using ViewPager.

Start new project and give name as ViewPagerDemo and begin your development of your android Gallery. Put your all Gallery images into drawable folder and as of now put four images and give name as a,b,c,d.

Now need to create one helper class so it is helpful to in creation of Gallery give name as ImageSwipeAdapter.java and extends PagerAdapter and modified as below

 package com.idroid.viewpager;  
 import android.content.Context;  
 import android.support.v4.view.PagerAdapter;  
 import android.support.v4.view.ViewPager;  
 import android.view.View;  
 import android.view.ViewGroup;  
 import android.widget.ImageView;  
 public class ImageSwipeAdapter extends PagerAdapter {  
      Context context;  
   private int[] Images = new int[] {  
     R.drawable.a,  
     R.drawable.b,  
     R.drawable.c,  
     R.drawable.d  
   };  
   ImageSwipeAdapter(Context context){  
        this.context=context;  
   }  
   @Override  
   public int getCount() {  
    return Images.length;  
   }  
   @Override  
   public boolean isViewFromObject(View view, Object object) {  
    return view == ((ImageView) object);  
   }  
   @Override  
   public Object instantiateItem(ViewGroup container, int position) {  
    ImageView imageView = new ImageView(context);  
    int pad = context.getResources().getDimensionPixelSize(R.dimen.m_padding);  
    imageView.setPadding(pad, pad, pad, pad);  
    imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);  
    imageView.setImageResource(Images[position]);  
    ((ViewPager) container).addView(imageView, 0);  
    return imageView;  
   }  
   @Override  
   public void destroyItem(ViewGroup container, int position, Object object) {  
    ((ViewPager) container).removeView((ImageView) object);  
   }  
  }  

Now start programming for Swipe feature for that modify your main.xml file as below code

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
   xmlns:tools="http://schemas.android.com/tools"  
   android:layout_width="match_parent"  
   android:layout_height="match_parent"  
   tools:context=".MainActivity" >  
            <android.support.v4.view.ViewPager  
            android:id="@+id/view_pager"  
            android:layout_width="match_parent"  
            android:layout_height="match_parent" />  
 </RelativeLayout>  

Now need to modify your MainActivity.java file as per below so your Image ViewPager is redy to run

 package com.idroid.viewpager;  
 import android.app.Activity;  
 import android.os.Bundle;  
 import android.support.v4.view.ViewPager;  
 public class MainActivity extends Activity {  
  @Override  
  public void onCreate(Bundle savedInstanceState) {  
   super.onCreate(savedInstanceState);  
   setContentView(R.layout.main);  
   ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);  
   ImageSwipeAdapter adapter = new ImageSwipeAdapter(this);  
   viewPager.setAdapter(adapter);  
  }  
 }  

My Android Applications

Download Hanuman HD Wallpaper on Google Play

Download Live Currency Exchange Rates on Google Play

Download iSIM Info on Google Play

Download Find Droid on Google Play

Thursday 20 June 2013

Android Bound Service and Unbound Service run in Background

Android Services is used to do any background task in current activity.There is two types of Services available in android.Service class is responsible for using Services in android for that we need to extends Services class in out Custom service.

  1. Bound Service :Service which call indefinitely in between activity
  2. Unbound Service :Service which call at the life span of calling activity

Services has different life cycle from Activity. Services has different method for their life cycle which is startService(),stopService(),onBindService()


My Android Applications

Download Hanuman HD Wallpaper on Google Play

Download Live Currency Exchange Rates on Google Play

Download iSIM Info on Google Play

Download Find Droid on Google Play

Thursday 13 June 2013

Call Log Apps For Android


This Application Quickly access Call log from your android device and display in android TextView. For that you need to create application give name as myCalllog.

1. You need to look your main.m file first. modify main.m code as given below tack one TextView so we can add call log data in TextView
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
   xmlns:tools="http://schemas.android.com/tools"  
   android:layout_width="match_parent"  
   android:layout_height="match_parent" >  
   <TextView  
     android:id="@+id/textview"  
     android:layout_width="wrap_content"  
     android:layout_height="wrap_content"  
     android:padding="10px"  
     android:scrollbars="vertical"  
     android:text="@string/hello_world"  
     tools:context=".MainActivity" />  
 </RelativeLayout>  

2.Now you need to change your java file as per our requirement you need to get your TextView by using findViewById method and also set scroll enable so more record it is scroll so in your onCreate() method put below line of code.

  tv=(TextView) findViewById(R.id.textview);  
  tv.setMovementMethod(new ScrollingMovementMethod());  

3.You have get your TextView now you need to move forword get call log data in cursor so you need one StringBuffer and Cursor for moving each and every record and get Incoming call,Outgoing call and Miss call put below TextView code

 StringBuffer sb = new StringBuffer();  
 Cursor managedCursor = managedQuery(CallLog.Calls.CONTENT_URI, null,null, null, null);  
 int number = managedCursor.getColumnIndex(CallLog.Calls.NUMBER);  
 int type = managedCursor.getColumnIndex(CallLog.Calls.TYPE);  
 int date = managedCursor.getColumnIndex(CallLog.Calls.DATE);  
 int duration = managedCursor.getColumnIndex(CallLog.Calls.DURATION);  
 sb.append("Call Details :")  
 while (managedCursor.moveToNext()) {  
           String phNumber = managedCursor.getString(number);  
           String callType = managedCursor.getString(type);  
           String callDate = managedCursor.getString(date);  
           Date callDayTime = new Date(Long.valueOf(callDate));  
           String callDuration = managedCursor.getString(duration);  
           String dir = null;  
           int dircode = Integer.parseInt(callType);  
          switch (dircode) {  
                case CallLog.Calls.OUTGOING_TYPE:  
                     dir = "OUTGOING";  
                     break;  
                case CallLog.Calls.INCOMING_TYPE:  
                     dir = "INCOMING";  
                     break;  
                case CallLog.Calls.MISSED_TYPE:  
                     dir = "MISSED";  
                     break;  
                }  
                sb.append("\nPhone Number:--- " + phNumber + " \nCall Type:--- "  
                          + dir + " \nCall Date:--- " + callDayTime  
                          + " \nCall duration in sec :--- " + callDuration);  
                sb.append("\n----------------------------------");  
 }  
 managedCursor.close();  
 tv.setText(sb);  

4.Your Call log application is ready to build now build and run your application check output in your simulator.

My Android Applications

Download Hanuman HD Wallpaper on Google Play

Download Live Currency Exchange Rates on Google Play

Download iSIM Info on Google Play

Download Find Droid on Google Play

Wednesday 5 June 2013

Live Currency Exchange Rates


currency converter screen 1 currency converter rates currency converter rates setting screen

Live Currency Exchange Rates is a free live currency converter. It offers to convert one word currency to another.

You can add currency by clicking text box below button and press convert button to convert any of the currency which you have selected.


Live Currency Exchange Rates provide following features
  • Currency Converter
  • Offline Access
  • Automatic update currency rates if you set in setting section > set automatic update on
  • Over 31 currency supported
  • View last updated currency news
  • Easy selection of currency by currency code and country name
  • Not require to create an account and easy one
  • Sharing functionality

Use Offline
  • Store the latest updated currency rate.
  • Convert currency without internet access.

Updates in Feature Versions also suggest your ideas
  • Provide widget for currency information
  • Provide detail about selected currency
  • Increase more country
  • Add your own percentage with converted currency
  • Provide visa – versa conversion
  • Save any currency to and from to Favorite list
  • Recently converted currency list

Keywords : currency exchange rates, money exchange rate, money conversion, currency converter calculator, currency converters

My Android Applications

Download Hanuman HD Wallpaper on Google Play

Download Live Currency Exchange Rates on Google Play

Download iSIM Info on Google Play

Download Find Droid on Google Play