Android :: Retrieving XML / Stream From HTTP (Parsing XML)
May 4, 2010
What are the best practices parsing XML from an HTTP resource in Android? I've been using HttpURLConnection to retrieve an InputStream, wrapping it with a BufferedInputStream, and then using SAX to parse the buffered stream. For the most part it works, though I do receive error reports of SocketTimeoutException: The operation timed out or general parsing error. I believe it's due to the InputStream. Would using HttpClient instead of HttpURLConnection help? If yes, why? Should the stream be output to a file, having the file parsed instead of the stream?
View 1 Replies
Jan 23, 2010
I am making an application that asks the user for userid, appends the userid to a static HTTP link to retrieve the user's daily schedule info file that has a .ical (calendar) extension. I need to read the data from file, format in new UI and representing some useful data on an Android device. My query is can I access a static HTTP link behind the scenes? And when I use the same link on desktop browser, it asks user to save the file — how can I do this on a mobile? Do I need to read the data and save it somewhere or I can save the .ical file and read from it?
View 2 Replies
View Related
Sep 17, 2010
I have an input stream which is being converted to XML, and read. When I get down to some text elements in the XML, they are truncated. I believe the parser is dropping everything after escaped HTML such as & Here is the code getting the input stream and then getting the text element. Code...
View 2 Replies
View Related
Jul 23, 2009
I'm downloading text data from a web server, and getting an Input Stream. The data will be relatively large and delimited. I want to split this data by the deliminator and store each piece in the DB. Is it faster to read the Input Stream byte by byte to split the data and store each piece in the DB, or would it be faster to convert the Input Stream to a String and use an existing function such as Split?
View 2 Replies
View Related
Jan 9, 2010
I am getting the input of a web page using Input Stream in = httpConnection.getInputStream(); I then use the XmlPullParser to check if an error has occurred. If no error has occurred, I then want to reset the Input Stream back to the beginning so that I can parse it through another function I have created. I tried in.reset(); but this does not work. Is this possible?
View 4 Replies
View Related
Nov 16, 2010
I am trying to build a music app on a android device with GStreamer ported on it. But when I try mp3 url streaming on http, it failed to handle stream (however, it works perfectly fine on Android devices with base Media Framework, OPENCore). So I wanted to know whether GStreamer supports http url streaming, or is there any other way of doing it.
View 1 Replies
View Related
Jan 29, 2009
I've been using androids MediaPlayer to stream from an http url and have a question about seeking. Currently, our urls expire after they have been used once or a certain time out has expired to dissuade scraping content. Now, this obviously makes progressive streaming past the buffer impossible with the exact same url as you need to open a new http connection with the same mangled key, which we intentionally don't allow.
However, MediaPlayer seems to do this when seeking before the current position (i.e. seeking from 1:00 in the audio to 0:30). As the file has already been downloaded up to the current position I'm confused as to why MediaPlayer is still trying to initate a new http connection in this case? The only thing I can think of is that MediaPlayer is getting rid of audio its already played up to the current position, and hence needs to restart the connection if you try to seek back on the stream. Is this correct, or is there something else going on?
View 2 Replies
View Related
Oct 27, 2010
I am trying to stream mp3 stream from my local http server indeed hosted on my phone to android media player.When local server gets the new socket , it starts writing some http headers followed by mp3 stream. but mediaplayer socket is throwing "Broken pipe" exception.Wat may be the issue causing this.
View 1 Replies
View Related
Sep 1, 2010
How would I go about collecting the latest Live NFL/Soccer scores? Are there open API's available for this?
View 1 Replies
View Related
May 22, 2010
I am trying to retrieve the 2nd value from a Arraylist/ArrayAdapter that I have populated. I am new to Array so please correct me if I am wrong
Q1. I created the Array Favorite. What I think what I created is an Array with two set of value call Detail | Value. example Detail="Yasmin",Value="8". Is this correct?
Q2. I have assign the Favorite Array to the mFavlist listview. During the OnItemClick I can return the label "Yasmin" by the position of the listview. What I would like to do is return the value of "8". What would be the best way to do this?
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;...................
View 1 Replies
View Related
Jul 10, 2009
I created the following method for retrieving stored settings from the database:
public String getEntry(long rowIndex){
String value = "";
Cursor c = db.query(DATABASE_TABLE, new String[] {KEY_NAME, VALUE}, KEY_NAME + "=" + rowIndex, null, null, null, null);
int columnIndex = c.getColumnIndex(VALUE);
int rowsCount = c.getCount();
if(rowsCount > 0){
String value = c.getString(columnIndex);
}
return value;
}
On debugging I can see cursor c contains two columns and one row but when it comes to line
String value = c.getString(columnIndex);
it throws the CursorIndexOutOfBoundsException although columnIndex = 1 which should point to a valid entry. Does anyone know what could be wrong here?
View 3 Replies
View Related
Mar 23, 2010
I have a settings menu that pops up and in it is a listpreference type menu. It is associated with a settings.xml file where there are 'array-strings' within it. It all works good but I don't know how to retrieve the users preference. As an example, let's say the user picks a color (red, green, or blue). The list that I've made within my 'array-strings' contain the text red, green, and blue. Within my code, I would like to do something if the user has choosen red, something else if they choose blue, etc., etc. Would I use a 'case' statement or an 'if' statement? And most importantly, how would I retrieve the users preference - the key? (am I checking for a boolean?)
View 2 Replies
View Related
Jul 30, 2010
I am trying to retrieve a XML document from web service. I am passing a soap object with a token implementing the OAuth concept and retrieving the data. But the data does not turn out to be in XML format. It contains a curly braces in the place of start tag and semicolons when it ends. Is there any way to retrieve the document in XML format as such?
View 17 Replies
View Related
Feb 18, 2010
For changing from portrait to landscape mode i have done some changes in manifest.xml and included some code in test.java file
In manifest.xml i have included <activity_name android:configChanges="orientation"/>
i entered some data in portrait mode. but when i rotate my mobile from portrait to landscape the control goes to onConfigurationChanged() method.
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); setContentView(R.layout.screen1_landscape);
}
View 3 Replies
View Related
May 17, 2009
I want to call a USSD (http://en.wikipedia.org/wiki/USSD) command and have the reply returned as a String. I can make the device automatically dial the USSD - like so
// String encodedHash = Uri.encode("#"); String ussd = "*" + encodedHash + "105" + encodedHash; startActivityForResult(new Intent("android.intent.action.CALL", Uri.parse("tel:" + ussd)), 1); //
This calls the USSD and the result is displayed in an alert menu generated by the OS dialer. There's no way that I can see to intercept the USSD reply, prevent the dialer displaying it, and then use the result as a String. Essentially, all I really want to do is (pseudo code) // String ussdReply = call("*#105#"); // I've tried creating an "onActivityResult" but it never receives anything from the startActivityForResult. So, does anyone know how I can use the reply within an application?
View 3 Replies
View Related
Apr 30, 2010
I have an AppWidget which provides a summary of some data stored and controlled by my main Application. (In a similar way to a Calendar AppWidget showing the next event from the main Calendar application). I want to know the best practice for retrieving the data to update my widget. I have followed the example, and I have extended AppWidgetProvider and have a working widget, onto which I can update. I would expect to read the data from my main application and then update it via my AppWidgetProvider's onUpdate() routine.
Now, is the best practice here for my separate main application to provide the data via a ContentProvider? I assume so, as my Appwidget is not part of the same application. Is it possible to access a ContentProvider inside my onUpdate() routine? Before writing my main application content provider I started to test out retrieving some available data like Contacts information, and showing say a contact name in my widget, to show I can extract data from an existing ContentProvider. When accessing the Contacts contentprovider, the examples talk about:
1) Activity.managedQuery(), but my AppWidget is not an activity. 2) ContentResolver.query(), but I can't work out how to get a valid ContentResolver so I can access the Contacts. getContentResolver() does not appear to be defined for AppWidgetProviders. Am I approaching this the correct way?
View 3 Replies
View Related
Jun 6, 2010
I'm kinda new to android programming so please bear with me. I'm having some problems with retrieving records from the db. Basically, all I want to do is to store latitudes and longitudes which GPS positioning functions outputs and display them in a list using ListActivity on different tab later on. This is how the code for my DBAdapter helper class looks like:
public class DBAdapter
{
public static final String KEY_ROWID = "_id";
public static final String KEY_LATITUDE = "latitude";
public static final String KEY_LONGITUDE = "longitude";
private static final String TAG = "DBAdapter";....................
View 4 Replies
View Related
Nov 28, 2009
I just bought the app Avanced Task Killer for my moto cliq, great app by the way. But I'm going to return and exchange the phone for a new cliq or a mytouch because of some touchscreen issues. I was just wondering if I get a new phone will I be able to retrieve my purchased apps even if I change my phone to a mytouch?
View 3 Replies
View Related
Sep 10, 2010
Retrieving data from the webserver using json
View 2 Replies
View Related
Feb 1, 2009
I'm using a mediaplayer to play a sound file, when you leave the application the sound continues in the background, which is the desired behaviour.
However, when the app is resumed, the mediaplayer isn't retrieved, so hitting pause just starts a new player so now there are two sounds playing.
Is the mediaplayer a type of service? How can I access the original player again?
View 3 Replies
View Related
Nov 16, 2009
I am facing some not understandable error. Could anybody help to put light on it.... The variable edtTxt is returning null and encoutering nullpointer exception while I am trying to run and entered text in the txt_edit field.
Here is the code....................
View 2 Replies
View Related
Mar 11, 2010
How can I retrieve the last image in the SDcard.
View 1 Replies
View Related
Apr 30, 2010
I want to retrieve the data from the url(http://www.sumasoftware.com/ alerts/GetAlerts.php) and parse the data. The data should be inserted to a list view showing alert text and the corresponding date. I have done this using a text view. But cant figure out how to display using list view... Plz help me out. I'll be grateful if anyone could provide some sample code too...
View 12 Replies
View Related
Nov 2, 2010
I am trying to use OData4J to retrieve a list of Users from the StackOverflow OData service (onto an Android 2.1 device), but it isn't working.
public static Enumerable<OEntity> getUserInfo() {
ODataConsumer c = ODataConsumer.create("https://odata.sqlazurelabs.com/OData.svc/v0.1/rp1uiewita/StackOverflow/");
return c.getEntities("Users").execute();
I think it is unable to retrieve data from the URL. Any ideas why this would be? Is there anything wrong with my code?
View 1 Replies
View Related
Jun 18, 2009
I created a database with records in it and everything. I am trying to use its fields and put it in a spinner. The database contains university names.
I created a spinner with:
CODE:............
where I am feeding the spinner the records from an array. I want to do it from the database that I created. I read thru the classes and there are 2 ways but I can't find a proper code to use any of them. I just want to insert the code to get records from the database. It shouldn't be complicated is it?
View 13 Replies
View Related
Nov 21, 2009
I'm having trouble retrieving image references from my database and then setting them to an ImageView. When I pass R.drawable.icon into my database its compiled and stored as an Integer. how would I then pull this Integer out and use ImageView.setImageDrawable(); ?
View 3 Replies
View Related
Oct 5, 2010
I realise one has to use an intent filter to associate a file format with an application, but once this is done how does the app 'receive' the path to the file that was chosen? Is there a special method it calls on the Activity?
View 2 Replies
View Related
Jun 9, 2010
I am using following webservices for retrieving data from server
server side:.net
client side:ksoap2
whenever activity start, onCreate i am using spinner for displying data returned by the webservices
when this activity start it showing black screen after lunching the activity .i found black screen is coming when activity connecting to webservices
How to resolve this?
MyCode...
View 1 Replies
View Related
Aug 15, 2009
I am having trouble passing a List type from a remote service to the UI activity. Here is a modified version of RemoteService example from the APIDemo. (only included where its modified)
PROBLEM: The call back function (for List) is called successfully, but the List returned is empty...
It works fine when the service does not run in a remote process. (w/o android:process=":remote" in the manifest file)
Why is this happening...?
Also, when I tried Map type, it didn't even successfully generate a IRemoteServiceCallback.java file.... it tries to do new Map().... and complains that its an abstract class.. (FYI, List instantiates by new ArrayList())
1. in IRemoteServiceCallback.java oneway interface IRemoteServiceCallback { /*** Called when the service has a new value for you. */void valueChanged(int value); void valueChangedList(out List values); void valueString(String value);}
View 2 Replies
View Related
Nov 4, 2009
I want store an image using a SQLite database in Android (using an insert statement).Also I need to retrieve the image from the SQLite database and display it on the screen.
View 1 Replies
View Related