[android-developers] Re: Progress Bar in every row of ListView
I'm also interested in this. I've been able to load a different image in place of the initial image, and then replace it when the background processing is completed. However, I would really like to show an indeterminate progress bar instead of an image. J On Apr 11, 9:48 am, praj wrote: > Hi, > > I am trying to have a progress bar in every row of my list view. My > list is an iconic list view and have implemented it in the lazy > loading way..so i want to display a progress bar (spinning progress > bar) till the images are not loaded. My current approach is that i hv > placed the progress bar in the layout and in my code in the getView > method i dismiss it when the image is loaded. However this seems to > work properly only for the first row of the list view. The progress > bars are visible on the rest of the rows even if the image is loaded > and only when i scroll the list do the progress bars disappear so i am > assuming this is something to do with refreshing the list view. So I > have tried using notifyDataSetChanged in my getView but it is not > helping. > > Please can anyone let me know if they have worked on anything similar > to this. > > Thanks, > Prajakta -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: how an activity transfers the value from one activity
I would recommend Preferences. On Apr 7, 11:10 pm, Nubh wrote: > Please Suggest on the Storage part > > I need to save the values in a file, I am slightly confused whether to > use "Preferences or Databases" > , Please help, Actually I am in college working on a Project for > submission. > > Thanks > NUBH -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using "remove me" as the subject.
[android-developers] ActivityManager vs Socket
I'm trying to catch socket errors (invalid ip, wrong port, etc.). It seems like the ActivityManager is shutting me down before I have time to catch these errors. I really have no idea what's going on here. My splash screen Haus attempts to start the service from a thread, however when the thread get's to the "about to create socket", it simply locks up. It locks up the entire app until the Force Close dialog box arrives. I have Log.i all the way into the class that makes the connection... 04-07 22:15:29.286: INFO/CONNECTION(19053): 4368 04-07 22:15:29.296: INFO/CONNECTION(19053): establishConnection() 04-07 22:15:29.446: INFO/CONNNECTION(19053): about to create socket 04-07 22:15:34.036: INFO/ActivityManager(76): Displayed activity com.scs.haus/.Haus: 8545 ms (total 8545 ms) 04-07 22:15:38.989: WARN/ActivityManager(76): Launch timeout has expired, giving up wake lock! I never see any of these Logs, except of course for the one that tells me I'm inside the method. public void establishConnection(){ Log.i("CONNECTION","establishConnection()"); try{ c = new Connection(adr,SERVERPORT,key); } catch (UnknownHostException e) { e.printStackTrace(); Log.e("CONNECTION","Exception:"+e); } catch (IOException e) { e.printStackTrace(); Log.e("CONNECTION","Exception:"+e); } catch (Exception e) { e.printStackTrace(); Log.e("CONNECTION","Exception:"+e); } } Here is a snippet from the Connection class. I never see the"done making socket" Log (unless of course I have a vaild ip and/or port). Log.i("CONNNECTION","about to instanciate socket"); socket = new Socket(address,port); Log.i("CONNNECTION","done making socket"); Any ideas what I've done wrong here? Thanks, J -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: Service Object Availability between Activities
gt; > > public void onServiceConnected(ComponentName className, > > > IBinder > > > service) { > > > // Called when the connection is made > > > serviceBinder = > > > ((ConnectionService.MyBinder)service).getService(); > > > Log.i("LightController","Service Connected"); > > > } > > > > public void onServiceDisconnected(ComponentName className) { > > > // Received when the service unexpectedly disconnects > > > serviceBinder = null; > > > Log.i("LightController","Service Disconnected"); > > > } > > > }; > > > === > > > > If I try to run the getUnitProperties() method outside of the Thread, I > > > get > > > a NullExceptionPointer AND the Log.i for onServiceConnected() shows up in > > > the log after the exception. > > > > Thanks, > > > J > > > > On Mon, Apr 5, 2010 at 8:08 PM, Bob Kerns wrote: > > > >> It looks like you are trying to access the connection before the > > >> onBind() method is called? > > > >> You should NOT be sleeping the thread. You should be returning, and > > >> then picking up your work once onBind() is called. > > > >> You're actually blocking the service from running until you do return, > > >> since it needs to run in that same thread. > > > >> On Apr 5, 2:53 pm, Jason LeBlanc wrote: > > >> > Thanks for the response. I haven't meant to spam the group, I wasn't > > >> sure if > > >> > my post were posting. > > > >> > Problem Activity: LightController > > >> > Service: ConnectionService > > >> > Object within Service: Connection > > > >> > Basically all I am attempting to do is start the Service (from a Splash > > >> > Screen Activity) which will provide a Connection to a hardware > > >> controller. I > > >> > hope to use this Connection to send and receive messages with the > > >> hardware > > >> > controller. > > > >> > I have been able to bind to the Service and send/receive commands with > > >> the > > >> > controller in the Activity that loads after the Splash Screen. The > > >> problem > > >> > arose when I tried to create another Activity (LightController) and > > >> connect > > >> > to the same Service. Since, I'm just learning I assumed I was doing > > >> > something wrong with the Service (e.g. binding, unbinding, object > > >> sharing, > > >> > etc.) > > > >> > I finally realized in my LogCat that it was reporting that the Service > > >> was > > >> > connected after the bit of code I had written to test my connection. > > >> > I'm > > >> > still not sure why this happens. Perhaps something to do with the way > > >> these > > >> > commands are queued? > > > >> > _ begin code snippet from onCreate()_ > > > >> > // Bind to the Connection Service > > >> > Intent bindIntent = new Intent(LightController.this, > > >> > ConnectionService.class); > > >> > bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE); > > > >> > // Request data from the controller > > >> > if (unit = serviceBinder.c.connected() ) { > > >> > Log.i(Connection Service is connected);} else { > > > >> > Log.i(Connection Service is not connected); > > > >> > } > > > >> > _ end code snippet from onCreate()_ > > > >> > Anyhow, the above if/then would result in a NullPointerException. I > > >> > eventually moved it to a try/catch which resulted in a WARN instead of > > >> an > > >> > ERROR (see LogCat posted above). > > > >> > So finally, I have moved the if/then statement to a Thread and all is > > >> well. > > >> > I sleep for 1000 ms in the Thread prior to attempting to access the > > >> > Connection. I am assuming this small time delay is what was needed in > > >> order > > >> > to establish the binding to the service. Is it that, or are all of the > > >> > commands queued until the end of the onCreate() and then executed in > > >> some > > >> >
[android-developers] Re: Service Object Availability between Activities
I have a Connection object that is instantiated by the ConnectionService. I bind to the service in order to access the Connection object and get information from a controller over TCP/IP. Again, I launch the service from a splash screen with success. I bind to the service in my main activity and can access it's objects(i.e. Connection) successfully. Then once I start a new activity from the main activity, I am able to successfully bind to the service. However, when I try to access the Connection object I get the following errors/warns. I would like to be able to connect to the object from multiple activities throughout the application to obtain up to date information from the controller. Any assistance is greatly appreciated. Here is the dump from LogCat. 04-04 08:25:18.068: INFO/ActivityManager(76): Process com.google.android.apps.maps:LocationFriendService (pid 15448) has died. 04-04 08:25:21.888: INFO/NotificationService(76): enqueueToast pkg=com.scs.haus callback=android.app.ITransientNotification$Stub $pr...@434d3868 duration=1 04-04 08:25:21.898: INFO/ActivityManager(76): Starting activity: Intent { cmp=com.scs.haus/.LightController (has extras) } 04-04 08:25:22.088: WARN/Resources(15436): Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f070008} 04-04 08:25:22.098: WARN/Resources(15436): Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f070009} 04-04 08:25:22.108: INFO/LightController(15436): Could not check serviceBinder.c.connected) 04-04 08:25:22.108: WARN/System.err(15436): java.lang.NullPointerException 04-04 08:25:22.108: WARN/System.err(15436): at com.scs.haus.LightController.onStart(LightController.java:111) 04-04 08:25:22.108: WARN/System.err(15436): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java: 1205) 04-04 08:25:22.108: WARN/System.err(15436): at android.app.Activity.performStart(Activity.java:3519) 04-04 08:25:22.118: WARN/System.err(15436): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2373) 04-04 08:25:22.118: WARN/System.err(15436): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2417) 04-04 08:25:22.118: WARN/System.err(15436): at android.app.ActivityThread.access$2100(ActivityThread.java:116) 04-04 08:25:22.118: WARN/System.err(15436): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 04-04 08:25:22.118: WARN/System.err(15436): at android.os.Handler.dispatchMessage(Handler.java:99) 04-04 08:25:22.118: WARN/System.err(15436): at android.os.Looper.loop(Looper.java:123) 04-04 08:25:22.118: WARN/System.err(15436): at android.app.ActivityThread.main(ActivityThread.java:4203) 04-04 08:25:22.118: WARN/System.err(15436): at java.lang.reflect.Method.invokeNative(Native Method) 04-04 08:25:22.118: WARN/System.err(15436): at java.lang.reflect.Method.invoke(Method.java:521) 04-04 08:25:22.118: WARN/System.err(15436): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:791) 04-04 08:25:22.118: WARN/System.err(15436): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 04-04 08:25:22.128: WARN/System.err(15436): at dalvik.system.NativeStart.main(Native Method) 04-04 08:25:22.128: INFO/LightController(15436): Could not check serviceBinder.c.connected) 04-04 08:25:22.128: WARN/System.err(15436): java.lang.NullPointerException 04-04 08:25:22.128: WARN/System.err(15436): at com.scs.haus.LightController.onResume(LightController.java:126) 04-04 08:25:22.128: WARN/System.err(15436): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java: 1225) 04-04 08:25:22.128: WARN/System.err(15436): at android.app.Activity.performResume(Activity.java:3559) 04-04 08:25:22.128: WARN/System.err(15436): at android.app.ActivityThread.performResumeActivity(ActivityThread.java: 2838) 04-04 08:25:22.128: WARN/System.err(15436): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java: 2866) 04-04 08:25:22.138: WARN/System.err(15436): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2420) 04-04 08:25:22.138: WARN/System.err(15436): at android.app.ActivityThread.access$2100(ActivityThread.java:116) 04-04 08:25:22.138: WARN/System.err(15436): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 04-04 08:25:22.138: WARN/System.err(15436): at android.os.Handler.dispatchMessage(Handler.java:99) 04-04 08:25:22.138: WARN/System.err(15436): at android.os.Looper.loop(Looper.java:123) 04-04 08:25:22.138: WARN/System.err(15436): at android.app.ActivityThread.main(ActivityThread.java:4203) 04-04 08:25:22.138: WARN/System.err(15436): at java.lang.reflect.Method.invokeNative(Native Method) 04-04 08:25:22.138: WARN/System.err(15436): at java.lang.reflect.Method.invoke(Method.java:521) 04-04 08:25:22.138: WARN/System.err(15436): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit
[android-developers] Service Object Availability between Activities
I currently have a service called ConnectionService. It instantiates a Connection object that gives me access to a controller of TCP. I start the service from a splash screen activity, which sends and intent and starts my "main" activity once a connection has been established. In the "main" activity, I can access my Connection object and communicate with the controller. However, when I start a new activity from the "main" activity and bind to the service, I get a NullPointerException when I try to call methods in the ConnectionService. I've been struggling with this for a few days now. Perhaps it's a weakness in my Java comprehension. Thanks, J -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using "remove me" as the subject.
[android-developers] Detecting Socket connection failure
Hello Group. I am working on an app that uses a Socket to connect to a controller over TCP. The protocol library was written in Java and I am implementing it in android via a Service. SplashScreenActivity -> ConnectionService -> Connection where the Connection class is a Thread that handles the communications with the controller. It's where the Socket lives. I'm using the Preferences mechanism to store the IP and Port. If I feed the Socket the correct IP and Port, the Connection Service works beautifully. However, I am trying to simulate a user entering the wrong information and having the connection fail. The ultimate goal is to present a dialog and offer the ability to "reconnect" or "update settings". However, when I enter a wrong Port number, the application simply hangs. I was under the impression that Threads executed concurrently so I've tried moving the call to start the Connection Service to a Thread, but it still hangs the application. Has anyone had experience with a similar situation? Any recommended reading on how to prevent the call for a new Socket (with a bad address or port) from locking up my app? Thanks, j _snipet_SplashScreenActivity_ makeConnection = new Runnable(){ @Override public void run() { try { Thread.sleep(500); Intent bindIntent = new Intent(SplashScreenActivity.this, ConnectionService.class); bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE); startService(new Intent(SplashScreenActivity.this, ConnectionService.class)); } catch (InterruptedException e) { Log.i("THREAD","Interrupted"+e); } } }; _end_snipet_SplashScreenActivity_ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using "remove me" as the subject.
[android-developers] Detecting Socket connection failure
Hello. I am working on an app that uses a Socket to connect to a controller over TCP. The protocol library was written in Java and I am implementing it in android via a Service. SplashScreenActivity -> ConnectionService -> Connection where the Connection class is a Thread that handles the communications with the controller. It's where the Socket lives. I'm using the Preferences mechanism to store the IP and Port. If I feed the Socket the correct IP and Port, the Connection Service works beautifully. However, I am trying to simulate a user entering the wrong information and having the connection fail. The ultimate goal is to present a dialog and offer the ability to "reconnect" or "update settings". However, when I enter a wrong Port number, the application simply hangs. I was under the impression that Threads executed concurrently so I've tried moving the call to start the Connection Service to a Thread, but it still hangs the application. Has anyone had experience with a similar situation? Any recommended reading on how to prevent the call for a new Socket (with a bad address or port) from locking up my app? Thanks, j _snipet_SplashScreenActivity_ makeConnection = new Runnable(){ @Override public void run() { try { Thread.sleep(500); Intent bindIntent = new Intent(SplashScreenActivity.this, ConnectionService.class); bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE); startService(new Intent(SplashScreenActivity.this, ConnectionService.class)); } catch (InterruptedException e) { Log.i("THREAD","Interrupted"+e); } } }; _end_snipet_SplashScreenActivity_ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using "remove me" as the subject.