Android Compatibility JAR not found: android-support-v4.jar

Hello,

If by any chance your Android Project has shown problems in Eclipse, and the console message tells you something about missing android-support-v4.jar, the solution is very simple: download the jar from this place.
Then right-click on the project in Eclipse, choose Properties->Build Path and add the jar.
This should do the trick.
Hope it works.

Posted in Android at February 7th, 2012. No Comments.

To Remember…

  • android:gravity sets the gravity of the content of the View it’s used on.
  • android:layout_gravity sets the gravity of the View or Layout relative to its parent.

source: http://stackoverflow.com/questions/8180887/android-ui-how-to-align-linearlayout-at-the-center-of-its-parent

Posted in Android at December 10th, 2011. No Comments.

Inflate elements in GUI

Maybe your problem is something like this: you want to use some elements that are described in other xml then your main content view.

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.maingui);

  ...............

For instance, if you want to add a WebView in an existing activity and that webview is a self alone xml separated from your maingui.xml, in your java code all you need to do is this:
LayoutInflater layoutInflater = (LayoutInflater) this. getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = layoutInflater.inflate(R.layout.webviewlayout, mWebView);
mWebView = (WebView) view.findViewById(R.id.webview);

And from now on you can use mWebView in your logic, think of it as it’s your own in the class you are working on.

Have fun.

Posted in Android at October 17th, 2011. No Comments.

My design #fail

Design in Android is very painful for me.

Posted in Uncategorized at October 14th, 2011. No Comments.

Error: Circular dependencies cannot exist in RelativeLayout

You get this error if in your Gui xml file you “connect” two elements both way, something like saying item A is android:layout_toRightOf=”@+id/itemB” and item B is  android:layout_toLeftOf=”@+id/itemA”.

One connection is enough.

Posted in Android at October 8th, 2011. No Comments.

Use MySQL from Android device

I did not found the solution, but I found the answer on StackOverflow and it saved my day/night. I was trying to import a mysql connector jar to use in my android application that needs to connect to a remote database. I constantly got this nicely drawn error:

Read More…

Posted in Android at August 22nd, 2011. No Comments.

Caused by: java.lang.IllegalStateException: get field slot from row 0 col -1 failed

If you are having fun with Cursor from Android and get this error you might wanna take a second look at the conditions you are passing to the Cursor object:

- check Projection, Selection, Selection Arguments, Order by…

Maybe you are trying to set information that you are not “calling” from projection.

Hope it helps.

 

Posted in Android at August 19th, 2011. No Comments.

Permission denied to write on SDCard in AVD

If you want to use the SD Card within an Android Emulator, you need to do two things:

1. add the permission in the manifest xml file:

<uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” />

2.  Configure your AVD to actually have an sd card. See figure below:

Posted in Android at July 29th, 2011. No Comments.

Android database from emulator to the computer and vice versa

1. Pull data from emulator and save a copy on the computer

C:\Program Files\Android\android-sdk-windows>adb pull data/data/com.sthg.test/databases

pull: building file list…

pull: data/data/com.sthg.test/databases/X.db -> ./X.db

1 file pulled. 0 files skipped.24 KB/s (18432 bytes in 0.731s)

2. Push data from computer to the android emulator

C:\Program Files\Android\android-sdk-windows>adb push X.db data/data/com.sthg.test/databases/212 KB/s (7168 bytes in 0.033s)

Posted in Android at April 25th, 2011. 1 Comment.

Where is my local android database?

Your question: where is my local android emulator database?

What are you using: windows :D

Before you start: make sure adb recognises your devices. To test this run : adb devices. If you get an empty list, don’t panic. The solution is to run your application.(why can’t it find the devices without starting the emulator beats me. When you want to run an application and choose a virtual device it knows the entire list.)

Read More…

Posted in Android at April 24th, 2011. 1 Comment.
Weather Reports