android

Android 2.1 vcard contact fields

Hi! I am trying to import a vcard into the contacts on my android phone. I have problems with some fields, e.g Family Name, Job title, Company,... With fields like phone and email it is already working. Here is a part of my code: Intent i=new Intent(Intent.ACTION_INSERT); Uri uri = Uri.parse("content://com.android.contacts/con...

converting Java code to Android

Hi I Have a Java application and I need to convert it to an Android application is there any resources to show how ? in Android developer site I didnt found anything like that! I need to use the Java methods and classes in android ,How it can be done? ...

When I install my apk I get an icon for every class in the project

I have a project in Eclipse with maybe 7 different classes that i open with Intent. The problem is when I install the .apk on my HTC phone I get an icon for every class. How do I make the project so it installs as one app only? /Johan Andersson ...

android service persistent

In my application I implemented a remote service that exchange data with a webserver each 20 minutes and modify the value of some object in MyApplication Class that extends Application. After 12 or 15 hour android kill MyApplication class and/or my Service. I tried to implement the android:alwaysRetainTaskState="true" without results...

Reusing a thread

Hi all I am trying to get my head around threads, and after attempting many times to get my head around it, I am stuck on this point. I want to get some remote data from a server. I create a thread to handle this operation. I understand this. But if I want to get some more remote data, I end up creating a new thread. This seems a bit d...

Clone textview to append it to a ViewGroup

I have a ViewGroup defined in XML with a view inside, at onCreate time I'd like to have a variable of those. I don't want to go through the hassle of using a listview+adapter cause its clearly overkill as I know the list won't change since onCreate() This is more or less the code I'd like to have. TextView mytextview = myViewGroup.find...

Convert a String or a InputStreamReader into InputSource

Hello all, I just read some tutorials in order to parse a xml feed from the web and turn them into a Listview: URL file = new URL("http://..../file.xml"); SAXParserFactory fabrique = SAXParserFactory.newInstance(); SAXParser parseur = fabrique.newSAXParser(); XMLReader xr = parseur.getXMLReader(); ReglageParseur gestionnaire = new Re...

Android - Open Music Player

Is there any way to programatically open the Android Music Player? I'm sure there is some kind of Intent somewhere but I cannot find it. James ...

Progress dialog wont show with async task

I have been searching for an answer for this for some time now. I have an async task that downloads the database needed for my app, while this is downloading my app cant do anything as all the data it references is in this file, i have the app waiting for the file to be downloaded but i am attempting to show a progress dialog so the user...

Updating List <HashMap>

I just want to know how to, if a Hashmap is already on the list add 1 to quantity, if it is not then add it to list. This is what I've done that just add eventhough the item is already on list. list = new ArrayList<HashMap<String, String>>(); Cursor c = db.rawQuery("SELECT code,desc,price FROM TbLPrice WHERE code =" + txtCode.getText()....

Android Canvas in my layouts?

I have a ViewFlipper that is transitioned between each view, I want to draw animation to a set of canvases, one for each view. How would I go about integrating the canvas into the view so that I can still have my buttons on top of it for example? If this isn't possible, how would I go about making images drawn to the canvas clickable s...

Spinner displays wrong value

I have a simple program where I set a spinner to a position. I then call a second module and when I return, I reset the spinner. The spinner display does not display the spinner value. When you tap the spinner, it IS pointing to the correct value, but it displays an incorrect value. In fact, it actually steps down. I wrote the follo...

Play an audio clip onto an ongoing call

Is it possible to modify an active call by overlaying a sound track during the call? I looked up the SDK, but couldn't find any api to do this in the documentation. I am trying to investigate the feasibility of playing a previously recorded call/audio clip onto an ongoing call. Thanks in advance. ...

how to get the current foreground app information from a service

i am writing an app with a feature like "press a hotkey or shake the phone and terminate current application". for example,when i am using a web browser and then shake the phone, the web browser will be killed. so i need to get the current application information(app name,package name,or something) from a service. how can i do that. ...

How to change font face of Webview in Android?

I want change the default font of webview to a custom font. I'm using webview in developing an bilingual browser app for Android. I tried getting an instance of custom typeface by placing my custom font in assets. But still couldn't set webview's default font to my font. This is what I tried: Typeface font = Typeface.createFromAsset(g...

Android SQLite database shared between activities

What is the best way for sharing one SQLite DB between several activities? Tables from DB are shown in ListView, and also deleting/inserting records is to be performed. I heard smth about Services, but did not found example for my problem. Now I have SQLiteOpenHelper class for opening DB. I close db in OnPause() and open it in onResume()...

Seperate event listener for every textview in android

I want to add separate event listener to dynamically created list of textview. The code so far is like this: while (cur.moveToNext()){ TextView tv = new TextView(this); temp = cur.getString(cur.getColumnIndexOrThrow("_ID")); result = "some text"; tv.setText(result); tv.setOnClickListener(new View.OnClickListener() { ...

Getting packages from PackageManager

I'm writing an app, that has a somewhat modular system. It has a core app, and some apps, that consist of a single Service, that implements the desired interface. I followed the guide to create the IPC communication. But now I need to get all the services, installed on the system, that my core app can wotk with. How do I do this? I mean,...

Live wallpaper that can set wallpaper to itself?

Some phones seem to not have livewallpaperpicker.apk. Is there an API I can call from inside the app to set the live wallpaper to itself ? ...

How do I implement multiple views that react to onTouch?

Let's say I have MyActivity and inside my onCreate method I initialize MyBackgroundView, then MyPlayer1View then MyPlayer2View. I want to be able to touch the screen, figure out if I have touched Player1 or Player2 and then respond with changes to the players if I have touched them. My problem is, where do I put the onTouchListener? ...