android-2.3-gingerbread

httpurlconnection is very slow on Android 4.2

删除回忆录丶 提交于 2019-12-03 06:58:14
I can succesfully connect, send and receive data by using httpurlconnection. But it takes very long time to load all the data on my phone (Samsung s4, 4.2) and on android 4.2 emulator. But it takes almost 1-2 seconds (which is very fast) to load pics on Android 2.3.x emulator. Faster than my galaxy s4 on http connection. I'm using AsyncTask and my code works fine on both. It is just slow on android 4.2s. I tried removing chunkedStreaming, keep alive, changing timeout values etc. but still no success Here is my code HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();

Playing audio wav file in Android natively using AudioTrack and C++

寵の児 提交于 2019-12-02 21:17:57
问题 I want to play an audio file in .wav format using AudioTrack and C++. I have searched for it a lot but I couldn't find any relevant tutorial. The only I could find, were all using Java/JNI layer. I want to do it at the native level in C++. Something like : file = path_to_file play(file) Please point me to some good tutorial if you are aware of or please provide me some code snippets to get the idea. 回答1: Your Native Code (NativeCode.cpp) should look like below: *Include required header files

How do I use the command: HttpEntity?

╄→гoц情女王★ 提交于 2019-12-02 09:31:26
I wish to settle my long term problem by this question and hope you guys would help, but firstly; I have been having issues to connect to a HTTPS self-signed certificate server for almost 3 weeks. Despite the multiple solutions here, I cannot seem to resolve my problem. Probably I did not know how to use it properly or did not have some files or imported the correct libraries. I came across some websites that requires me to download a certificate from the https site that I am trying to connect into, and when I did that. I have to do the some steps before I can use the certificate or keystore

Playing audio wav file in Android natively using AudioTrack and C++

寵の児 提交于 2019-12-02 08:27:19
I want to play an audio file in .wav format using AudioTrack and C++. I have searched for it a lot but I couldn't find any relevant tutorial. The only I could find, were all using Java/JNI layer. I want to do it at the native level in C++. Something like : file = path_to_file play(file) Please point me to some good tutorial if you are aware of or please provide me some code snippets to get the idea. Your Native Code (NativeCode.cpp) should look like below: *Include required header files and libs. JavaVM *gJavaVM = NULL; static jobject gCallbackObject = NULL; jmethodID audio_dataCb_methodid = 0

Android and JFileChooser

╄→гoц情女王★ 提交于 2019-12-01 22:15:05
I've developed a desktop application that allows the user to extract images from their phone. When I first started this project, my android was running Gingerbread. When I plugged my phone into the laptop via USB, it would appear as a "Device with removable storage". Therefore, the JFileChooser would pick it up. nwdir = new JFileChooser(); nwdir.setCurrentDirectory(new java.io.File("C:\\")); nwdir.setDialogTitle(choosertitle); nwdir.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); nwdir.setAcceptAllFileFilterUsed(true); However, I recently upgraded the phone's o/s to Icecream and it now

Android ParcelFileDescriptor.createPipe() for Froyo?

落花浮王杯 提交于 2019-12-01 19:58:21
I have a need to use ParcelFileDescriptor.createPipe() , but I would still like to target API 8/Froyo. This function requires API 9/Gingerbread. I have read that there are compatibility kits that allow newer API functions to be used on the older OS versions, but know nothing about them. Is that an option here? If not, what would be the cleanest method for going about duplicating this functionality? I have considered using fromSocket() and making a simple network connection over the loopback interface, but that seems like more overhead than is needed, if there were a simpler way. Any thoughts

How can I change the background color of a spinner popup?

隐身守侯 提交于 2019-12-01 15:23:55
I'm trying to set the background color of a spinner popup but everything I've tried didn't work properly. This is the spinner control: <Spinner android:id="@+id/myspinner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@null" android:drawSelectorOnTop="true" /> When I click on it, it shows a popup with a white background, and I want to change that. The xml line wich I use to populate the popup is: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"

setItemChecked not working on Gingerbread

浪尽此生 提交于 2019-12-01 14:25:52
I am using the following selector to change the appearance of text in a listView item: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:color="#FFFFFFFF" /> <!-- checked --> <item android:state_activated="true" android:color="#FFFFFFFF" /> <!-- activated --> <item android:state_pressed="true" android:color="#FFFFFFFF" /> <!-- pressed --> <item android:state_focused="true" android:color="#FFFFFFFF" /> <!-- focused --> <item android:color="#FF000000" /> <!-- default --> </selector> The entire selector works fine on later versions of

installation failed since the device possibly has stale dexed jars that don't match the current version (dexopt error)

╄→尐↘猪︶ㄣ 提交于 2019-12-01 13:45:56
问题 I am unable to run app from android studio to my samsumg phone running android 2.3.6. I am getting Application installation Failed popup refer below screenshot. when I click on OK I get below error in log Failure [INSTALL_FAILED_DEXOPT] DEVICE SHELL COMMAND: pm uninstall my.package.name Unknown failure I got in this trouble after adding Google Cloud Module called "App Engine Backend with Google Cloud Messaging". This is exactly same problem described in one of stack overflow questions here I

Changing value of R.String Programmatically

余生长醉 提交于 2019-12-01 04:32:57
Can you change the values of a R.string programmatically in an android program? I need to pull some API information (for example battery state, battery percentage, android os version) and would like to save it a R.string value. I know how to read it: String helloValue= getResources().getString(R.string.hello); I've also looked at: Change value of R.string programically? but it seems that only involves changing language and he ended up doing it a different way. Can anyone lend a hand please? I've also looked here: http://developer.android.com/guide/topics/resources/string-resource.html and