runnable

How do I Return a Runnable in this Method?

三世轮回 提交于 2019-12-25 02:16:07
问题 I don't know how to make a Return on a Runnable Method (or w/this particular method). I may have the idea wrong to(?). Any help? thnx! *This is continued/related from this post. But thought it could be a Q on its own. In the Activities onCreate: Runnable doIfMounted = orderASC_Label(); StorageStateChecker.performExternalStorageOperation(doIfMounted ); The Runnable: /** * -- Default List Order (Ascending) * ===================================================================== * @return **/

Using a thread as a GameLoop

不想你离开。 提交于 2019-12-24 19:25:35
问题 What I need to do is have a loop that I can stop if I want... I made a new thread and named it GameLoop I want this to do all of my bitmap X and Y changes but when I tryed to run what I have nothing moves, It just sends me a picture. Heres my code, what did I do wrong? public GamePage(Context context, AttributeSet attrs) { super(context, attrs); //other code here Thread gameThread = new Thread(new GameLoop()); gameThread.start(); } public class GameLoop implements Runnable { public void run()

Android Progress Dialog not showing

泄露秘密 提交于 2019-12-24 17:45:58
问题 This is the handler, in the main Thread, which shows and dismisses a progress dialog. public static final int SHOW = 0; public static final int DISMISS = 1; public Handler pdHandler = new Handler() { @Override public void handleMessage(Message msg) { Log.i(TAG, "+ handleMessage(msg:" + msg + ")"); switch(msg.what) { case SHOW: pd = ProgressDialog.show(LogViewer.this, "", getText(R.string.loading_msg), true); break; case DISMISS: if(pd != null) { pd.dismiss(); pd = null; } break; } } }; The

onGlobalLayoutListener vs postRunnable

烈酒焚心 提交于 2019-12-24 16:51:25
问题 I am trying to do calculate view's x,y positions after completion of loading of activity. What I did is view.postDelayed(runnable, 2000) which is working fine. code reviewer is not happy with this and suggested to use OnGlobalLayoutListener to know about the completion of activity loading. Somehow I don't like OnGlobalLayoutListener because it is associated with entire view tree which is not required for my solution. I am trying to understand pros and cons of these approaches. Thanks! 回答1: If

onGlobalLayoutListener vs postRunnable

左心房为你撑大大i 提交于 2019-12-24 16:51:14
问题 I am trying to do calculate view's x,y positions after completion of loading of activity. What I did is view.postDelayed(runnable, 2000) which is working fine. code reviewer is not happy with this and suggested to use OnGlobalLayoutListener to know about the completion of activity loading. Somehow I don't like OnGlobalLayoutListener because it is associated with entire view tree which is not required for my solution. I am trying to understand pros and cons of these approaches. Thanks! 回答1: If

Maven: how to do runable jar (uberjar) with included external libraries

走远了吗. 提交于 2019-12-24 14:48:34
问题 Until now i made runnable jars with Ant and there were no problems with it. However i now try to mavenize my project and i realy can't figured out how to do runable jar with this tool. I've read tons of tutorials (also here, on Stackoverflow), helps, advices and... nothing. In my case all of them don't work which probably means i don't understand some basics. I have such simple project: This is app, witch use mysql-connector-java-5.1.24-bin.jar (placed in 'lib' dir) to connect to MySQL

Android: AsyncTask, my 1st task has not finished when the other starts

元气小坏坏 提交于 2019-12-24 13:23:23
问题 Here's my code in my main thread myAsyncRunnable mar = new myAsyncRunnable(GameActivity.this); mar.execute("fire"); PhotoTask photoTask = new PhotoTask(camera,surfaceCamera,isPreview,holder,GameActivity.this); photoTask.execute(null); in myAsyncRunnable.fire() I have a loop that changes 10 times the image of an ImageView in gameActivity. I want the photoTask to start when the last image has been changed @Override protected Void doInBackground(String... params) { fire(); return null; } public

Why this handler (runnable) is slowing down my app if it is launched on a service?

人走茶凉 提交于 2019-12-24 11:50:15
问题 i am using a background service that it is retrieving data and inserting data on a remote server. OK, i puted it on a background service because i wanted to get that done in background without slowing down my app, but it is slowing down my app ! as you will see in the code, it haves a sleep of 60 seconds, and my app is getting frozen 2/3 seconds each 60 seconds, it is this code, i am sure, but i dont know how to solve it public class MyService extends Service implements Runnable{ boolean

How to access already running instance of a class without creating an actual object

只愿长相守 提交于 2019-12-24 10:44:25
问题 I have a problem with Java GUI. It is hard to explain but I will do my best. I have 2 GUI classes one is class I and other is class G. Class I is initiated from main method. In the class I there is a field (instance of) class G. Reason being that class I collects vital information and passes it to instance of class G. When a button pressed in class I, that sets the class I frame visibility to false and instance of class G to true (showing up the G interface). Problem here is that I want to be

Export runnable program from python eclipse project on ubuntu

半世苍凉 提交于 2019-12-24 08:28:28
问题 It is my first time to use python, so i doing a simple program with a simple UI. I am using eclipse with PyDev as an IDE. I know in JAVA a to export a runnable program we use .jar files, but what works for python and how to do it in eclipse on ubuntu ? So if any explanation with some details or a useful link, i will be grateful. Thanks, Samer 回答1: Easiest way on windows is py2exe. If you're using Mac, check out py2app. If you're in a Linux/Unix environment, I'm a bit less familiar with how to