android

Is it OK to start a service from the ContentProvider.onCreate()?

My application after an update needs to fill its ContentProvider with some data found on the server. I found that starting a service from the ContentProvider.onCreate() method works but I'm not sure if it is a good idea or if it works randomly. I don't know the initialization of an application in android. Are the services always already...

creating dynamic view, multiple a view X times, get/set value for each group

I have a base view in XML. <RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content"><TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="Family" android:id="@+id/Fam...

Access SIM card from code, I look for code eamples

Hi All I am developing a telephony tests on Android, I passed to work with Eclair. I wish to know how can I work with sim card from code. I write tests that testing a sim card on our platform I has a code that use to work on cap cake and has many errors when transfered to Donut/Eclair. Some apis missing etc. Please help me I would ...

Handling UI code from a Thread

I know how to use handlers to update UI elements such as progress bars toasts etc. The problem I am having is when the context goes away such as the user pressing the back button or the Activity finishing for some reason. This causes my application to crash often. I tried using getApplicationContext() (Thinking that this would be avai...

How to parse ical file(.ics) with ical4j API?

Anyone have idea of parsing the ical calendar file with ical4j API for android app using eclipse as development environment. I have added ical4j API, to my project, but getting some errors related to API. ...

Displaying Calendar in month view

Hello developers, i just wanna know is it possible to display the Calendar in the month view using the api available. i am searching for while dint find anything to display the calendar in the Month view . kindly help and let me know is this possible using android sdk1.5 or 1.6 or even 2.0. If not what would be the procedure to genera...

Notifying when screen is off

I'm trying to generate a notification which vibrates the phone and plays a sound when the screen is off (cpu turned off). According to the Log messages, the notification is being sent, but the phone doesn't vibrate or play the sound until I turn the screen on again. I tried holding a 2 second temporary wakelock (PowerManager.PARTIAL_WAKE...

Android SDK Setup.exe will not run

Running XP sp3 when i click SDK Setup.exe command line promt comes up and goes away fast and nothing else happens is there a fix for this ? ...

Android GridView - update View based on position

I have a GridView, using a custom adapter (myAdapter extends BaseAdapter), where each item in the grid holds an ImageButton. getView() is working fine. However, from elsewhere in my code, how can I update the image (setImageResource) for one particular item in the grid based on its position in the GridView? So far, I've added this to m...

Android: get current sensor state

Yes, I can get sensor update events with SensorEventListener. But this approach has 2 drwwbacks: 1) For some sensors I have to wait for the state to update. For example, temperature may update after a minute! 2) In some cases I can get incorrect readings. For example, the phone lies on a flat surface and does not move. I receive first ...

How to send an image through HTTPPost ?

Hello there, i'm creating an activity which needs to upload an image to a webservice using their api. I found that if i use UrlEncodedFormEntity and send the image data through that. the webservice doesn't receive that. ( at least it will not be able to read that .) In fact if i add some vars to send with the image data ( like name of ...

Question: how to implement android double tap?

hi guys im having problems with implementing the double tap. Well i implemented the ongestureListener and i had the gesturedetector, but im not sure wheres the problem here is my code: public class home extends TabActivity implements OnGestureListener { /** Called when the activity is first created. */ private EditText queryText;...

Changing background color of ListView items on Android

How can I change background color of ListView items on a pair-item basis. When I use android:backgroundColor in the ListView item layout I can achieve this, however the list selector is no longer visible. I can make the selector visible again by setting drawSelectorOnTop to true but then the selector overlays the whole item. Any ideas h...

Opening a specific Android home screen page

I am trying to create an Android service that causes a specific home screen page to open when the Droid is placed in the Car Dock instead of having it open the Car Home application. I cannot find any reference to how to specify a home screen page other than the center page that always gets displayed when pressing the Home button by using...

how to add iCal4j dependencies in addition to the iCal4j library in android?

I am trying to parse the ical file with ical4j, i have added ical4j jar file to project but have problem in adding iCal4j dependencies in addition to the iCal4j library. As specified in http://wiki.modularity.net.au/ical4j/index.php?title=FAQ Any idea how can I do this? In addition to this, can anyone provide with ical file parse exa...

Detect what is underneath a translucent activity

If I were a translucent activity invoked by an intent and come to the top of activities stack, is there a method to know who is immediately underneath me? get its componentname etc. ...

how to reference a higher class within an anonymous class

I have this code: public class Home extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //... //at some point I have s.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){ @Override public ...

Using a utility to generate Java code to make my project more concise. Good idea?

The project I'm working on requires me to write lots of repetitive code. For example, if I want to load a image file called "logo.png" in my code, I would write something like this: Bitmap logoImage; ... // Init logoImage = load("logo.png") ... // Usage logoImage.draw(0, 0); .. // Cleanup logoImage.release(); Having to write this co...

Combining subclasses which have different fields for efficiency?

I'm working on a Java Android game. Games here generally need to use memory pools to avoid garbage collection. For the sake of argument, say I have the following classes: // Enemy in the game class Enemy { int x; int y; abstract void update(); } // Enemy that just bounces around class Roamer extends Enemy { int direction; ... } // Enem...

"Cannot make a static reference to a non-static method" in Android

I'm having some issues with the old "Cannot make a static reference to a non-static method" error in my Android program. I am creating a sand falling game (similar to the Powder Game) and I created a class called Control to create a Control Bar at the bottom of the screen with a slider for brush size (that works fine) and a button to pop...