Difference between LocationRequest setInterval (long millis) and LocationRequest setFastestInterval (long millis)

I am writing my own background location updates for interval of every 5 minutes in android. I would like to know the difference between setInterval and setFastestInterval When I setInterval to 5 mins and setFastestInterval to 2 mins. The location update is called every 2 mins. I would like to know the difference. I couldn’t […]

how to get text color of textview?

In given code lbl[0].getTextColor() is giving Error but i don’t know how to get text color of textview in java file please help me. public void angry(View v) { if (lbl[0].getTextColor() == Color.BLACK) lbl[0].setTextColor(Color.RED); if (lbl[0].getTextColor() == Color.RED) lbl[0].setTextColor(Color.BLACK); } Thanks.

Android – play sound on button click – Null pointer exception

I am trying to play a sound file on the click of a button. The sound is just 1 sec long. It plays well the first few times I click the button, but after a while it gives a NullPointerException. Here’s the code: button[i].setOnClickListener(new OnClickListener() { public void onClick(View view) { mp = MediaPlayer.create(Test.this, R.raw.mysound); […]

Incorrect line ending: found carriage return (\r) without corresponding newline (\n)

I received error in my xml file. “Incorrect line ending: found carriage return (\r) without corresponding newline (\n). <Button android:id=”@+id/btn_login” android:layout_width=”100dip” android:layout_height=”wrap_content” android:layout_alignParentBottom=”true” android:layout_alignRight=”@+id/et_un” android:layout_marginBottom=”15dp” android:layout_marginRight=”22dp” android:text=”Login” android:textColor=”#AA0000″ android:textSize=”10pt” /> How to solve it. can anyone help

How to capture soft keyboard input in a View?

I have a subclassed View that pops up the keyboard when it receives a ‘touch up’ in onTouchEvent. It shows this by requesting focus, retrieving the InputMethodManager, and then calling showSoftInput. Now I need to figure out how to capture the tapped letters of the soft keyboard, as they are pressed. I am currently only […]

Can't resize a RelativeLayout inside a ScrollView to fill the whole screen

I am having a weird issue that I am not sure how to fix. I have a RelativeLayout inside a ScrollView and this scrollView has it’s height set to fill_parent. So does the RelativeLayout. Still, the contents are not filling the entire screen and it’s going only to the wrap_content of the last layout inside […]

Custom event listener on Android app

I need to set up a simple event listener to refresh a ListView once in a while. The problem is I don’t know how could I generate an event. I know that for events like key or button pressing I just need to implement the Handler. But in this specific case I actually need to […]

NDK – How to use a generated .so library in another project

I have used ndk successfully to build & use a .so file in one project. I need to use this library in another project. I would rather not copy the source there, but just use the library. Trying to copy & paste the whole libs/armeabi/libcommon.so to the project root does not work, I think because […]

How can I enable javadoc for the Android support library?

When using the Android support library for compatibility and try to view the javadoc for, say, FragmentTransaction, I get the following error because there is no associated javadoc file: android.support.v4.app.FragmentTransaction Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found. The support library is added under the Android […]

Check whether the SD card is available or not programmatically

My app is working for mobiles which have an SD card only. So programmatically I want to check if the SD card is available or not and how to find the SD card free space. Is it possible? If yes, how do I do it?

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.