android

Java Regex Problem Replacing a String

I am getting an exception when I try to do a replaceAll: Symbols is a valid string. private String buildQuery(){ String query = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(**QUERY**)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&cal...

Questions about Notepad Tutorial

Working through the Notepad tutorial and have a question. When it builds the database with the fields rowid, title, and body - all three are private static final strings. But when a method like fetchnote() runs, it uses a long id to get the note. How does the method get that id if rowid is a string? I would like to modify the tutorial a ...

Java regex replaceAll does not replace string

I want the text "REPLACEME" to be replaced with my StringBuffer symbols. When I print symbols, it is a valid string. When I print my query, it still has the text REPLACEME instead of symbols. Why? private String buildQuery(){ String query = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%...

Android: can't remove vertical gap between images in LinearLayout

I have a simple LinearLayout in Android with two images vertically: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.eataly.android" android:orientation="vertical" android:background="@android:color/white" androi...

Text size within an PreferenceScreen

Hello I have xml file that defines some preference screens like the following example <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:key="root_preferencescreen"> <PreferenceScreen android:key="general_sett" android:title="general settings" /> .... <PreferenceScreen an...

Is using Serializable in Android bad?

Hello, I've been reading a lot of posts and articles extolling the speed of Parcelable over Serializable. I've been using both for a while to pass data between Activities through Intents, and have yet to notice any speed difference when switching between the two. The typical amount of data I have to transfer is 5 to 15 nested objects wi...

How can I add a checkbox to a ListActivity and not lose onListItemClick functionality?

I have a ListActivity working as expected. When a list item is clicked the app responds properly. I want to add a checkbox on the far right side of the screen, next to each list item. When I attempted to do that by updating the XML (see below) I lost the onListItemClick functionality. When I clicked on a list item nothing happened. ...

Activity switching wont keep the state of the view alive even using saveinstancestate() why?

Salam i just started working on android(beginner). Im stuck in the activity state complexity. I created two activitys(activity1 and activity2). wen i move from the activity1 to 2 and then back to activity1 using a button(back of activity)the values(states) of the views are not restored. here is the code.. ACTIVITY1 public class activ...

Problem parsing this YQL JSON in Java/Android

Here is the JSON result: { "query": { "count": "4", "created": "2010-08-31T05:53:39Z", "lang": "en-US", "results": { "quote": [ { "symbol": "AAPL", "Ask": "244.17", "AverageDailyVolume": "23152200", "Bid": "244.12", "AskRealtime": "244.17", "BidR...

Implement change black/light theme feature in Android app

I want to have a "change theme" feature in ma app. If I call setTheme() in onCreate(), there is one problem. The moment after I launch my app, a plain white background appears for a second (because I have set light theme in the manifest). After that, the complete layout of my Activity is displayed - it is either with white or black back...

Programmatically find the IP address of the desktop over USB tethering

Hi, Is there a way to find the IP address of the desktop machine connected the android phone after USB tethering is turned on? Does android assign a fixed IP address to the desktop? Or does it assign a dynamic address (dhcp)? Is there a PPP connection created between the phone and machine? Thanks a lot! ...

Transmitting Data using bluetooth sockets

I have a bluetooth connection with PC(bluesoleil) on COM8. And I want to send "hello" to this port. Can I do it? Becouse when I do this: OutputStream outs; try{ outs = socket.getOutputStream(); byte[] byteArray = ("hello").getBytes(); byteArray[byteArray.length-1]=0; outs.write(byteArray); Log.d("BT"...

Back button not working

Hello, When i start an activity which has android:theme="@android:style/Theme.Dialog" in the AndroidManifest.xml file the back button works as intended, i.e. returns to the activity that started it. However if i remove the theme attribute (which is what i want in the end) then the back button has no effect. Could it have something to do...

Android: How to send back data from thread to service?

Hy! I have a service from which a start a new thread. This new thread will communicate with a TCP server using socket. What is the best way to send the data received from TCP server back to the service? Handlers or something else? Thanks in advance, kukukk ...

Consuming a WCF REST service from Android is very slow

I have a WCF REST service built with C# and it returns an image as part of a CPU intensive operation. The client is running on Android (Java) By default, it will return a text JSON object that looks something like this: {"d",[9,0,77,12,11,...]} Those are they bytes of the image. Fine. However, all the solutions for decoding this JSON...

Notepad example, how does hooking up the notes_row to the notepad_list work

I'm working through the Notepad example, and I'm right at the end of v1. Everything works, I've even added a few small things by playing around with the layout and such. But I just don't understand how R.layout.notepad_list knows to populate itself with the R.layout.notes_row rows. I see how the database cursor is hooked up to populate t...

Code won't work in new Class

Hello!! the code in the main class works perfekt but i need a other thread but there the code won't work public class Alarm implements Runnable { @Override public void run() { MediaPlayer mp = new MediaPlayer().create(this, R.raw.alarm); mp.start(); Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); ...

Android Dialogs: Confirmation for deleting a table row

I have a table that I am trying to dynamically delete rows from. Each row has a delete button, which opens a confirmation dialog. I would like to remove this table row when confirmation gives a positive result. I got this working, rather sloppily, and was wondering if there was a simpler way to accomplish my goal. To clarify things...

Good way to evaluate application performance on Android devices

I am implementing the client side of some java application for Android devices which requires a lot of user interaction, image loadings and JSON object parsing. I'm trying to decide whether to implement it with html5, flash or Android native code. Frame#/sec is crucial for this application. Does anyone have any idea of what other impor...

Android and C++: Necessary?

Just checking out Android development very superficially, and it seems that most everyone is working in Java. Yet Android includes a set of C/C++ libraries used by various components of the Android system. These capabilities are exposed to developers through the Android application framework. does this mean that, in Andro...