A new image library for Android ?


A new image library for Android:

https://code.facebook.com/posts/366199913563917/introducing-fresco-a-new-image-library-for-android/

Fresco offers features that Picasso, UIL, and Glide do not yet have:

1. Images aren’t stored in the Java heap, but in the ashmem heap. Intermediate byte buffers are also stored in the native heap. This leaves a lot more memory available for applications to use. It reduces the risk of OutOfMemoryErrors. It also reduces the amount of garbage collection apps have to do, leading to better performance.

2.  Progressive JPEG images can be streamed, just like in a web browser.

3.  Images can be cropped around any point, not just the centre.

4.  JPEG images can be resized natively. This avoid the problem of OOMing while trying to downsize an image.

 

 

 

 

 

 

MVP Pattern Android ?


In large applications, it’s essential to organize your code very well. MVP allows you to separate business logic from presentation layer. MVP makes views independent from our data source. In Android, activities and data mechanism will be tightly coupled . With MVP we are able to take most of logic out from the activities so that we can test it without using instrumentation tests.

mvp

Presenter:

Presenter contains the UI business logic for the View and a middle man that talks to the View and the Model. The Presenter is also decoupled directly from the View and talks to it through an interface, this is to allow mocking of the View in a unit test.

View :

This view will implemented by Activity or Fragment will contain the reference to Presenter.

Model:

This is provider of the data we want to display in the view.

Implement MVP pattern:

1. Creating an presenter interface

2. Implementation for presenter – As UI logic will be implemented in this PresenterImpl.

3. Create an view interface- where activities or fragements implements this interface

/**
* The Interface LoginPresenter.
*/
public interface LoginPresenter {
/**
* Login.
* @param username the username
* @param password the password
*/
void login(String username, String password);
}
/**
* The Class LoginPresenterImpl.
*/
public class LoginPresenterImpl implements LoginPresenter {
/** The login view. */
private LoginView loginView;
/**
* Instantiates a new login presenter impl.
* @param loginView the login view
*/
public LoginPresenterImpl(LoginView loginView) {
this.loginView = loginView;
}
/**
* @see com.andhradroid.mvpdemo.LoginPresenter#login(java.lang.String, java.lang.String)
*/@Override
public void login(String username, String password) {
if (TextUtils.isEmpty(username) || TextUtils.isEmpty(password)) {
loginView.showValidationError();
} else {
if (username.equals("admin") && password.equals("admin")) {
loginView.loginSuccess();
} else {
loginView.loginError();
}
}
}
}
/**
* The Interface LoginView.
*/
public interface LoginView {
/**
* Show validation error.
*/
void showValidationError();
/**
* Login success.
*/
void loginSuccess();
/**
* Login error.
*/
void loginError();
}
public class MainActivity extends Activity implements LoginView {
private LoginPresenter presenter;@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//
presenter = new LoginPresenterImpl(this);
presenter.login("admin", "admin");
}@Override
public void showValidationError() {
Toast.makeText(this, "Please enter valid username and password!", Toast.LENGTH_SHORT).show();
}@Override
public void loginSuccess() {
Toast.makeText(this, "You are succussfully logged in!", Toast.LENGTH_SHORT).show();
}@Override
public void loginError() {
Toast.makeText(this, "Invalid login credintails!", Toast.LENGTH_SHORT).show();
}
}
view raw MVPDemo.java hosted with ❤ by GitHub

 

References:

1. http://antonioleiva.com/mvp-android/

 

Android Samples at GitHuB


I would like to share my one of the samples I have worked on.

1. https://github.com/rameshkec85/GCMServerTest

This project will allow you test push notifications are working correctly or not at client side.
In order to run this project, we need to follow the below stpes:
i. Simply add server api key
ii. Add a registration id available when app is being registred to GCM server.

2. https://github.com/rameshkec85/uploadservicedemo

This project demonstrates how to upload a file or download a files in a Queue manner where most of the applications are following this pattern.

Notes:
i. Pool is one so that at a one request can be placed or executed.
ii. Using EvenBus to take the advantages of it’s subscribe and post method.

3. https://github.com/rameshkec85/AndroidCropMoveScaleImage

This project demonstrates that crop a image within the box, without moving overlay.
This is result of combination of Cropper library and PhotoView. But added little work to achieve this.

System Util class for Android


The following few methods can help you avoiding research on basic utility methods in Android. 

package com.andhradroid.util;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.text.DecimalFormat;
import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.app.ActivityManager;
import android.app.ActivityManager.MemoryInfo;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.StatFs;
import android.provider.Settings.Secure;
import android.telephony.PhoneStateListener;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.text.format.Formatter;
import android.util.Log;
/**
* The Class SystemUtil.
*/
public class SystemUtil {
/** The Constant TAG. */
private static final String TAG = SystemUtil.class.getSimpleName();
/**
* Model name.
* @return the string
*/
public static String modelName() {
return Build.MODEL.toString();
}
/**
* Phone number.
* @param mContext the m context
* @return the string
*/
public static String phoneNumber(Context mContext) {
TelephonyManager teleponyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
return teleponyManager.getLine1Number();
}
/**
* Checks if is foreground.
* @param context the context
* @return true, if is foreground
*/
public static boolean isForeground(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> list = activityManager.getRunningTasks(1);
ComponentName cn = list.get(0).topActivity;
String name = cn.getPackageName();
return name.indexOf(context.getPackageName()) > -1;
}
/**
* Checks if is app alive.
* @param mContext the m context
* @return true, if is app alive
*/
public static boolean isAppAlive(Context mContext) {
ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> list = activityManager.getRunningTasks(100);
for (RunningTaskInfo task : list) {
ComponentName cn = task.topActivity;
String name = cn.getPackageName();
if (name.indexOf(mContext.getPackageName()) > -1)
return true;
}
return false;
}
/**
* Checks if is top activity.
* @param mContext the m context
* @param name the name
* @return true, if is top activity
*/
public static boolean isTopActivity(Context mContext, String name) {
ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> list = activityManager.getRunningTasks(1);
ComponentName cn = list.get(0).topActivity;
return cn.getClassName().equals(name);
}
/**
* At the bottom of the stack check if the name of the database activity.
* @param mContext the m context
* @param name the name
* @return true, if is base activity
*/
public static boolean isBaseActivity(Context mContext, String name) {
ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> list = activityManager.getRunningTasks(1);
ComponentName cn = list.get(0).baseActivity;
return cn.getClassName().equals(name);
}
/**
* Checks if is connected wi fi.
* @param mContext the m context
* @return true, if is connected wi fi
*/
public static boolean isConnectedWiFi(Context mContext) {
ConnectivityManager connectivityManager = (ConnectivityManager) mContext
.getSystemService(Context.CONNECTIVITY_SERVICE);
return connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected();
}
/**
* Checks if is connected mobile network.
* @param mContext the m context
* @return true, if is connected mobile network
*/
public static boolean isConnectedMobileNetwork(Context mContext) {
boolean kResult = false;
try {
ConnectivityManager connectivityManager = (ConnectivityManager) mContext
.getSystemService(Context.CONNECTIVITY_SERVICE);
kResult = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnected();
} catch (Exception e) {
e.printStackTrace();
}
return kResult;
}
/**
* Is any network connected?.
* @param mContext the m context
* @return true=connected
*/
public static boolean isConnectNetwork(Context mContext) {
return isConnectedWiFi(mContext) || isConnectedMobileNetwork(mContext);
}
/**
* Gets the connected network.
* @return the connected network
*/
public static String getConnectedNetwork(Context context) {
if (isConnectedWiFi(context)) {
return "WIFI";
} else if (isConnectedMobileNetwork(context)) {
return "Mobile";
} else {
return "NONE";
}
}
/**
* Android id.
* @param context the context
* @return the string
*/
public static String androidId(Context context) {
return Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
}
/**
* Return Sd-Card device that you have.
* @return the string
*/
public static String isHasSDCard() {
return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) ? "Yes" : "No";
}
/**
* Checks if is GPS support.
* @param mContext the m context
* @return true, if is GPS support
*/
public static boolean isGPSSupport(Context mContext) {
PackageManager pm = mContext.getPackageManager();
boolean hasGps = pm.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS);
return hasGps;
}
/**
* Gets the local ip address.
* @return the local ip address
*/
public static String getLocalIpAddress() {
try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
NetworkInterface intf = en.nextElement();
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress()) {
// String ip = Formatter.formatIpAddress(inetAddress.hashCode());
String ip = Formatter.formatIpAddress(inetAddress.hashCode());
Log.i(TAG, "***** IP=" + ip);
return ip;
}
}
}
} catch (SocketException ex) {
Log.e(TAG, ex.toString());
}
return "";
}
/**
* Display ip address.
* @param mContext the m context
* @return the string
*/
public static String displayIpAddress(Context mContext) {
String ip = "";
try {
WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
WifiInfo info = wifiManager.getConnectionInfo();
if (info != null && info.getNetworkId() > -1) {
int i = info.getIpAddress();
ip = String.format(Locale.ENGLISH, "%d.%d.%d.%d", i & 0xff, i >> 8 & 0xff, i >> 16 & 0xff,
i >> 24 & 0xff);
}
} catch (Exception ex) {
ex.printStackTrace();
}
return ip;
}
/**
* Gets the battery level.
* @param mContext the m context
* @return the battery level
*/
public static float getBatteryLevel(Context mContext) {
Intent batteryIntent = mContext.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
int level = batteryIntent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
int scale = batteryIntent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
// Error checking that probably isn't needed but I added just in case.
if (level == -1 || scale == -1) {
return 50.0f;
}
return ((float) level / (float) scale) * 100.0f;
}
/**
* Gets the total internal memory.
* @return the total internal memory size
*/
@SuppressWarnings("deprecation")
public static long getTotalInternalMemorySize() {
final File path = Environment.getDataDirectory();
final StatFs stat = new StatFs(path.getPath());
final long blockSize = stat.getBlockSize();
final long totalBlocks = stat.getBlockCount();
return totalBlocks * blockSize;
}
/**
* Gets the available internal memory size.
* @return the available internal memory size
*/
public static long getAvailableInternalMemorySize() {
final File path = Environment.getDataDirectory();
final StatFs stat = new StatFs(path.getPath());
final long blockSize = stat.getBlockSize();
final long availableBlocks = stat.getAvailableBlocks();
return availableBlocks * blockSize;
}
/**
* Gets the total external memory size.
* @return the total external memory size
*/
public static long getTotalExternalMemorySize() {
final File path = Environment.getExternalStorageDirectory();
final StatFs stat = new StatFs(path.getPath());
final long blockSize = stat.getBlockSize();
final long totalBlocks = stat.getBlockCount();
return totalBlocks * blockSize;
}
/**
* Gets the available external memory size.
* @return the available external memory size
*/
public static long getAvailableExternalMemorySize() {
final File path = Environment.getExternalStorageDirectory();
final StatFs stat = new StatFs(path.getPath());
final long blockSize = stat.getBlockSize();
final long availableBlocks = stat.getAvailableBlocks();
return availableBlocks * blockSize;
}
/**
* Format size.
* @param size the size
* @return the string
*/
public static String formatSize(final Long size) {
final String bytes = "B";
if (size == null || size.longValue() <= 0) {
return "0 " + bytes;
}
final String kb = "KB";
final String mb = "MB";
final String gb = "GB";
final String tb = "TB";
final String[] units = new String[] { bytes, kb, mb, gb, tb };
final int digitGroups = (int) (Math.log10(size.doubleValue()) / Math.log10(1024));
final DecimalFormat decimalFormat = new DecimalFormat("#,##0.##");
return decimalFormat.format(size.doubleValue() / Math.pow(1024, digitGroups)) + " " + units[digitGroups];
}
/**
* Gets the total ram.
* @return the total ram
*/
public static String getTotalRAM() {
RandomAccessFile reader = null;
String load = null;
double totRam = 0;
try {
reader = new RandomAccessFile("/proc/meminfo", "r");
load = reader.readLine();
// Get the Number value from the string
Pattern p = Pattern.compile("(\\d+)");
Matcher m = p.matcher(load);
String value = "";
while (m.find()) {
value = m.group(1);
// System.out.println("Ram+ value);
}
reader.close();
totRam = Double.parseDouble(value);
return formatSize((long) totRam);
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
} finally {
// Streams.close(reader);
}
return "";
}
/**
* Gets the total ram.
* @param context the context
* @return the total ram
*/
public static String getTotalRAM(Context context) {
MemoryInfo mi = new MemoryInfo();
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.getMemoryInfo(mi);
long availableMegs = mi.availMem / 1048576L;
// Percentage can be calculated for API 16+
long percentAvail = mi.availMem / mi.totalMem;
return formatSize(mi.totalMem);
}
/**
* Gets the available ram.
* @param context the context
* @return the available ram
*/
public static String getAvailableRAM(Context context) {
MemoryInfo mi = new MemoryInfo();
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.getMemoryInfo(mi);
// Percentage can be calculated for API 16+
long percentAvail = mi.availMem / mi.totalMem;
return formatSize(mi.availMem);
}
/**
* Gets the imei number of the device.
* @param context the context
* @return the ime i no
*/
public static String getImeINo(Context context) {
TelephonyManager mngr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return mngr.getDeviceId();
}
/** The m signal strength. */
private static String mSignalStrength = "Un Known";
/**
* Gets the signal strength in dBm.
* @param context the context
* @return the signal strength
*/
public static String getSignalStrength(Context context) {
final TelephonyManager mngr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
new Handler(context.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (mngr != null)
mngr.listen(new PhoneStateListener() {
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
mSignalStrength = signalStrength.getGsmSignalStrength() + "dBm";
}
}, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
}
});
try {
Thread.sleep(500L);
} catch (InterruptedException e) {
e.printStackTrace();
}
return mSignalStrength;
}
}
view raw SystemUtil.java hosted with ❤ by GitHub

Avoiding the Casting noise in Adapter


For recycling the views, we follow the holder set and get tag methods and need to cast every component . For avoiding noise , have to follow this pattern . This could be helpful in code seems more clean up.

@Override
public View getView(int position, View convertView, ViewGroup parent) {

 if (convertView == null) {
// if it's not recycled, initialize some attributes
//
  LayoutInflater inflater = (LayoutInflater) m_Context
       .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  convertView = inflater.inflate(R.layout.main, null,false);
 }
 ImageView image=ViewHolderPattern.get(convertView,R.id.alarm_icon/*ImageView resid*/);

 TextView image=ViewHolderPattern.get(convertView,R.id.title/*TextView resid*/);
 return convertView;
}

//
public static class ViewHolderPattern {
// I added a generic return type to reduce the casting noise in client
// code
@SuppressWarnings("unchecked")
public static T get(View view, int resId) {

 SparseArray viewHolder = (SparseArray) view.getTag();
 if (viewHolder == null) {
 viewHolder = new SparseArray();
 view.setTag(viewHolder);
 }
 View childView = viewHolder.get(resId);

 if (childView == null) {
 childView = view.findViewById(resId);
 viewHolder.put(resId, childView);
 }
 return (T) childView;
 }
}

Note: Thanks to Pierre-Yves Ricau . I think this post is worth in sharing .

FragmentTabHost in Android with Bottom Tabs


FragmentTabHost in Android with Bottom Tabs

This is example shows how to use FragmentTabhost in android. 

  1. Withing Fragment

  2. Using in FragmentActivity

  3. Tabs at Bottom. (New)

    Most of the developers are facing this problem, I finally got the solution after i spent a few hours on it.It would be helpful to face this who r trying to make iphone like tabs(Bottom Tabs Feature ).

How to display the pdf in Android ?


Quick start incorporating a PDF viewing activity into your project:

1) Add PdfViewer.jar into your project’s build path

2) Copy the following drawable resources from PdfViewer/res/drawable into YourProject/res/drawable left_arrow.png right_arrow.png zoom_in.png zoom_out.png

3) Copy the following layout resources from PdfViewer/res/layout into YourProject/res/layout dialog_pagenumber.xml pdf_file_password.xml

4) Derive your PDF activity from net.sf.andpdf.pdfviewer.PdfViewerActivity

5) Using the default drawables and layouts:


public int getPreviousPageImageResource() { return R.drawable.left_arrow; }

public int getNextPageImageResource() { return R.drawable.right_arrow; }

public int getZoomInImageResource() { return R.drawable.zoom_in; }

public int getZoomOutImageResource() { return R.drawable.zoom_out; }

public int getPdfPasswordLayoutResource() { return R.layout.pdf_file_password; }

public int getPdfPageNumberResource() { return R.layout.dialog_pagenumber; }

public int getPdfPasswordEditField() { return R.id.etPassword; }

public int getPdfPasswordOkButton() { return R.id.btOK; }

public int getPdfPasswordExitButton() { return R.id.btExit; }

public int getPdfPageNumberEditField() { return R.id.pagenum_edit; }

6) Invoke your PdfViewActivity derived with the following code:


Intent intent = new Intent(this, YourPdfViewerActivity.class);

intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, "PATH TO PDF GOES HERE");

startActivity(intent);

Download the source code and demo code from below link here

 

 

EDIT:  Another pdf viewer source for free  at github.

https://github.com/rameshakulapc/PDFViewer

Find the reference  Post by Andhradroid.

How to implement swipe delete in android like iphone ?


Step 1: Just extends below class and implement getListview method.

Step 2: The below MainActivity demonstrates in which direction single item should be swiped and gives the item position of clicked item. We have to manage it in adapter to swipe-delete operation from our own scratch.

SwipeListViewActivity.java:

public abstract class SwipeListViewActivity extends Activity {

private ListView list;
private int REL_SWIPE_MIN_DISTANCE;
private int REL_SWIPE_MAX_OFF_PATH;
private int REL_SWIPE_THRESHOLD_VELOCITY;

/**
*
* @return ListView
*/
public abstract ListView getListView();

/**
*
* @param isRight
* Swiping direction
* @param position
* which item position is swiped
*/
public abstract void getSwipeItem(boolean isRight, int position);

/**
* For single tap/Click
*
* @param adapter
* @param position
*/
public abstract void onItemClickListener(ListAdapter adapter, int position);

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

DisplayMetrics dm = getResources().getDisplayMetrics();
REL_SWIPE_MIN_DISTANCE = (int) (120.0f * dm.densityDpi / 160.0f + 0.5);
REL_SWIPE_MAX_OFF_PATH = (int) (250.0f * dm.densityDpi / 160.0f + 0.5);
REL_SWIPE_THRESHOLD_VELOCITY = (int) (200.0f * dm.densityDpi / 160.0f + 0.5);
}

@Override
protected void onResume() {
super.onResume();
list = getListView();
if (list == null) {
new Throwable("Listview not set exception");
}

@SuppressWarnings("deprecation")
final GestureDetector gestureDetector = new GestureDetector(
new MyGestureDetector());

View.OnTouchListener gestureListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
};
list.setOnTouchListener(gestureListener);

}

private void myOnItemClick(int position) {
if (position < 0)
return;
onItemClickListener(list.getAdapter(), position);

}

class MyGestureDetector extends SimpleOnGestureListener {

private int temp_position = -1;

// Detect a single-click and call my own handler.
@Override
public boolean onSingleTapUp(MotionEvent e) {

int pos = list.pointToPosition((int) e.getX(), (int) e.getY());
myOnItemClick(pos);
return true;
}

@Override
public boolean onDown(MotionEvent e) {

temp_position = list
.pointToPosition((int) e.getX(), (int) e.getY());
return super.onDown(e);
}

@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
if (Math.abs(e1.getY() - e2.getY()) > REL_SWIPE_MAX_OFF_PATH)
return false;
if (e1.getX() - e2.getX() > REL_SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > REL_SWIPE_THRESHOLD_VELOCITY) {

int pos = list
.pointToPosition((int) e1.getX(), (int) e2.getY());

if (pos >= 0 && temp_position == pos)
getSwipeItem(false, pos);
} else if (e2.getX() - e1.getX() > REL_SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > REL_SWIPE_THRESHOLD_VELOCITY) {

int pos = list
.pointToPosition((int) e1.getX(), (int) e2.getY());
if (pos >= 0 && temp_position == pos)
getSwipeItem(true, pos);

}
return false;
}

}

}
<h3>

MainActivity.java:

public class MainActivity extends SwipeListViewActivity {

private ListView mListView;
 private ArrayAdapter<String> mAdapter;

@Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.main);
 mListView = (ListView) findViewById(R.id.listView1);
 mAdapter = new ArrayAdapter<String>(this,
 android.R.layout.simple_list_item_1, new String[] { "Item 1",
 "Item 2", "Item 2", "Item 3", "Item 4", "Item 5" });
 mListView.setAdapter(mAdapter);
 }

@Override
 public ListView getListView() {
 return mListView;
 }

@Override
 public void getSwipeItem(boolean isRight, int position) {
 Toast.makeText(this,
 "Swipe to " + (isRight ? "right" : "left") + " direction",
 Toast.LENGTH_SHORT).show();
 }

@Override
 public void onItemClickListener(ListAdapter adapter, int position) {
 Toast.makeText(this, "Single tap on item position " + position,
 Toast.LENGTH_SHORT).show();
 }

}

Get the source code from the following link .
Let you comment on posts and encourage me for nice posts in future…


This post is very impressed me. It saves a lot of time .Thanks for this post.

piergiu's avatarCan't talk, computing...

In the recent past I was struggling to get my 1000+ bookmarks organized(folders and sub folders and subsubfolders and on..).

I tend to accumulate every little piece of interesting thing I find on the interweb.
I asked my social-contacts what should I do with too much bookmarks, how to deal with them, how to organized them.
Answers varied from “delete them!” to “You must be organized!” and even to “Bookmarks?”

Yeah, why bookmarks? All in all, I don’t feel like they helped me that much since the web become so full of contents.

And then I searched a little bit and found this page, that kind of pretty much answered my question about the need of bookmarks, and their purpose. They even mention Delicious, that I thought exinct!
I’m the one who tends to bookmark sites to “save” their content.

For time (even before asking my social-contacts) I…

View original post 244 more words