Android :: Why To Setup Boundary String In HttpURLConnection?
Nov 19, 2010Why we have to setup a boundary string?What is the purpose for? any rules on it?
View 1 RepliesWhy we have to setup a boundary string?What is the purpose for? any rules on it?
View 1 RepliesI used the layout resource editor to modify the main.xml layout file to add a second
TextView control to my app. by default, its set to something like @+id/TextView01. How do I Set the text attribute of the TextView control to my newly created String resource? I tried going into main.xml and just editing the android:text to point to the name of my new string, but it didn't seem to work.
I'm using Android's android.graphics.Canvas class to draw a ring. My onDraw method clips the canvas to make a hole for the inner circle, and then draws the full outer circle over the hole:
clip = new Path();
clip.addRect(outerCircle, Path.Direction.CW);
clip.addOval(innerCircle, Path.Direction.CCW);
canvas.save();
canvas.clipPath(clip);
canvas.drawOval(outerCircle, lightGrey);
canvas.restore();
The result is a ring with a pretty, anti-aliased outer edge and a jagged, ugly inner edge:What can I do to antialias the inner edge?I don't want to cheat by drawing a grey circle in the middle because the dialog is slightly transparent. (This transparency isn't as subtle on on other backgrounds.)
How can I get Pixel color of a coordinate? There is no method like canvas.getColor(x,y).
Actually, I am new to game developement. I am developing a Game which will restrict object if it comes to that boundary like in pac-man. How can I check that object has reached upto the boundary?
I am beating my head against a wall trying to figure out why I cannot get Authenticated on my server whilst using HttpUrlConnection. I need to post a file in a post method and it seems I cannot do so with the DefaultHttpClient and a regular HttpPost (unless I am completely missing something?). I can get DefaultHttpClient to authenticate just fine using setCredentials() but the same doesn't exist for HttpUrlConnection so I try to set through setRequestProperty: conn.setRequestProperty("Authorization", "Basic " + Base64EncodedUserNamePassword); to no avail.
View 6 Replies View RelatedI've got an application which is making a web request every 10s using HttpURLConnection. When the application starts in 3G, it works great. Then I activate Wifi and after that, all my requests fail during exactly 10 minutes with the fallowing exception : Socket is not connected. The behavior is the same if I start in Wifi and then I switch to 3G. What's the problem here ? Do we need to setup something at socket level ? a timeout (10 minutes is the default one) ?
View 3 Replies View RelatedThe method disconnect from HttpURLConnection seems not to work properly. If I execute the following code...
View 2 Replies View RelatedThis is an issue that has kept me from doing real work for *a while* now:
The Task: Read an image from the net (PNG approx. 10kb) and writeit to the user dir as is.
I'm using a byte array to temporarely store the data, basically like this:
CODE:..............
The Problem: it works - sometimes. Actually it always works in the emulator, and it usually works when attaching the debugger to the phone and stepping through the code. Interestingly it almost always produces corrupt images when running in 'normal mode' - read on the Dev1 via UMTS.
Corrupt images are good at the start of the image, and somewhere in the middle or to the end, they produce pixel trash. They can't be decoded to a Bitmap or alike as well.
I'm almost sure it's a HttpURLConnection issue, or at least related to it.
BTW. the download happens in it's own object instance, but about 10 are triggered in a loop after each other.
I am using HttpURLConnection to send a GET request to a server. Upon reading the response code, the Android implementation of HttpURLConnection.doRequestInternal() throws an exception:
"java.io.IOException: Received authentication challenge is null"
I don't even get what the error is trying to tell me. I write an OAuth param string to the Authorization header, but this works fine on other occasions. There is nothing peculiar about my request apart from that.
Any idea what this means, what is causing this and how to get around it? This works fine with Sun's Java implementation, so I guess it's a problem with Apache Harmony?
I have a server that uses User Agent header to identify the device that is connecting to it. But when i connect to the server using HttpURLConnection i get no User Agent header, but when i connect with the browser it sends the correct User Agent.
For testing i am using an echo server that replies with the headers it found on the request.
When i connect with browser i get: eg: User-Agent: Mozilla/5.0 (Linux; U; Android 1.5; en-fr; HTC Hero Build/CUPCAKE) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1 Up.Link/6.3.1.20.06.3.1.20.0.
But when i connect by code with UrlConnection i get: User-Agent: UNAVAILABLE.
Does anyone know we i get different behaviors? How i can i connect in the same way the browser does?
What i really need is not only the User-Agent header, i also need some special headers (x-up-subno actually). This header is added by the APN of the operator, but for some reason when i connect by code that headers are not added to the request.
From browser:
From code:
I have the localized strings file that is used in the Iphone app that I work on to port to Android. Are there any tools that go through the file taken from the xcode project and build the xml needed to use the strings in android? This tool should be easy to build but I appreciate any pointers to already working tools.
View 4 Replies View RelatedIn Android, capturing date from datepicker and storing as string in sqlite. Sorting by date doesn't work because they're strings (unless I'm doing it wrong.I've googled this issue for ~5 days, and it looks like there should be a way to capture the date from the date picker, convert it to a Long, store it in sqlite as a Long, select and sort on the Long date value, then convert the Long back to a "mm/dd/yyyy" string for display. I've tried various combinations of parse statements, Date, FormatDate, etc. with no luck at all.On activity start, get today's date and display it in button which calls the datepicker.Capture new date from datepicker (if one is entered), save it as a long to sqlite.On opening an activity showing a listview of records, select from sqlite with orderby on date (Long), convert Long to "mm/dd/yyyy" string for display in ListView.
View 3 Replies View RelatedIf there's anyway way I to access the String values of String resources statically? e.g. a static equivalent of Context.getString(...)?
View 5 Replies View RelatedI have preferences where you can enable/disable what items will show up on the menu. There are 17 items. I made a string array in values/arrays.xml with titles for each of these 17 items.
I have preferences.xml which has the layout for my preferences file, and I would like to reference a single item from the string array to use as the title.
In the Android developer reference, I see how I can reference a single string with XML, but now how I can reference a string from an array resource in XML.
Can anybody give me some clue that how to convert binary string into a string(english). I have tried and googled so much but couldn't find an answer.
View 1 Replies View RelatedI have a class that creates a view to gather data via a function getView() that provides a view with an EditText.This class has also has variable answer.When the user chances the EditText I want to store the content of the EditText in answer.If I would use an onKeyListener I fear that the answer will probably get stored before the last letter is entered.Is there a good way to handle this in the getView() function via some other listener?
View 1 Replies View RelatedI have made a service which extends Service in android, and running in the background of my android app. What I want from this background service is to get the euro to dollar exchange rate from a finance website, I have my service ready, it can periodically run a function, I am now need to implement the function to get the euro-dollar rate from a website, there are many this kind of website, my question is, how can I get the currency rate as a string from the website, and pass the string to my service?
View 2 Replies View RelatedI have an Android app where I want to check to see if an app name that is installed matches a string passed to the function containing this code.Assuming you called checkInstalledApp('SetCPU'); and the app name on the phone is called the same thing it should return true. However, it never does. I logged the results and it should match up but it does not. Can anyone please enlighten me as to why this doesn't work?
View 3 Replies View RelatedDoes anyone have any idea how to find the n-th field (string) in a delimited string where the delimiters (separator) could be either a single char or several chars.and the syntax for user-defined function is FindNthField(string,separator,position)so position 3 would return three,The separator in use would actually be Chr(13).This has to run on Android and so should be efficient.
View 3 Replies View RelatedI want to get an array of strings reading from arrays.xml file we add in android values/ folder. Could any one kindly give a solution for this. Otherwise I will have to input each these entries in strings.xml and take them to java code using getResources()getString()
View 2 Replies View RelatedIs it possible to have a string value in string.xml of the sort " some string PLACEHOLDER1 some more string" so that the place holders can be assigned the value at run time.
View 1 Replies View Related"Basic YWRtaW46YW RtaW4=" is right code for my address.I check on j2me project.
And on android my getbase64 method returns "Basic YWRtaW46YW
RtaW4=" its true.
And ı use it on:
httpConnection.setRequestProperty("Authorization",getBase64Encode());
Finally responce code is 401
code:..............
I have installed Power Strip, and the very first time I was asked to use my preferred home screen, I selected the existing one (using a GS).
What I want to do is to have Power String dock displayed if I do a double click on the home key. I played with the settings but it seems that it doesn't work. Any hint?
My Gmail account works great, and I have my aol and yahoo acounts set up no problem (well the yahoo was a little problem but got it to work so thats all that matters). I have 2 other email accounts that no matter what I do I can not get them to work. One is my works email which is handled by a company called network solutions. I can get the incoming server setup fine but I can not get the outgoing to work. The other is my school email which is some sort of msn email account variation (username@email.itt-tech.edu which i log into through msn.com). I cant get anything to work for this accuont.
View 3 Replies View RelatedI just want to read <string-array> resource elements into a String array. I don't want to make a view or anything and mess with adapters - just want to transfer the elements. Is there a built in class for this? Or do I need to treat the resource file as a regular file?
View 3 Replies View RelatedI was able to successfully setup a POP account through the Setup Screen...in fact when I go back through Setup, I still see the account. The problem is I can't DO anything with it in setup (including deleting it to start over) and it doesn't show up in my Apps window with an icon! I see it on the setup screen labeled "Setup Accounts" but no matter if I tap it or hold it or swipe it or try to hit the menu key, it just sits there. There is a green button with the checkmark in it. I guess what I would think i ought to be able to do is to assign it an icon (or even get a generic one) and find the account listed on my app screen...I'm willing to reset it, but I can't even delete it to start!
View 2 Replies View RelatedI am coding an Android client that talks to some web services via XML packets.
A typical packet looks like this..
<Packet service="login">
<username></username>
<password></password>
</Packet>
I have about 20 of these packets and would like to store them in my resources maybe in res/xml or res/raw
I want to store these 'empty' packets and load them using XML DOM and then fill in the content between the tags or attributes but am unsure how to do this.
Once the DOM packet has been filled in I want to get that back as a String so that I can send the packet to the server.
So to summarize my questions are..
(1) How do I load an XML resource using DOM?
(2) How do I convert the DOM object to a String?
I have defined a string array in the resource and access it using:
String arrStrings[] = getResources().getStringArray(R.array.arrayname);
But, how can I get the size of this array?
Maybe I missed something but I can't locate a way to get a String[] array of keys from a ContentValues object?
View 2 Replies View RelatedHere is my code,it seems to return false all the time.
CODE:....................