[android-developers] Re: how to send a pdf file from android to wifi printer programatically?
On 11/30/2011 4:38 AM, Hrishi wrote: Please bare if is repeated question... I am able to connect to wifi device (printer). Now i want to print a pdf file programatically using wifi connection. can someone tell me how to do it because i am not getting any way to do it. I am able to print text ,html file n images but pdf file not get printed in proper format what is the way to send pdf file to printer in proper format ... Is there any API available for printing pdf file ? Please suggest third party APIs.. Please help me !! Thanks in advance !!! How are you printing the text, html files, and images? I'd really like to know because I haven't been able to find anything on Android printing. The online documentation for Google's Cloud Print intent has been a dead link for months. -- 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
[android-developers] Re: retrieve resource string from plain class
On 9/14/2011 3:41 PM, John Goche wrote: Hello, I would like to retrieve the value of a resource string from a plain class that does not have a Context superclass. Is this possible? I see the API: http://developer.android.com/guide/topics/resources/string-resource.html which do not list getString and getText as static methods. I tried String foo = (new Context()).getString(R.string.str_foo); but it seems I cannot do this. Any ideas? John Goche -- 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 If this class needs a context to do its job, then pass it one in its constructor. -- 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
[android-developers] Re: word wrapping
On 9/13/2011 4:22 PM, bob wrote: Is there a way to make Eclipse do word wrapping? Do you all use word wrapping or no? You mean word wrapping your source code? I've never seen anyone want to or do that ever in my entire development career. -- 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
[android-developers] Re: word wrapping
On 9/13/2011 4:38 PM, Tor Norbye wrote: He's probably asking about soft wrapping. Eclipse does not support it directly; see https://bugs.eclipse.org/bugs/show_bug.cgi?id=35779 (though from a quick skim it looks like there might be some support in the framework and some plugins to enable it.) -- Tor On Tue, Sep 13, 2011 at 1:28 PM, Kenny Riddilekfridd...@gmail.com wrote: On 9/13/2011 4:22 PM, bob wrote: Is there a way to make Eclipse do word wrapping? Do you all use word wrapping or no? You mean word wrapping your source code? I've never seen anyone want to or do that ever in my entire development career. -- 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 Uggh...looks terrible to me. If you have lines in your code that are long enough to require word-wrapping, then those lines are too long, especially with today's large monitors and high resolutions. Decompose them and make the code more readable IMO. -- 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
[android-developers] Re: Finishing Activities
On 6/28/2011 12:03 PM, Diogo Salaberri wrote: Hi.. I have a problem, whe I start my aplication the launcher activity is called HOME, and that HOME automatically call other activity called LOGIN. Now, I have to finish this aplication when I click on default back button overwriting onKeyDown. The problem is, how can I do this, a simple finish don't solve this. Follow my code ( onKeyDown ): @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { finish(); return true; } return super.onKeyDown(keyCode, event); } I hope that you can help me. Bye -- Atenciosamente; Diogo Bonoto Salaberri Bacharel em Ciência da Computação - UFPel -- 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 What are you asking? The default behavior of pushing the back button is to call finish(), so your code above does exactly what the back button already does. -- 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
[android-developers] Re: Spinner with added Text
On 4/18/2011 1:13 PM, Kumar Bibek wrote: You cant do that with a spinner. Are you so sure? I believe spinners can be populated both manually and from a database. Just google android dynamic spinner content. Here's one: http://www.dcpagesapps.com/developer-resources/android/21-android-tutorial-spinners?showall=1 -- 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
[android-developers] Re: Scope of Singletons
On 3/23/2011 12:37 PM, Jake Colman wrote: I use the following standard paradigm for singletons: private static MyClass instance = null; public static MyClass getInstance() { if( instance = null ) instance = new MyClass(); return instance; } If my application gets killed by Android, as can be expected, can I reasonably assume that when the application is restarted that instance is reinitialized to null? In other words, when Adroid invisibly kills and restarts my app, its behavior is the same if I had manually started my app myself? Thanks. instance == null, not instance = null...right? -- 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
[android-developers] Re: Global Variables
On 3/9/2011 7:35 PM, TreKing wrote: On Wed, Mar 9, 2011 at 4:30 PM, Kenny Riddile kfridd...@gmail.com mailto:kfridd...@gmail.com wrote: Assuming the singleton is modifiable via its interface, then for all intents and purposes, yes, they are. Again, no. Singleton is a design pattern whose purpose is to simplify and control access to a an object for which there is and will only be one instance of. This instance is set once and used throughout. It does not vary or change. It is not variable. Of course you can change the *state* of the singleton object, if that's what you mean by modifiable, but if you change the *value* of the object itself, as one would do with global *variables*, it is no longer a singleton. Even in the sense that the singleton state is modifiable, the whole point of the singleton is to provide an interface through which this globally accessible object, and its state, is manipulated. There is controlled access. This is not the case with your run-of-mill, freely accessible global variable. On Wed, Mar 9, 2011 at 6:11 PM, David Williams dwilli...@dtw-consulting.com mailto:dwilli...@dtw-consulting.com wrote: Ok, trying to do this but struggling. I created a class as follows: If all you're doing is defining some *constants* that are not going to change, extending Application is way overkill. Especially since casting up to your Application type every time you need something makes your code horrendous to look at. You can just do this: class Constants { public static final String KEY = MyKey; } Then do Constants.Key where you need it. Done. On Wed, Mar 9, 2011 at 6:11 PM, David Williams dwilli...@dtw-consulting.com mailto:dwilli...@dtw-consulting.com wrote: Sorry, this is just my lack of knowledge on Java here. I was hoping it was something like globalVars.getApiKey(), but that doesn't seem to work. I highly recommend you brush up on Java, reviewing static and instance level access of functions and data in particular. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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 Perhaps my blanket statement was to simplistic. Not ALL singletons are global variables. Also, not all globals are variables (globally accessible static constants for example). However, all STATEFUL singletons are globals, and all stateful singletons with mutable state (via methods or whatever) are essentially global variables as they create the same architectural issues. Limiting my statement to stateful singletons is kind of irrelevant though, since there's no point in limiting a stateless type to one instantiation. Just because a singleton's state is only mutable by using its interface doesn't change the fact that you are varying globally accessible state. When I was first starting my career, I thought singletons were great (after all, I read about them in a book!), but experience has taught me that there is almost always a better way than using mutable global state. Singletons essentially get you two things: - the guarantee that only one instance can exist - global access to that single instance The second is bad for all the reasons that global variables are considered bad, and the first is unnecessary. If you only need one instance of a class, then just make one. It really is that simple. Then give that instance to whomever needs it, instead of letting them magically pull it from the ether. -- 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
[android-developers] Re: Global Variables
On 3/10/2011 10:41 AM, TreKing wrote: Hmm, perhaps this is semantics at this point. I don't think a singleton is a global, as it's usually a private member that is statically accessible. However, there is global access, of course. If it's a single piece of state that's accessible globally, then to me, it's a global, regardless of the particular syntax or representation. No, but in terms of clarity, readability, and ease of debugging, there is a *huge* difference in using a singleton to modify some globally accessible object versus a classic global. To me, the third option of don't use either one is almost always better in terms of clarity, readability, and ease of debugging. Normally, I wholeheartedly agree. However, the Android model and intricacies of the lifecycle of an Android app present some unique challenges with regard to managing and passing around objects that are needed across multiple Activities. So it's not always that simple. Sometimes, when considering ease and speed of implementation, readability, and maintainability, a Singleton really is the best option. I admit, I've only released one Android app of intermediate complexity. It's been my experience on other platforms and languages, that any framework that encourages sections of your code to communicate via mutable global state is fundamentally flawed. I haven't felt encouraged in that manner by Android thus far. Anyways, this has gotten a bit off-topic from the OP's original question, and for that, I apologize :) -- 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
[android-developers] Re: Global Variables
On 3/9/2011 3:41 PM, David Williams wrote: All, What is the best way of going about setting up global variables? There will be like 5-6 global variables that I would like to set when my app is launched that are then available for any code anywhere in my app. I did something similar to this under Mojo on WebOS. I just set some global variables during the stage-assistant.js script that could then be used by any script. TIA. -- David Williams Check out our WebOS mobile phone app for the Palm Pre and Pixi: http://www.dtw-consulting.com/GolfCaddie Golf Caddie http://www.dtw-consulting.com/GolfCaddie | Golf Caddie Forum http://www.dtw-consulting.com/GolfCaddie/forum | Golf Caddie FAQ http://www.dtw-consulting.com/GolfCaddie/faq.html by DTW-Consulting, Inc. -- 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 IMHO, the best way to use global variables is to not use global variables. -- 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
[android-developers] Re: Global Variables
On 3/9/2011 4:26 PM, TreKing wrote: On Wed, Mar 9, 2011 at 3:15 PM, David Williams dwilli...@dtw-consulting.com mailto:dwilli...@dtw-consulting.com wrote: That said, why avoid them like the plague? Global variables are one of those things, like Singletons, that on the surface seem to make life easier, then get abused like a step-child to the point of making everything worse. Used correctly, in moderation, it's often the fastest, easiest, cleanest, and most straightforward way of doing something. Like a simple flag indicating DEBUG vs RELEASE, for example. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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 Singletons are global variables. -- 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