RSS

How to do clear data through app – Android

public void clearApplicationData()
{
File cache = getCacheDir();
File appDir = new File(cache.getParent());
if (appDir.exists())
{
String[] children = appDir.list();
for (String s : children)
{
if (!s.equals("lib"))
{
deleteDir(new File(appDir, s));
Log.i("TAG", "**************** File /data/data/APP_PACKAGE/" + s + " DELETED *******************");
}
}
}
}

public static boolean deleteDir(File dir)
{
if (dir != null && dir.isDirectory())
{
String[] children = dir.list();
for (int i = 0; i < children.length; i++)
{
boolean success = deleteDir(new File(dir, children[i]));
if (!success)
{
return false;
}
}
}
return dir.delete();
}

 
Leave a comment

Posted by on April 26, 2016 in Android Source Code

 

ViewPager update fragment on swipe – Android

1) Attach the Listener:

mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(final int i, final float v, final int i2) {
            }
            @Override
            public void onPageSelected(final int i) {
                YourFragmentInterface fragment = (YourFragmentInterface) mPagerAdapter.instantiateItem(mViewPager, i);
                if (fragment != null) {
                    fragment.fragmentBecameVisible();
                } 
            }
            @Override
            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

@Override
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 {

        @Override
        public void onResume() {
            super.onResume();
            getView().setFocusableInTouchMode(true);
            getView().requestFocus();
            getView().setOnKeyListener(new View.OnKeyListener() {
                @Override
                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 ( https://www.visualsvn.com/downloads/ )
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’”
OR
“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

 
 
Follow

Get every new post delivered to your Inbox.

Join 63 other followers