This has happened to me several times in slightly different cases. Several times I've mistakenly placed calls to the wrong people (due to just messing around with the phone).
In a panic, I pressed the "back" button thinking that it will cancel the call. It didn't. I also tried the "home" button. Also no good.
I had to drag down the notifications bar to see the phone call in progress and finally access the red Hang Up button. That worked. The problem is that is is SLOW. And worse, one time the phone would not respond to the button press until after several tries (maybe the CPU was busy on something).
Anycase, that would appear to be a major problem with all these touchscreen-only smartphones - lack of a physical Hangup button.
Is there any workarounds to this? Perhaps some sequence or combo of the existing physical buttons to forcefully hangup an errant call?
I'm new in Java/Android programming, so please have patience with me.
I try to play a mp3 which is locate und the assets folder. I know there is another way with the /res/raw/ folder, but use the assets-folder because later I'll try to access the file by String.
This code works to play a mp3-file:
Now the problem: In the same assets-folder is another mp3 file stored. Though I specify the name of the mp3 to use it take the one which comes first in alphabet. E.g. the other file is named "music.mp3" it plays this one. Renaming it to "worldmusic.mp3" it will play "song.mp3". Rerename "worldmusic.mp3" back to "music.mp3" it will take this mp3 again. Another test: Renaming "song.mp3" to something other so the application can find whats specify by the code above will result that no song is played. So this means the songname have to exist, although it take arbitrary the song first in alphabet.
I'm testing with the AVD emulator of eclipse. But I think the behaviour would be the same on a real device.
I don't see anything about this change in the API differences report at http://developer.android.com/sdk/api_diff/8/changes.html. However when my Nexus One started running Android 2.2, the list of files created by the following code are now in reverse alphabetical order rather than alphabetical order (as they were with Android 2.1 and earlier, AFAIK):
The line "Arrays.sort(fn);" revives the alphabetical order of the list, but sorts are computationally expensive and AFAIK the explicit call to Arrays.sort() was unnecessary prior to Android 2.2.
In addition to seeing this order change on the Nexus One, it can be confirmed on the emulator running level 7 and level 8 AVDs.
Old phone messed up trying to switch contacts to new Android phone. Old phone is unfortunately not usable. I backed up contacts on old phone and have them in a .pbf (not .pdf) stored on my PC, but I can't open the file to read it. How do I open up a .pbf file? I've searched and can't find a program to open it.
What do I do to be able to read all lines from a file? With this code I have below I can only get the first line of the text file when I use mReadString later on. Am I doing something wrong? Or is there another way? code...
I am creating an application for the android, and would like it to be able to read a text file via anonymous FTP. I've tried URLConnection, but it doesn't seam to be working. After some Google searching it appears that URLConnection doesn't always work with some FTP servers. All of the java FTP connection libraries I've found require you to download the file to a local location before reading it. However I would like to have the same functionality as URLConnection in that I can just use the following similar code...
I am trying to read a file "words.txt" from a resource. It is a very simple, but large (2 MB), text file that I want to read line by line. I have put the file into /res/raw/words.txt, and try to open it with the following code:
However, I get a java.io.IOException. This is not a "resource not found" exception, so the resource is opened correctly, but the readLine() produces the error.
I tried using the InputStream itself, with the result that read() produces -1, which stands for EOF, as if the file was empty.
I have a text file added as a raw resource. The text file contains text like:
a) IF APPLICABLE LAW REQUIRES ANY WARRANTIES WITH RESPECT TO THE SOFTWARE, ALL SUCH WARRANTIES ARE LIMITED IN DURATION TO NINETY (90) DAYS FROM THE DATE OF DELIVERY.
b) NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY VIRTUAL ORIENTEERING, ITS DEALERS, DISTRIBUTORS, AGENTS OR EMPLOYEES SHALL CREATE A WARRANTY OR IN ANY WAY INCREASE THE SCOPE OF ANY WARRANTY PROVIDED HEREIN.
c) (USA only) SOME STATES DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY NOT APPLY TO YOU. THIS WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS AND YOU MAY ALSO HAVE OTHER LEGAL RIGHTS THAT VARY FROM STATE TO STATE.
On my screen I have a layout like this:
The code to read the raw resource is:
The text get's showed but after each line I get a strange character  How can I remove that character ? I think it's New Line.
I have a file that contains about 200,000 long values that I want to read as fast as possible into a long. It's for an Android app; function calls are slow (so anything involving reading a long at a time with a "for" loop will be super slow) and I need loading to be fast. What can I use? Everything I look at seems to read only bytes fast.
I've used ByteBuffer and FileChannel from the NIO package before and this seems a really fast way to load arrays of values from files. However, I cannot work out how to use this to read data into a long. I've tried wrapping a long as a LongBuffer, but I cannot see any way I can feed data from a file into a LongBuffer.
Edit: Whatever method I use, I need to be able to use Arrays.binarySearch on the long array at the end.
I downloaded a .jad file and then used a website to turn it into an .apk file. It's an ebook. I put the file in my downloads folder I think but I don't know how to get to that folder on my phone. How do I find this file on my phone and read the book?