Android :: Set And Get Thread Priority From Java And Native Layers?
May 10, 2010
I have a multithreaded streaming app which has mainly the following 5 threads. 1 Main App(UI) Thread 1 controller thread (in native) 1 audio decoder thread (in native) 1 video decoder thread(in native) 1 thread to query the head position of audio (in Java) Apart from this I have video rendering with OpenGL. My problem is, if I query the thread priority using the Thread.getPriority method (my native threads make callbacks to Java and I am making the query at that point of time), I am getting the priority of each of them as 5. For my audio query thread (the last one in the list) I am explicitly setting the priority using Process.setThreadPriority(Process.THREAD_PRIORITY_URGENT_AUDIO); Also for my decoder threads, I am giving higher priority than my controller thread(using pthread APIs in native). But still finally all of them seem to have same priority. Also what should I be doing to increase the priority of my threads(both from Java and native)?
View 6 Replies
May 8, 2010
Does anyone know how Java thread relates to Android native thread? Does it map one to one?
View 2 Replies
View Related
Dec 16, 2009
I have two apps that use a service to upload and download files and data. I've noticed that when the service gets very busy, it can cause the UI to block, up to the point that Android shows a "force quit/ wait" popup. In order to avoid that, I run tasks in a service at a lower priority. This way, the service will never cause the UI to hickup. Also, the service stops if the app hasn't been used for a certain number of minutes. I don't want to keep resources if the user isn't using my app.I have found that some of my users run apps that run services permanently at normal priority. Such a service starts at phone switch on, and keeps running indefinitely, downloading vast amounts of data. My policy of being nice to other apps doesn't pay off: these agressive third party services push my service away so it never gets anything done. As one of my users told me, my app has hickups, until he kills the service of this app X, after which my app runs smoothly, snappy, and fast.
My question is, should I be nice to other apps and to the UI in my own app, or should I just run a service and agressively take all resources I need - or don't need? This is one issue where Android is different from iPhone. We can run services, but by doing so, we can cause damage to other peoples apps. Of course, my "question" doesn't require an answer. I'm just curious after what other people think, what your experience here is.
View 5 Replies
View Related
Feb 9, 2010
I am programming a game with fast graphics. The MediaPlayer is stuttering sometimes. When I have the MediaPlayer in a service, it does not stutter, but some people here adviced me not to use services if they should stop automatically when the user ends my application. So how can I set the thread-priority of the MediaPlayer-Object? SoundPool uses the MediaPlayer and with SoundPool, you can set the thread-priority, but I cannot add my audio-file to SoundPool, because its size is about 2mb (too big for SoundPool). I can lower my main-thread-priority so that the MediaPlayer has a relatively higher priority, but isn't this a bad idea?
View 2 Replies
View Related
Apr 26, 2012
I read somewhere that iPhone UI is so smooth because the thread which renders the UI has the REALTIME priority... so is that possible to mod android's UI thread priority?
View 2 Replies
View Related
Sep 7, 2010
How can I implement a run() method of thread if I create a Thread Global?
I mean If I create a Thread Globally then can I implement its run() method {" public void run()"} anywhere in my Application?
In the run() method I have to write the code to perform some action.
IF I can do it then please can anyone show me briefly how to do it particularly.
View 2 Replies
View Related
Apr 23, 2009
I have a native application that I would like to start from a Java interface. Does anyone know of a good way of doing this? can start the application using adb, with no problems. I can also start the application using Runtime.exec(), but that doesn't work so well for me; I need the application to run outside of a Java Runtime Process. Any ideas?
View 2 Replies
View Related
Feb 7, 2009
I am trying to figure out what is the best way to debug a mix of Java and native code? Please notice, that I am NOT trying to develop a native app. The app will be written entirely in Java, using Android SDK. However, I noticed that some pieces of the SDK use native methods (e.g. AssetManager, WebKit, etc). I wonder which tools Google developers use if/when they need to debug a mix of Java and C/C++ code? Eclipse/gdb or there are commercial tools which make the debugging experience less painful?
View 2 Replies
View Related
Apr 8, 2009
I have developed bluetooth application where native library will be initiated by Java application (using JNI wrapper). JNI will call the entry function of the native library and then it will create Pthread to for scanning the device. Once Scanning is over, i will get the callback which i registered during the entry function of the native lib (called by app). But i haven't received the callback, but if i run the same native library in the shell (executable from the shell terminal) it is working fine. Can any one help me, if there is any specific architecture needs to follow while developing Java application based on native lib?
View 4 Replies
View Related
Nov 5, 2009
I am trying to run a native executable from inside an android java application. The native executable exists in my assets. At start of activity, I copy it from assets to my application cache Dir. then I use Process Builder to run it.I tried to run "chmod 777" on the file and on cache directory containing it and I ensured permissions are granted using adb shell. but I still get this permission exception.
View 4 Replies
View Related
Jul 29, 2010
Is it possible, from within my android java app, to capture an image of what is on the screen, even if it was written using native (ndk)? I do not wish to take screen shots of other apps, just my own. I can already capture and image of a canvas that I am aware of, but is there a view or canvas or something like it that always represents what is on the screen, so that a) I don't have to capture the separate views images and recompile them, and b) I can see what my native (jni) code is doing with the graphics too?
View 1 Replies
View Related
Sep 17, 2009
I am currently working on porting a application written in C in android platform. I need to know that can i invoke/call the getSystemService from the C application using invocation interface by JNI. Meaning using a .java file which will interact with the interace provided by the android.telephony.TelephonyManager.java for using getCallState() and other mehthods.
View 2 Replies
View Related
Jun 16, 2010
I'm writing an Android app. I have a main method, which creates and runs a new Thread using an anonymous inner Runnable class. The run() method, when it's done, calls a method on it's parent class (in the main thread) that calls notifyDataSetChanged() so that the main thread can redraw the new data. This is causing all kinds of trouble (ViewRoot$CalledFromWrongThreadException). The thing is, this method being called from the worker thread is on the class that's created in the UI thread. Shouldn't that be running on the UI thread? Or am I missing something.
View 1 Replies
View Related
Aug 4, 2010
We have a service that seem to get deadlocked very occasionally in the field. It's not possible to hook up to a debugger. We can detect the deadlock situation programmatically. Is it possible to do this from within Java code?
if (ohIamDeadlocked()) { Thread.something.dumpStacksOfAllThreads(); }
If this is not possible, is there an adb command that could do it? I tried "adb dumpsys" but it doesn't print any stack information.
View 3 Replies
View Related
Jun 24, 2010
Suppose i have one simple function in my program. Whenever i call that function does a new thread or process is spawned to execute the function or it is executed under the main thread memory space only.
View 4 Replies
View Related
Sep 9, 2010
Is there a reason why the Thread class in the SDK LunarLander and JetBoy examples are not each in a separate java file, rather than being inside the View file?
It would make things a bit clearer, IMHO. Am I missing something?
View 2 Replies
View Related
Jun 25, 2010
I am trying to produce a java front end, via some sort of Android "view" that will allow me to show the console output from a native C/C++ application binary. I followed the steps from various google searches and I have a tool chain that produces native binarys that I can then "adb push" onto the android device. I can either use the adb shell or a console application like ConnectBot to native to the pushed path and run the binary like so: ./someApplicationHowever as I stated in my opening sentence I would like to wrap this binary with a font end producing an apk that can be loaded onto the phone and when it runs it opens up and directs the stdio output from the native binary to the screen.
View 1 Replies
View Related
Jul 24, 2010
I would like to be able to use the OpenGL API from both Java and C (via NDK).
In Java, there is a GL object passed, which has all GL methods on it.
In C, you just talk to the native library.
In a single onDrawFrame callback (for which Java is passed a GL), can I use methods on the GL object, and also call NDK methods which access the openGL library?
In other words, is the GL object just a wrapper for the same instance of the native library?
View 3 Replies
View Related
May 20, 2010
I'm going to develop a Android program, with a photo display on screen. And there are some text and drawing (circle/Rect) over the photo. The text and drawing will change when use touch on the screen.How can I implement? SurfaceView? ItemizedOverlay? or anything else?
View 1 Replies
View Related
Sep 12, 2010
I thought there were layers for maps where you could see restaurants close to your location. Does anyone know how to get this.
View 2 Replies
View Related
Sep 29, 2010
I have a thread in java/Android like this:
CODE:................
The thread works fine when I run my application. But I want to start/restart the thread with a button.
CODE:.........
If I copy the thread into the button I just make a new thread every time the user clicks on the button. I want to run the thread when the user first time click on the button, "kill it" and start from the beginning if the user click on the button a second time.
View 2 Replies
View Related
Oct 16, 2009
Any idea when an update to Google Maps might be happening? Specifically I'm looking for the layers & My Maps functionality. Something I had in my Nokia N96 version before taking the plunge and upgrading to a HTC Hero. Seems I've taken a back step as currently these functions aren't available yet!
View 8 Replies
View Related
Nov 9, 2009
Just got the droid and I love it. However I was playing around with the Google Maps Directions and such, entered in a few locations and it saved all of them to my Layers screen. How can I clear them? I don't want those there when I hit the layers button, but I can't find any option to clear them.
View 12 Replies
View Related
Nov 30, 2009
I'm developing a google maps based application for android 1.6.
My problem is that in my application I have more than one layer that extends from ItemizedOverlay representing information in the map.
The problem is that all the layers implement the onTap method, but now only the last layer (on the top of the stack) detects the tap event, so If the user taps on an item that is in a deeper item the method onTap never fires.
Is there any way to propagate the event to deeper layers?
View 2 Replies
View Related
May 21, 2009
I am writing an application in which i need to handle messages between the main thread(the deafult UI related thread) and the user created Gamethread.
The requirement is like this.
An activity(say "Activity_X") is setting the view by "setContentView(some "View_Y")". In "Activity_X" i have implemeted "onCreateOptionsMenu()" and "onOptionsItemSelected()" fucntions for creating menus & a switch case for action to be taken on selecting those menus.Menu has items like "resume/pause/zoom/" .
All action to be take on selecting these menus are implemented in "View_Y" in a separate Gamethread by extending "Thread" class.
So whenever a menu is selected in "Activity_X" i need to send a message to "View_Y". And on receiving this ,a particular action/method should be called in View_Y(GameThread).
How can i achieve this using Handlers?Is there any other way of doing this? Please do share with me some code snippets for these.
View 3 Replies
View Related
May 27, 2010
I have a separate thread running to get data from the internet. After that, I would like to update the ListView in the main thread by calling adapter.notifyDataSetChanged(). But it does not work. Any workaround for that?
View 1 Replies
View Related
Jul 22, 2009
I want to do the drawing in another thread to speed up the game(it is way to slow right now). I was told to do this but don't quite understand why that would speed things up. Is it GameView that should implement Runnable? Should I make the thread sleep when not drawing? where should I start the thread? package com.android.WWS;
import android.app.Activity; import android.content.Context; import android.graphics.*; import android.os.Bundle; import android.view.SurfaceView; import android.view.KeyEvent; import android.view.View; import android.view.View.OnKeyListener; import java.lang.Runnable; import java.lang.Thread;...................
View 4 Replies
View Related
Sep 1, 2010
I was wondering if it is possible to set the priority of an IntentService like you can with a Thread. So far I have not found anything.
View 1 Replies
View Related
Jun 5, 2009
I was searching for the priority implementation in Messaging. I didn't find any code to show the priority of say SMS( For ex: urgent SMS). Anyone knows whether this feature exists in Android. Or is there any plan to add show the message priority in the notification bar(For SMS /MMS/ Voicemail)
View 2 Replies
View Related
May 14, 2010
Let me say this with an example. Lets say, my activity A is being executed, meanwhile another activity B gets launched. By default, acivity B will come on top of activity A. My requirement is that I want to keep A on top. Only activities such as phone, lock screen and home screen can come on top of me not other activities unless my activity closes.
View 5 Replies
View Related