android

Android checkbox ui change

How can I have a checkbox in my ui alter my ui live? For example, if the box is unchecked I want a spinner to be displayed, and if the box is checked I want a text box to be displayed in place of the spinner. I know how to create the checkbox and check its status but I don't know how to hide and reveal other elements in an activity. ...

How to pass aditional info to Custom Preference?

Hi, I have a custom preference object which I would like to pass info to from the Preference XML however I cannot seem to find the way to get that info in my class. Am I missing something simple or is there no way to do so? ...

Android: Handling events in menu

I am trying to implement smth like context menu but with icons public class MenuItem { private int type; private String nameItem; private int imageResource; } menu.xml // ImageView ant TextView public final class MenuItemProvider { //create our menu items } public class MenuListAdapter extends ArrayAdapter<MenuItem...

How can one inject the sqlite3 keyword DISTINCT into an Android ContentProvider's query?

I have a SQL statement that I can use to return distinct rows from my Android sqlite3 database and I would like to pass it through the ContentProvider's query. For example: select lastName from peopleTable where upper(lastName) like upper("%smith%"); needs to be select DISTINCT lastName from peopleTable where upper(lastName) like up...

Advice on structuring a service, activity, thread

Hi, can someone please help me? I would like to write a program which uses a service to periodically update a text view on an activity. I do this by having ActivityA with a 2 buttons to start/stop my service. In the service I run a timer which triggers every second. From here I need to have this launch and update a text view on Activi...

Which is less performance intensive - passing a bundle via an Intent or using a Content Provider

I would like to pass a considerable sized amount of data (~1500 bytes) between two applications in Android where performance and resource allocation is a priority. The data is basically key-value pairs. The rate at which it needs to be passed from one application to another can vary from a trickle to ~50 packets within a second. I figure...

Android Converting objects to XML and vice versa

Hello all, I created a xsd and I created Java objects using Castor. Then I imported this in my Android project and tried to build an XML from the object, using the marshal method. Marshaller.marshal(v, writer); I received some wired exception trouble processing "javax/xml/parsers/DocumentBuilder.class":... So my question is Can I use ...

Android app's map pins not appearing until screen is touched

I am experiencing a problem with my app. The 1st screen that appears is a map that displays pins that are located based on an XML file that is loaded from our server. Sometimes the app loads as expected. Other times, the map loads but none of the pins appear until you touch the screen. Any ideas why this may be happening and what can...

Detect Motion on axis in android

HI, I am willing to implement a logic in which i need to know about the amount of motion made by phone on x y or z axis, using accelerometer i can only find acceleration on these axis, even if i try calculating the relative x coordinate value based on acceleration on x axis, its of no use as i cannot determine the direction of motion (i....

What Java XML parser to extract data from 2000 lines file (on mobile device)

In my Android app I need to extract data from a xml file (the file will have less than 2000 lines). I have no experience with XML parsing, so I don't know what the best approach is. DOM parser is perhaps not a good option, because I am on a mobile device. On the other hand with SAX I would probably end with more complicated code. What wo...

Android Development: How To Automatically Add Linebreaks When Using setText()?

Hello, In my app is the ability to read a file. This works perfectly, but there's a problem. No line breaks or whatever they are called get added when I append the file's contents to my big EditText, so this: function hmm(){ echo 'Hello, PHP!'; } would turn into this: function hmm(){ echo 'Hello, PHP!'; } How can I stop this and m...

Don't overwrite existing Notification

For a given Notification ID is it possible (using standard android packages) not to set a notification if there is an existing notification from the app ? I have a news application notifying users on breaking news headlines, one of the requirement is not to over write a breaking news if the user has not cleared it or has not clicked to ...

Android Key Events for EditText not happening on device

I am new to Android development and having a problem with what SHOULD be a very simple task. I want to receive KeyEvents whenever a user is typing in an EditText field because I want to save their entered values to data structures in the background on each key stroke. I have mimic'd the code in the Beginner's Dev guide at http://develop...

When populating ListView, activity crashes due to missing "layout_width" attribute

I'm trying to populate a list of files, and I'm using a custom ArrayAdapter so that each list item contains multiple Views. The code I use to populate the list is: File home = MEDIA; int numFiles = home.listFiles().length; if(numFiles >0) { ArrayList<FileInfo> fileData = new ArrayList<FileInfo>(numFiles); for (F...

Problem with NeighboringCellInfo, CID and LAC

For a while I was trying to get CellID and LAC of near base stations. Unfortunately I did not manage to do that. First option was to use: GsmCellLocation xXx = new GsmCellLocation(); CID = xXx.getCid(); LAC = xXx.getLac(); Toast output = Toast.makeText(getApplicationContext(), "Base station LAC is "+LAC+"\n" +"B...

Android - Defining Custom Component Layouts in XML

hi all, i'm reading the android developer docs on creating custom components and one thing that's unclear, is whether you can define the layout of your component using xml and then reuse that across class libraries. like, say for instance, i want to create a class library called myComponents, and in there i want to have myTehAwesumsWid...

Android Proximity alert doesn't get fired

Hi, this is my very first question: I'm trying to configure proximity alerts that will be feed from a Database and webservice provider; but I have a problem configuring a simple proximity alert for testing. I manage to create the alert but it never gets fired, I'm only trying in the emulator for now and don´t know if I need some extra c...

onPageFinished in WebViewClient doesn't seem to fire correctly

I have seen one other SO question on this and it was not resolved. I am using LoadData() with application generated html. I noticed when I add a few blank lines after new text the page scrolls and the text takes a moment to magically appear (no scrolling, it just appears as in a fade-in.). Watching .getContentHeight() it does not upda...

Installing GData API in Eclipse

I am trying to work with the Google Docs API in an application for Android. I can find plenty of documentation on the API and how to use it, but I can't seem to figure out how to get the dependencies into Eclipse. I followed the instructions I found here: http://code.google.com/p/gdata-java-client-eclipse-plugin/wiki/Installation and cou...

R.java auto generation problem

I am trying to implement MJAndroid. There R.java is getting generated on its own. I want to delete the auto generated one and either create my own or overwrite the existing one. Its not allowing me to do so. What should I do? ...