Logcat Clearing too Fast- Eclipse

While running app on latest android devices, from ADT Eclipse, you may find difficulty in viewing LogCat data. As lots of other background services of different apps are running, logcat clearing out in a glimpse.

At this kind of situation, To view LogCat data you have to change a Eclipse setting as shown below..

Goto Window ->Preferences -> In left panel expand Android -> select LogCat -> here in right panel you can see Maximum number of LogCat messages to buffer set as 5000,

Change this value to some large number like 500000. Click Apply and then Ok. (You may get a Error notifying a preference change listener. just ignore it.)

logcat clearing

Now you can able to see LogCat data.

Hope it helps somebody.

Cheers 🙂


You may be also interested in

Could not resolve com.android.support:support-v4:22.0.0, Android Studio

While implementing Push Notifications, I get this error Could not resolve all dependencies for configuration

I’ve installed Google Play Services and Google Repository using SDK manager

not resolve

and added the following dependencies in gradle file

dependencies {
   compile 'com.google.android.gms:play-services-gcm:7.0.0'

When I run the app, I see following error,

Could not resolve all dependencies for configuration ':library:_debugCompile'.
> Could not resolve com.android.support:support-v4:22.0.0.
Required by:
:library:unspecified > com.google.android.gms:play-services:7.0.0 > com.google.android.gms:play-services-base:7.0.0
> No cached version of com.android.support:support-v4:22.0.0 available for offline mode.

After searching solution for a while, I found the issue is due to this  “You need to make sure you have Android Support Repository up to date – that is where Android Support Library dependencies are resolved.”

So, I installed Android Support Repository,

and Rebuild app… Fixed the issue.

Hope it helps somebody..

ref link: http://stackoverflow.com/a/29569756/341443

Authentication is required. You need to sign in to your Google Account. -Google Play In-App Purchase(IAP)

Issue: Google Play In-App Purchase(IAP)

While working with Google Play In-App Purchase feature, follows

After uploading Trivial Drive app in Alpha Testing, and configuring Store listings and In App products and charges, published app in Google Play Developer Console.

While testing the Trivial Driver app,


on a device with test account… Im able to Buy Gas


but when i tried to click on button for Upgrade My Car, or Get Infinite Gas, I see following error

In-App Purchase

At first I just confused about it. Later I find that there is a difference between Product Id that I created in In-App Products Developer console, and SKU_Productid constants written in code. as shown below In code

 // SKUs for our products: the premium upgrade (non-consumable) and gas (consumable)
    static final String SKU_PREMIUM = "premium";
    static final String SKU_GAS = "gas";

    // SKU for our subscription (infinite gas)
    static final String SKU_INFINITE_GAS = "infinite_gas";

In In-App Products


SO, I just changed code for SKU_ProductId constants to match with In-App products created in Developer console. And Changed application version code and name in manifest file, Generated new APK file and uploaded to Developer console Alpha Testing. After 2-3 hours waiting, its got published.. and I see everything is working fine. to summarize whole thing, you just need to use same SKU_ProductId in code, which is created in In-App Products developer console.

Hope it helps somebody…

Few other reference for In-App Billing app testing


** https://help.gamesalad.com/hc/en-us/articles/203536123-7-6-In-App-Purchases-IAP-for-Google-Play

* https://blahti.wordpress.com/2014/07/30/how-to-add-in-app-billing-in-android-part-1/ http://android.stackexchange.com/a/40827/101168


onActivityResult always getting Result_Canceled from TabActivity

Recently while working with tabs, I see this situation onActivityResult , always getting 0(RESULT_CANCELLED).

I have four activities A-Activity,B-TabActivity,C-Activity, D-Activity. where A starts TabActivity B, and in this TabActivity, Im displaying 2 tabs C and D as child activities.

I need result from C or D whether success or not when Activity closed. So I started TabActivity B which displays C and D as tabs.. as shown below,

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

now after getting required information in Activity C, I closed Activity C by setting result as below

Intent data = new Intent();

and when i check the resultCode in Activity A, in

onActivityResult(int requestCode, int resultCode, Intent data)

method, Im always getting


Solution to handle this onActivityResult issue,

In child Activity C and D, before finish we should check the getParent() method null or not… and then setResult accordingly… as shown below,

Intent data = new Intent();
if (getParent() == null) {
setResult(Activity.RESULT_OK, data);
} else {
getParent().setResult(Activity.RESULT_OK, data);

After applying this change, Im able to get the exact resultCode in Activity A.

Hope it helps somebody..

Cheers 🙂

Ref link & credits:http://stackoverflow.com/a/2621390/341443

You may also interested in


Keytool error :java.io.IoException:Incorrect AVA format

When trying to generate new APK file in ADT Eclipse editor, using Android Tools-> Export Signed Application package. I see this following Keytool error as belowkeytool error

Solution for Keytool error

After searching for a while, I found the issue is due to entering invalid characters like comma(,), Plus (+) etc signs in Key creation dialog. So after removing it, Im able to generate APK file successfully.
Hope it helps somebody.

Cheers 🙂

You may be also interested in

Split String using | (pipe) symbol method

Split string using |

If you try to split string using |(pipe) symbol as below


it doesn’t work as expected. As it means “split on every character.”

So you should try with double backward slash and Pipe symbol as below


Hope it helps somebody…


ref link & credits: http://hoskinator.blogspot.in/2006/11/trouble-using-pipe-with-stringsplit.html

You may also interested in following

Generate signed APK file with Specific name Android Studio

In Android Studio, when clicked menu Build-> Generate Signed APK file, the dialogs displayed for generating APK file, doesn’t allow you to edit the APK file name. It just applies default app name to build file, unlike ADT Eclipse.


We have to write Groovy code in Gradle build file to, Generate singed APK file with Specific name.

Here i’m just giving an example how we can write it.
For eg: If your app name is helloWorld, If you generate APK build file, it will creates helloWorld-release.apk file. But if you want to generate Apk file with appending version name, and change filename like “HelloWorld-1.0v.apk”.

In project open build.gradle file, you should have defaultConfig as below

defaultConfig {
    applicationId "com.sample.helloworld"
    minSdkVersion 14
    targetSdkVersion 14
    versionCode 1
    versionName '1.0'

in this build.gradle file, define a method just above the dependencies, as below

def appendVersionName(variant, defaultConfig) {
    variant.outputs.each { output ->
        if (output.zipAlign) {
            def file = output.outputFile
            def fileName = file.name.replace("helloWorld-release.apk", "HelloWorld-" + defaultConfig.versionName  + "v.apk")
            output.outputFile = new File(file.parent, fileName)

        def file = output.packageApplication.outputFile
        def fileName = file.name.replace("helloWorld-release.apk", "HelloWorld-" + defaultConfig.versionName + "v.apk")
        output.packageApplication.outputFile = new File(file.parent, fileName)

dependencies {
    compile files('libs/android-support-v13.jar')
    compile 'com.android.support:appcompat-v7:21.0.2'

then search for buildTypes, and call the appendVersionName method as shown below,

buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

            applicationVariants.all { variant ->
                appendVersionName(variant, defaultConfig)


That’s it. Now Goto Build-> Generate a Signed APK… just follow the dialog, click Finish, and you will see APK file created with your specified name.

Hope it helps somebody…

Cheers.. 🙂

ref link & credits: http://stackoverflow.com/a/22126638/341443

You may also interested in

You need to complete the points below before you can publish your application-Play Store

When Publish your app in Google developer console

After adding all Store listings information, You may still see that Publish your app button is disabled and you can only Save Draft. When you click on Why can’t I publish? link you may see below reason.

You need to complete the points below before you can publish your application.

*  You need to acknowledge that this application meets the Content Guidelines.
*  You need to acknowledge that this application complies with US export laws.

If you just stuck on this, you just need to make one more step to be able to Publish app.

On left side menu panel, Click on Pricing and Distribution. Scroll to the bottom of the page that comes up. There you will find the place to acknowledge that the app meets Content Guidelines, and to acknowledge that it complies with US Export Laws. Just check these points and Save changes.

publish your

You’ll be able to Publish the app.

Cheers 🙂

You may be also interested in

Show soft keyboard for EditText when Fragment starts

At times When app screen starts, we may need to show Soft keyboard Popup for the EditText, which having focus. So user don’t need to touch on the EditText to show keyboard.

show soft keyboard

To show keyboard for EditText view when Activity starts. We can just implement in XML design file in EditText tag by using <requestFocus />. see below


But the above XML code not works when using in Fragment, to show keyboard when Fragment screen starts.

Solution to show soft keyboard

We need to handle in code to force show keyboard. Following code works fine..

* TODO showInputMethod
public void showInputMethod() {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);

Call this method in Fragment OnCreateView(…). Now It will show the softkeyboard.

And You can hide the Softkeyboard, when user touched on any other place than the EditText in Activity screen, using following code (place this code in Activity)

  /* (non-Javadoc)
* @see android.app.Activity#dispatchTouchEvent(android.view.MotionEvent)
  public boolean dispatchTouchEvent(MotionEvent event) {
      View v = getCurrentFocus();
      boolean ret = super.dispatchTouchEvent(event);
      if (this instanceof SkylineMessagesActivityAdv) {
          return false;
      if (v instanceof EditText) {
          View w = getCurrentFocus();
          int scrCoords[] = new int[2];
          float x = event.getRawX() + w.getLeft() - scrCoords[0];
          float y = event.getRawY() + w.getTop() - scrCoords[1];
          if (event.getAction() == MotionEvent.ACTION_UP && (x < w.getLeft() || x >= w.getRight() || y < w.getTop() || y > w.getBottom())) {
              InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
              imm.hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0);
      return ret;

Hope it helps somebody..

Cheers 🙂

You may be also interested in


How to debug project, Android Studio

Android Studio: Debug Project

This post is for beginners, to give basic understanding to debug project in Android Studio.

To debug Project, you have to place breakpoints at the code line, of a method or class, So the debugger will stop at that break point while debugging.
To place a break point just click on  work space left side border you can see red dot. To remove breakpoint just click on red dot again.


To debug a project from starting screen of your app, You have to click on the Debug menu button, or Press Shift+ F9

*generally, while debugging app slows down.

So, You can use another debug option to debug at a Specific Screen.
At times you may want to debug code in a Specific screen at a particular line for eg. on a Save button click event method.

So, Place a breakpoint at that particular onClick(View v) method.


And just run the app by clicking Run menu button


After running app on device or emulator, navigate to the Specific screen and just before clicking on Save button(button event where you want to debug code) in screen. Click on Attach debugger to Android Process menu button in Android Studio work space.


You’ll see a dialog to select a process, here select your process (and wait for a moment for debugger to attach to process) and now click on the Save button in that Specific screen. You can see Debug console at the bottom and debugger waits at break point at a specific line to enable you start debugging.

debug project

Here I just like to explain few useful debug console button functionalities

Press F8 or click on the below debug console button icon, to move debugger to next line.. and so on…


Press F7 or click on the below debug console button icon, to move debugger to in to a inner class method.(This is very rarely used). Use it whenever a method call is escaping from debugging.


Press F9 or click on the below debug console button icon, to execute code up to next break point..


Press Ctrl+F2 or click on the below debug console button icon, to stop debugger execution, when you click on this button, debugger stops execution and app runs normally.


these buttons are mainly used for debugging. If you understand these button functions first then You can see and understand other button functions easily.

You can see all variables data and instances data of Specific screen in Variable section…


Hope it makes sense and helps somebody.

cheers 🙂

You may also interested in