Android :: Will Threaded Resource Loading Improve Throughput - Or Just Responsiveness
Oct 13, 2010
Are there any Android phones that are multi-processor (multi-core/ cpu), where application threads execute concurrently on different processors?
There doesn't seem to be any explicit way of doing asynchronous file I/ O or asynchronous resource loading. So, suppose I put BitmapFactory.decodeResource() or Resources.openRawResource() into a separate thread. Will those methods play nice with the other threads, yielding during blocking I/O operations so those other threads can run?
If those methods rely on the thread scheduler to forcibly suspend them, then the separate resource-loading thread isn't going to help me get my application started any faster (although it will help it to be more responsive to user input).
View 5 Replies
Feb 19, 2010
I am using a custom adapter for my ListView as per the efficient adapter sample by Romain Guy. In the getView() method of my adapter I am assigning an ImageView a jpg image stored on SD using the following code...
View 2 Replies
View Related
Sep 5, 2010
I'm trying to find a way to open resources which name is determined at runtime only. Let me explain in more details. I want to have a XML that references a bunch of other XML files in the application apk. for the purpose of explaining lets say the main XML is main.xml and the other XML are file1.xml file2.xml...fileX.xml...
what i want is to read main.xml, extract the name of the xml I want (fileX.xml) for example. and then read fileX.XML. the problem I face is that what I extract form main.xml is a string and I can't find a way to change that to R.raw.nameOfTheFile
View 2 Replies
View Related
Sep 11, 2010
I am loading a bitmap from a resource like so:
Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image);
What I want to do is make some changes to the bitmap before It gets drawn to the main canvas in my draw method (As it would seem wasteful to repeat lots of drawing in my main loop when it isn't going to change). I am making the changes to the bitmap with the following:
Canvas c = new Canvas(mBackground);
c.drawARGB(...); // etc
So naturally I get an exception
java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor
So to avoid that I made a copy of the bitmap so that it is mutable
Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image).copy(Bitmap.Config.ARGB_8888, true);
Which avoid the problem however it sometimes causes OutOfMemoryExceptions, do know any better ways of achieving what I want?
View 2 Replies
View Related
Apr 29, 2010
Currently I'm successfully loading and displaying an image from a webserver using the code below.
URL imgURL = new URL("http://www.xxx.com/myimage.png"); URLConnection conn = aURL.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); bm= BitmapFactory.decodeStream(bis); bis.close(); is.close();
canvas.drawBitmap(bm, 0, 0, null);
What I want to do is load it from a resource. I've put myimage.png into res/drawable and referenced the bitmap as follows :-
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.myimage);
However when I try to display it with canvas.drawBitmap(bm, 0, 0, null); I get a Force Close. What am I missing?
View 2 Replies
View Related
Nov 6, 2010
I want to load resource that is located in android.R.attr class.Next code failed to load resource with Resources$NotFoundException exception:
getResources().getString(android.R.attr.action); //action is a string resource
Also tried to load resource using:
getResources().obtainAttributes(android.R.attr.action)
No exception is thrown, but returned TypedArray array has nothing valuable inside it. At least I couldn't find anything that is connected to actual resource id or resource I'm interested in.So, how to load resources represented by android.R.attr.* ids?
View 1 Replies
View Related
Sep 15, 2010
I use this method couples of occasion to load text file to display as help file. But I don't know why the following code didn't work. It seems to hang and logcat says "OutOfMemoryError"? All I did was break this out as an separate activity.
---xml---
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/helptab"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/helptext"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</ScrollView>
---code---
import java.io.DataInputStream;
import java.io.IOException; import java.io.InputStream;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Help extends Activity {
/** Called when the activity is first created. */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.help);
InputStream iFile = getResources().openRawResource(R.raw.help);
try { TextView helpText = (TextView) findViewById(R.id.helptext);
String strFile = inputStreamToString(iFile);
helpText.setText(strFile);
} catch (Exception e) {
} }
public String inputStreamToString(InputStream is) throws IOException {
StringBuffer sBuffer = new StringBuffer();
DataInputStream dataIO = new DataInputStream(is);
String strLine = "";
while ((strLine = dataIO.readLine()) != "") {
sBuffer.append(strLine + " ");
} dataIO.close();
is.close();
return sBuffer.toString();
}
View 6 Replies
View Related
Jun 24, 2010
I have two questions about sensor listeners
1. from which thread are sensor values updated and should this be synchronized? can sensor's listener callback be a good place to call custom's view onDraw method? as this should be done from different thread. I cant find anything about it. In another words my problem is that I want to listen to sensors change and draw something on view surface but I dont know which thread (the main thread of the application?) is updating sensor's state
2. If I register sensor listener with SENSOR_DELAY_FASTEST my application is not responsive at all! Raw application with TextView only is not reacting to go back or home button! How should I deal with this or am I doing something wrong?
View 4 Replies
View Related
Aug 3, 2010
I have an XML resource file:
<resources> <section>
<category value="1" resourceId="@xml/categoryData1" />
<category value="2" resourceId="@xml/categoryData2" />
<category value="3" resourceId="@xml/categoryData3" />
</section> </resources>
Using XmlPullParser, on the START_TAG, I can use:
int value = parser.getAttributeIntValue(null, "value", 0);
to get values 1, 2, 3...however:
int resourceId = parser.getAttributeIntValue(null, "resourceId", 0);
doesn't work...it just yields the default value 0, or whatever I change the default value (3rd parameter) to be. Does anyone know what I am doing wrong or if this is possible?
View 1 Replies
View Related
Jun 2, 2010
How to implement Multithreading in Android application so as to increase responsiveness of UI. ?
View 3 Replies
View Related
Nov 2, 2009
I am thinking about buying this and just wanted to know from someone who has used this if the screen is very responsive. I know if may not be like the iPhone or the Hero which used "capacitive" screens, but is it responsive enough that you barely have to push down on the screen to select items? Also, would you recommend this over an unlocked HTC Magic?
View 4 Replies
View Related
Jun 8, 2010
Some people over a PPCGeeks are encountering some of the same screen responsiveness issues that Incredible users were seeing (non-responsive touch screen when phone is on non-conductive surfaces). I have experienced this myself when my phone is in the car dock and when it is laying on plastic or fabric. On my phone, it seems to only be on the top half of the screen.
View 1 Replies
View Related
Jun 14, 2010
Just got my HTC Desire and one of the things I'm really struggling with is threaded SMS. I can't find any way to go to regular view in the stock SMS program! That would be an unbelievable omission if it's not possible to use SMS in a normal fashion
It basically means my SMS inbox groups SMS by contact and each conversation has about 20 SMS in threads already and I've only been using it for a few days. I can see that ending up being in the hundreds within a couple of months. It also means you need many more screen taps to view the message you want to find. I can't find a way to view all the messages I've sent either, I have to go through each conversation................
View 8 Replies
View Related
Mar 4, 2010
Is anyone else having issues with the responsiveness of the touchscreen after updating to 2.1? It seems to have lost some accuracy on touch detection and I find myself having to select things twice sometimes before it registers my touch.
View 10 Replies
View Related
Sep 26, 2010
I am requesting information from a web service in my android app. The web service returns a list of items, each item having a base64 image and some info
First method: simply access the web service and get the result. This means freeze of UI until data is downloaded. Not a good solution
Second method: put the data download in a thread, and display a progress bar with a message.
private void StartGettingData()
{
viewInfo = new Runnable(){
public void run() {
getData(); //from the web service.......................
View 1 Replies
View Related
Aug 7, 2010
Eight Issue Camera responsiveness, is there a way to fix this app or will it be glitch until the update and/or even after the update? Is it just my phone or every time I attempt to take a picture it takes quite sometime after I take the picture the actual moment the picture is captured? not to mention the lag between pictures, the lack of burst mode, and another thing that is quite annoying why does the image in the camera gets so DARK when you press the camera button to focus? the image on the screen should represent the actual photo your capturing not some dark version of it one or two seconds after you click/touch the screen to capture the picture.
View 2 Replies
View Related
Dec 30, 2009
Being new to the Eris and smartphones in general, I apologize in advance if I've missed something common-knowledge...
Today I got a 16GB Class 6 SD card in the mail, one to both max out storage and to settle a hunch -- that the class of card (i/o speed) would noticeably affect how the Eris responded. Class 6 cards are about 30 - 50% more cash than Class 2, but triple the rated write speed. Just happened to find one cheap enough to try it out...
Wow. Not only has everything from the pattern unlock screen to the browser become far more responsive, but the stutter for actions in the Sense UI is gone.
Now, for the circumstances... formatted the new card and copied the entire old card's contents onto it w/USB & my desktop. Added another 2GB of music while mounted... still slick. Mind you, tasks themselves don't happen any faster... just the delay between them I'd gotten used to, vanished...
Am I missing something? I'd hate to get anyone's hopes up, if this is just something that only resembles a performance tweak. Either the system or software use SD memory more than I'm aware, or this is all in my head. All I can say for certain is that my Eris is much nicer to use now.
View 49 Replies
View Related
May 4, 2009
I want to display a fancy 'loading' image at my app's startup time.
The problem: my startup code is mostly GUI related, hence needs to run on UI thread.
Is there a way to do both - that is run UI-related code on UI thread while an image is displayed to the user?
View 8 Replies
View Related
Oct 15, 2010
Our Android app does a lot of image decoding. We fetch a lot of images from the internet, local storage caches, etc. Up to now, these images are being decoded on the UI thread (using BitmapFactory.decodeX() methods). It's been causing some timeout crashes because the UI doesn't respond quickly enough to user input.
I could write a little AsyncTask that encapsulates decoding, but I'm not sure that's a good idea. Spawning threads is expensive, and that would be spawning and tearing down a ton of them. So what's the best way to put this on another thread? Do I need to go to the extent of writing a Service? That seems a little heavy-weight. Are there any solutions for this already out there?
View 2 Replies
View Related
May 9, 2009
Its been a while since I've done any coding, I'm new to android, and unfortunately my first job is rather tricky. My program need to display horizontally scrolling text and images, but it need to set the scroll speed quiet finely. Now I've been looing at some examples with TextView and some also use android.widget.Scroller.
Now I'm pretty sure I'll have to write this from scratch, but what i want to know, is there a clear way that i should use in creating the class. I could try expanding on the TextView class and use its methods. Or should I just write a class to treat text and images the same?
View 2 Replies
View Related
May 8, 2013
I have been using HTC Desire S for about 2 yrs now, but since I am not a power user, I just use it as it came. Now considering to root it and was looking more closely at things and I see there are many services running in the background under "Running".
I don't know the inner workings of Android system, so would like to know if more services are running (especially from apps which I don't regularly use) then does it effect battery life and does it make the phone slower ?
For example under Calendar, 4 services are running - AutoSettingService, ImmediateModeService, DashboardService,ConnecttoPcService.
Google Maps has TrafficAppWidgetUpdateService and PrefetcherService ( I rarely use Google maps because I use offline rmaps)
Another thing is I have a prepaid connection without a data plan so I would like to control which apps connect to the net when i switch on 3G - i mean I would prefer if only the app which I want to use the data should use it, while others should not.
And there are some things taking data, which i don't really understand - but since they are related to Android system I am not sure whether to try to restrict them (Android System, HTC Function test, HTC Checkin service, Settings storage, VPN, Status bar, Bluetooth, Google backpp transport, etc, Phone, Dialer Storage, SIM toolkit)
Any general idea about these services - battery and network usage and effect on responsiveness ?
View 1 Replies
View Related
Mar 27, 2010
I have the original T-Mobile G1 and am generally fond of it, actually so fond im on the verge of getting myself the HTC Desire when it hits the stores here. There are however a few things that "bug" me at present.
1: Is it possible to install and use programs directly from the memory card, or does programs still have to be installed to memeory with the newest release of Android OS?
2: Isn't it possible to turn of threaded messsaging and revert to the more classic look?. Either directly through the native client or through a 3rd party text messaging client?
3: And what about saving some of your texts?. Cause you know once in a while you recieve a text thats worth saving, and at present I don't seem to be able to find that option in 'Droid. So is that not supported or does that "just" require 3rd party software.
4: And have they finally fixed the forced google sync?. Where you can ONLY get contacts and stuff to your android device through gmail. Because im honestly a bit concerned with the fact that Google "owns" everything on gmail.
View 8 Replies
View Related
Jan 27, 2010
I have an app making an https post on one thread while performing a file download on another thread. For some odd reason, I am getting a ClientProtocolException saying that "The server failed to respond with a valid HTTP response". The error goes away if everything is run on a separate thread. Oddly if I run the two server requests in serial, the error goes away. It seems there's a bug that happens when two requests are made at the same time.
Important note: The post occurs to a different server than the download so the servers themselves should not be causing the problem. The code is simple. Here's the file download code:.............
View 9 Replies
View Related
Sep 29, 2010
Google has provided the ability to disable (Turn Off) conversation view for the web-based version of Gmail. See Turn off Gmail�s conversation view - Official Gmail Blog for more details. My take is they're only half way there if your an Android user like myself. Has anyone heard if this feature will be making its way to the Gmail app for Android?
View 2 Replies
View Related
Oct 9, 2009
I was using for sometime now OpenGL initialization code from Api demos and it was quite hard to exchange events between View and Renderer. So, I read pieces of documentation from GLES, EGL from jsr239 and finally made the single threaded GL initialization code which is much simpler than in ApiDemos. Here it is:
import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; import javax.microedition.khronos.opengles.GL10;
import android.app.Activity; import android.os.Bundle; import android.os.Handler; import.................
View 2 Replies
View Related
Oct 24, 2009
The threaded SMS in my Hero is sc**ed up. I know the issue is with my network (Vodafone India) as it puts in sh*t a$$ time stamps on all my incoming SMS's. I would like to know if there is any way I can get my incoming SMS's to show up the phone time rather than the incorrect time put in by Vodafone?
View 1 Replies
View Related
May 30, 2010
I really appreciate the threaded messages in android phones but i have a strange experience with it once in a while. When you text back and forth you get all these messages in like a chat form following the order of the conversation but sometimes i would all get my messages in a cluster while the response of my friend would be thrown somewhere in the beginning or at the end. I have no problem with sending and receiving but they sometimes don't come in the right order. I don't know if i have explained myself well or if you guys can see my problem.
View 8 Replies
View Related
May 7, 2010
Is there a way we can import threaded sms messages from an Iphone to HTC desire. Have also converted the SMS from iphone to a txt file. The SMS backup and restore software for HTC desire needs an XML file to restore.
Haven't tried restoring from a TXT file though. Wanted to know if there's an easier method around?
View 1 Replies
View Related
May 16, 2010
I really hate the Threaded / Conversation view. I found an alternative for gmail, using htc mail. However, I'm looking for a way to disable it in both the Google Voice app and the regular SMS app.
View 12 Replies
View Related
Nov 15, 2009
Is it possible to disable threaded conversations in gmail on the droid? I'm surprised i havent found anything on this yet - emails of information for non-related clients are grouped together because they come from the same source, making it very easy to miss new important emails since they dont appear at the top.Also, it's impossible to erase all the unnecessary emails without also deleting the few important ones.I didnt care about this on my iphone b/c the new emails just came in normally at the top of the inbox.I've overlooked several new emails b/c of this.
View 3 Replies
View Related