ViewPager update fragment on swipe – Android

1) Attach the Listener:

mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            public void onPageScrolled(final int i, final float v, final int i2) {
            public void onPageSelected(final int i) {
                YourFragmentInterface fragment = (YourFragmentInterface) mPagerAdapter.instantiateItem(mViewPager, i);
                if (fragment != null) {
            public void onPageScrollStateChanged(final int i) {

2) This is your Interface:

public interface YourFragmentInterface {
    void fragmentBecameVisible();

3) Change your fragments so they implement this:

public class YourLovelyFragment extends Fragment implements YourFragmentInterface {

4) Implement the interface in the fragment

public void fragmentBecameVisible() {
    // You can do your animation here because we are visible! (make sure onViewCreated has been called too and the Layout has been laid. Source for another question but you get the idea.
Leave a comment

Posted by on February 5, 2016 in Android Source Code


Handle onKeyListener in Fragment – Android

public static class MyFragment extends Fragment {

        public void onResume() {
            getView().setOnKeyListener(new View.OnKeyListener() {
                public boolean onKey(View v, int keyCode, KeyEvent event) {
                    //YOUR CODE
                    return false;
Leave a comment

Posted by on February 3, 2016 in Android Source Code


error validating location org.apache.subversion.javahl.clientexception

Just do changes suggested below to get it resolve:
In eclipse: Window > Preference > Team > SVN: select SVNKit (Pure Java) instead JavaHL(JNI)

Leave a comment

Posted by on January 29, 2016 in Android Source Code


Setup SVN in android studio

1. Download Subversion 1.8.13 ( 1.8 ) Download link ( )
2. Unzipped in a folder. Find folder “bin” inside it.
3. Go to settings – > Version control -> Subversion
Don’t check Enable interactive mode if that option presnt under Use command line client option
4. Copy the url of your downloaded svn.exe that is in bin folder that you have downloaded.
Don’t forget to give the end name like svn.exe last as per image.
5. Apply -> Ok
6. Restart your android studio now.
7. Again Go to VCS > Enable Version Control Integration
8. Select Subversion > 1.8 plugin > Click OK
9. To checkout a project, choose “VCS” => “Checkout from Version Control” => “Subversion”
10. Select the same project where you want to checkout and click OK
11. Restart the eclipse and find all actions related to SVN like checkout/checkin in Android Studio

Leave a comment

Posted by on December 20, 2015 in Android Source Code


com.ianywhere.ultralitejni12.implementation.JniException: UltraLiteJ Error[-1497]: The synchronization failed because MobiLink returned authentication status ‘4’ with value ‘4000’

“com.ianywhere.ultralitejni12.implementation.JniException: UltraLiteJ Error[-1497]: The synchronization failed because MobiLink returned authentication status ‘4’ with value ‘4000’”
“The number of registered devices has reached the maximum limit for your license.”

both related to each other

Issue reason:
1. Go to SCC (Sybase Control Center)
2. Login with username and password
3. Go to Unwired Platform Cluster > click on localhost@localhost > click on Licensing check for the Total device license count no. and compare with Used device license count no. if used exceeds then above issue comes.

Solution to resolve above issue:
Remove some registered devices from SCC and then login into your app again. This will solve your issue.

Leave a comment

Posted by on December 19, 2015 in SAP Mobility


adb server didn’t ack * failed to start daemon

Try the following:

  1. Close Eclipse.
  2. Restart your phone.
  3. End adb.exe process in Task Manager (Windows). In Mac, force close in Activity Monitor.
  4. Issue kill and start command in \platform-tools\
    C:\sdk\platform-tools>adb kill-server
    C:\sdk\platform-tools>adb start-server
Leave a comment

Posted by on December 17, 2015 in Android Source Code


Android image orientation issue with custom camera activity

ExifInterface exif = new ExifInterface(_path);
          int exifOrientation = exif.getAttributeInt(

          int rotate = 0;

          switch (exifOrientation) {
          case ExifInterface.ORIENTATION_ROTATE_90:
          rotate = 90;

         case ExifInterface.ORIENTATION_ROTATE_180:
         rotate = 180;

         case ExifInterface.ORIENTATION_ROTATE_270:
         rotate = 270;

           if (rotate != 0) {
          int w = bitmap.getWidth();
          int h = bitmap.getHeight();

// Setting pre rotate
          Matrix mtx = new Matrix();

         // Rotating Bitmap & convert to ARGB_8888, required by tess
         bitmap = Bitmap.createBitmap(bitmap, 0, 0, w, h, mtx, false);
         bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
Leave a comment

Posted by on December 8, 2015 in Android Source Code


Get every new post delivered to your Inbox.

Join 61 other followers