android

How to avoid SQLiteException locking errors

I'm developing an android app. It has multiple threads reading from and writing to the android SQLite db. I am receiving the following error: SQLiteException: error code 5: database is locked I understand the SQLite locks the entire db on inserting/updating, but these errors only seems to happen when inserting/updating while I'm runnin...

How to Handle in code IllegalStateException on Cursor?

When I was debugging my application suddenly this error popup. How can I handle this kind of error? I don't know where and how is caused. Daemon System Thread [<5> HeapWorker] (Suspended (exception IllegalStateException)) SQLiteCursor.finalize() line: 603 NativeStart.run() line: not available [native method] ...

Is there a way to arbitrarily load Resources at runtime in Android?

I've got some XML resources in my Android app. Each one has a different name like "bicycle.xml" and "car.xml". I'd like to know if there's a way to load resources based on conditions during run time. As an example... Say I had a text input in my app. When the user enters "bicycle", my app can look up an XML resource by that name, pars...

Android ListView style

Hi, I have a question about list views. I hope someone knows the solution, because I have been trying to solve this problem all weekend. I have a custom list view in which every row have a custom .xml (item_row.xml) with a set color background for the row item. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http:...

"Scheduling restart of crashed service", but no call to onStart() follows

In the 1.6 API, is there a way to ensure that the onStart() method of a Service is called after the service is killed due to memory pressure? From the logs, it seems that the "process" that the service belongs to is restarted, but the service itself is not. I have placed a Log.d() call in the onStart() method, and this is not reached. T...

Add a contact to android emulator

Hi, My issue is quite simple I think : I would like to be able to add a contact to the contact list by a simple click on a button (and be able to test it on the emulator). The data of this contact would be stored in the source code of the application. is there an easy way of doing that? thank you for your answers ...

trying to override getView in a SimpleCursorAdapter gives NullPointerException

Would very much appreciate any help or hint on were to go next. I'm trying to change the content of a row in ListView programmatically. In one row there are 3 TextView and a ProgressBar. I want to animate the ProgressBar if the 'result' column of the current row is zero. After reading some tutorials and docs, I came to the conclusion t...

Leverage Google account credentials to send email in Android

Is it possible in Android to programmatically send an email using the phone's associated GMail credentials? I can send an email when I explicitly provide the username and password, but I was hoping to leverage the Google account already associated with the phone. Note that I don't need to actually access the username or password; I jus...

how to use spinner

I am very new to android. I want to use 2 spinners in my application, one shows the countries list, when any country is selected the other spinner should show the list of cities of that country. when city is selected some action is performed. plz help me with some sample code. thanks in anticipation ...

Listview item color..

Hi all. My list view is a multiple selection list view. i have to show the selected list view items in one color(say green) and the other items in some other color(red). How to achieve this? ...

How to connect a web service using SSL on android platform

hello.. i need to connect to a web service using ssl protocol. Can anyone suggest me how to do that? ...

[Android] any integer return when user read the sms

Hi i want to do some activity on sms after user read it, so how can my background service in android know that particular sms is now read(when my service start work) to react for some task. is there system generate any integer when user read sms. if it generate than how will i get? if anyone have any idea than share it. ...

android Paint.setShadowLayer() vs Canvas.drawbitmap() problems

Hi, I use the following code to draw a bitmap during onDraw of a custom View Paint p = new Paint(Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG); p.setShadowLayer(3,3,3,0xff000000); Bitmap bmp = BitmapFactory.decodeResource(some drawable jpg); canvas.drawBitmap(bmp,null,new Rect(blah blah),p); and the shadow looks funny. What do I me...

Android tabwidget next focus is 5 row in the listview

I am using listview in tabwidget tab1 when my focus is on "Tab label" and i press arrow keys or track ball to go down focus directly jumps to the 5th row in the listview. any idea whats going wrong ? ...

How to share web application with facebook, twitter etc

Hi, i made news applicaion in android using RSS feed and now i want to share some news ie i want to upload links from my app to facebook, twitter etc.Is it possible? Thanks ...

Android emulator application deployment error

Hi Fellows, I have developed an application in Rhodes framework and deployed the application in an Android emulator. When I try to access the application i get the following error, SD card error, Application can't access the SD card while it's mounted.Please unmount the device and stop the adb server before launching the application. I ...

Android Get Image Uri from Camera

Hi I have an application that calls the android phone's default camera to take photo the following is my code. Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, TAKE_PICTURE); and in the onActivityResult method I am doing the following if ((requestCode == ...

How to successfully add account to android E-mail Database ?

Hi all... I am trying to add an account to E-mail database ,Below is the way i'm trying ... Account account = new Account(mContext); account.setDescription("acc added thr prog"); account.setAutomaticCheckIntervalMinutes(10); account.setEmail("[email protected]"); account.setDraftsFolderName("Drafts"); account.setOutboxFolderName("OutB...

How to gradient fill a button's background?

I have to create a colored button with gradient fill(starting from the middle of the button along Y axis). If I set the background property of the button to the color I want, I lose the rounded look and feel of a button and also the gradient fill(It looks like a TextView with a background). Also, I want this color to change when the use...

How to roll back a transaction on Android?

Here is the standard idiom for transactions: db.beginTransaction(); try { ... db.setTransactionSuccessful(); } finally { db.endTransaction(); } I want to add a catch block, and I want to issue a rollback. Is it possible, and at all do I need it? ...