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

Jar mismatch! Fix your dependencies, ADT Eclipse

I see this exception Jar mismatch! Fix your dependencies, while working on a project in ADT Eclipse editor

In the logcat, I see as below

Found 2 versions of android-support-v4.jar in the dependency list,
but not all the versions are identical (check is based on SHA-1 only at this time).
All versions of the libraries must be the same at this time.

Solution for Jar mismatch

To fix this issue,

I followed following steps to fix

  • Right Click the project
  • Go To "Android Tools" > "Add Support Library"
  • Approve the permissions and let it update the library
  • If you have a library project, Repeat this process for the project App Library too.
  • Now Clean project and rebuild fixes the issue.

Jar mismatch

Hope it helps somebody

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

cheers 🙂

You may be also interested in

 

Get a child view of TableRow in a TableLayout

Get a child view of TableRow

To get child View of a TableRow, you can use following method,

tablerow.getChildAt(columnno);
//here columnno is 0 based index

eg:

At times we store string data in tag of TableRow View using setTag(“tagdata”) method, We can get that stored data using following code

If View is placed in 5th column

for (int i = tl.getChildCount(); --i >= 1;) { 
//here --i>==1 is used to exclude table header
     TableRow tr=(TableRow)tlServiceManual.getChildAt(i);
     View chkView=(View)tr.getChildAt(4);
    // here column is 4, since 0 based index
     if(chkView.getTag()!=null{
         //do something
     }
}

Hope it helps somebody..

(Y)

You may be also interested

 

Apply Button background color dynamically Android

Different ways of applying Button background color

To apply basic Colors as Button background, you can use default Color class

btn.setBackgroundColor(R.color.green);
(here btn is instance of a Button view).

To apply Colors using color resources in color.xml file

btn.setBackgroundColor(getResources().getColor(R.color.green));

your color.xml look like

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="green">#088e0b</color>
</resources>

and To apply background as color drawable, using color resources in color.xml file

Drawable drawable = resources.getDrawable(R.color.green);
btn.setBackgroundDrawable(drawable);
btn.setBackground(drawable);

your color.xml look like

<?xml version="1.0" encoding="utf-8"?>
<resources>
<drawable name="green">#088e0b</color>
</resources>

Hope it helps somebody

Cheers 🙂

Invalid request. Missing the ‘origin’ parameter. Google Map directions request URL error

Google Map Direction request API changed

It seems Google Map Direction request API changed, which is used to get polyline points to draw drive path.

Previously, I implemented drawing driving path on Map using below directions request. And this link worked perfectly, I used to get all the waypoints information, with it.

https://maps.googleapis.com/maps/api/directions/json?
waypoints=optimize:true|52.28582710000001,-1.1141665|52.2777244,-1.1581097&
sensor=false

but currently, I see this URL is not working any more, and its showing this message when i access above URL in web browser

{
"error_message": "Invalid request. Missing the 'origin' parameter.",
"routes": [
],
"status": "REQUEST_DENIED"
}

After searching for a while i found this link, and I see this info

origin (required) specifies the start location from which to calculate directions. This value may either be specified as a String (e.g. "Chicago, IL") or as a LatLng value.
destination (required) specifies the end location to which to calculate directions. This value may either be specified as a String (e.g. "Chicago, IL") or as a LatLng value.
travelMode (required) specifies what mode of transport to use when calculating directions. Valid values are specified in Travel Modes below.

It seems like Google directions API expecting these parameters origin, destination and travelMode in the directions request URL. and i see, TravelMode Driving is default

google.maps.TravelMode.DRIVING (Default) indicates 
standard driving directions using the road network.

So, I implemented code to produce this URL

https://maps.googleapis.com/maps/api/directions/json?
origin=52.28582710000001,-1.1141665&destination=52.2777244,-1.1581097&
waypoints=optimize:true|52.28582710000001,-1.1141665|52.2777244,-1.1581097&
sensor=false

and it worked fine and got the polyline points information.

Hope it helps somebody.

Ref links
Draw path on Map: http://javapapers.com/android/draw-path-on-google-maps-android-api/
Directions Url: https://developers.google.com/maps/documentation/javascript/directions

Display Menu items in ActionBar when using Fragment

Display Menu items in Fragment ActionBar

When Implementing Fragment screen, If it require to display Menu Items only specific to that Fragment screen.

If you just write the following code…

       
        @Override
	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
		// TODO Auto-generated method stub
		super.onCreateOptionsMenu(menu, inflater);
		menu.clear();
		inflater.inflate(R.menu.done_actions_menu, menu);
	}

	/**
	 * On selecting action bar icons
	 * */
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Take appropriate action for each action item click
		switch (item.getItemId()) {
		case R.id.action_done:
			Log.d(TAG, "Done button clicked...");
                        //action code
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}

It won’t display Menu items in ActionBar.

To display Menu Items you should also override OnCreate method of Fragment class as shown below

     
       @Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setHasOptionsMenu(true);

	}

Hope it helps somebody…

cheers  🙂

Validation using default feature of EditText

Default Validation EditText

I found a good article here on how to use the default feature of EditText to show the error. While writing the validation on EditText on a button click event or TextChanged event instead of showing alert dialog if you want to show error we can use the default feature of EditText as

EditText username = (EditText)findViewById(R.id.uname);
if( username.getText().toString().length() == 0 )
    username.setError( "Empty Text Field");

sample image

Validation

Hope it helps somebody 🙂

You may be also interested in

Get a Dialog style activity window to fill the screen-Android

Applying Dialog Style to Activity

Generally when we set Activity theme as dialog style,

<activity
android:label="@string/app_name"
android:name=".DialogActivity"
android:theme="@android:style/Theme.Dialog" />
<activity/>

its just display at the center of the screen, with specific width and height set in the XML Layout file or as per the Content. as shown below.

Dialog style

At times you may want to display Dialog activity as Full screen like a Child screen over a Parent screen. To do that, here is snippet code…

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.your_layout);
    getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
}

here Important point is, you should place the getWindow().setLayout() method statement after setContentView() method, otherwise it won’t work.

Ref link http://stackoverflow.com/questions/1362723/how-can-i-get-a-dialog-style-activity-window-to-fill-the-screen/1693716#1693716

Hope it helps somebody.

Quotes by Famous personalities

Quotes by Famous personalities

lincoln-seatedFamous

Here are some of the Quotes by Famous personalities

  • Believing everybody is dangerous; believing nobody is very dangerous – ABRAHAM LINCOLN
  • If you start judging people you will be having no time to love them – MOTHER TERESA
  • In a day, when you don’t come across any problems – you can be sure that you are traveling in a wrong path – SWAMI VIVEKANANDA
  • If someone feels that they had never made a mistake in their life, then it means they had never tried a new thing in their life – EINSTEIN
  • Everyone thinks of changing the world, but no one thinks of changing himself – LEO TOLSTOY
  • Don’t compare yourself with anyone in this world. If you do so, you are insulting yourself – ALEN STRIKE
  • If we cannot love the person whom we see, how can we love god, whom we cannot see – MOTHER TERESA
  • Winning doesn’t always mean being first, winning means you are doing better than you’ve done before – BONNIE BLAIR
  • I will not say I failed 1000 times, I will say that I discovered 1000 ways that can cause failure – THOMAS EDISON
  • 3 sentences for getting SUCCESS a) Know more than other b) Work more than other c) Expect less than other – WILLIAM SHAKSPHERE
  • If you win you need not explain…But if you lose you should not be there to explain – ADOLPH HITLER
  • Never Break 4 things in you life – Trust, Promise, Relation & Heart, because when they break they don’t make noise but pains a lot – CHARLES

—– these Quotes shared to me by GSR Kiran.

 

You may be also interested in

Avoid DatePickerDialog calls onDateSet two times

DatePickerDialog

While working with DatePickerDialog, I see an issue when setting a date and click done button. Its calling onDateSet method two times.

DatePickerDialog

here is a simple solution for it. DatePicker parameter object has a method called isShown(). Place method statements in the if condition of isShown(), which avoids calling onDateSet method statements two times.

@Override 
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
    if(view.isShown()) {
      //method statements 
       Log.i(MyClassName.class.getName(), year+ "/" +      monthOfYear   + "/" + dayOfMonth); 
    }
}

ref & credits to link.

Cheers.. 🙂