Android : Effective Way To Handle Redundant UI Elements In Droid?
Sep 13, 2010
I have numerous activites in my Android app., and most should contain the same, relatively complex set of UI widgets on the screen's top area (lets say that its a kind of toolbar that you can find on most screens).
Right now, every screen's layout contains the markup for this toolbar, along with its logic inside every Activity's source, so it's damn redundant. Could you recommend a more efficient / less redunant way to do this?
I have a simple Android app that does some math on 2 numbers that the user inputs and returns the result. Currently I have a 'calculate' button that needs to be pressed to do the math and return the value.
How can I get rid of this button and just get the app to run the math after the uses has changed either one of the 2 numbers?
CursorAdapter is great, i'm a big fan. I notice that both newView() and bindView() are passed Cursors, indicating that extracting stuff from the Cursor and sticking it in the view should happen inside those overrides.
however in the source for CursorAdapter.getView() i see that bindView() gets called whether the view is recycled or not. in the new view case, this causes a redundant Cursor to View copy.
IMHO, CursorAdapter should call newView() if the view couldn't be recycled, or bindView() if it could.
I have been trying to use a ScrollView on a single ImageView with a JPG (~770 x 1024) over an AVD that's 600x800.
My main.xml is code...
It is important for me to avoid stretching the image. I can not use FIT_XY for ScaleType. What is the recommended way to implement a display of a page that can be potentially scrolled? Do I have to do it manually with a plain layout and scrolling upon GestureDetector.OnScroll events?
I have been given the tasks of speccing a mobile application, which will need to run on approx. 1000 devices. These devices already exist, and consist of iPhones, BlackBerrys, Androids, Windows Mobile and Netbooks. The application will have simple reporting capability, and a collection of forms. Anyway, the obvious solution would be to develop some browser based solution, although given the occasionally connected nature of the devices, there's a potential for data to get lost / not saved.
So instead of creating a complex application for each platform, I was thinking we could build what is effectively a form generator, with basic offline storage capability (text files), designed to run on each device, and have the device generate a form, based on for example an XML file that it could request from a server somewhere, resulting in minimal specialist development costs, and the ability to run most of the logic from the server end, with the devices being dumb clients that render forms and upload the data when there is an available connection. Anyway, my question summarised is, how have you made the decision on supporting multiple devices for your application. Is this always an unavoidable problem, and you just have to make the call to support 1 or 2, or pay for developers to write code for each platform, or alternatively supply pre-installed devices to the company?
On iPhones the notification is center of the screen in a big graphic. On my LG2 all I get is some tiny icon in the notification bar. Also on teh iPhone the lock screen wakes up to show the voicemail prompt/graphic. On the LG2 teh screen is still dark. So unless I turn on my lock screen, I never know I have a v-mail.
Take a simple XML file formatted like this code...
Each node has some attributes that actually hold the data of the file. I need a very quick way to count the number of each type of element, (List and Note). Lists is simply the root and doesn't matter.
I can do this with a simple string search or something similar, but I need to make this as fast as possible.
Design Parameters: Must be in java (Android application). Must AVOID allocating memory as much as possible. Must return the total number of Note elements and the number of List elements in the file, regardless of location in file.
Number of Lists will typically be small (1-4), and number of notes can potentially be very large (upwards of 1000, typically 100) per file.
Is there a way to absolutely position an UI element on Android so that it is located outside an Activity? For example: can you create a fullscreen ImageView simply by moving/resizing an ImageView inside an existing regular Activity instead of creating a new fullscreen activity?
I'm a newbie to this forum, and hope someone can help. Have had the Captivate for almost a month now and am plagued by an annoying problem. I have set up email accounts connecting to a google-hosted email account via IMAP. I am finding that when replying to a received email, my reply goes out with redundant repetitions of the email address on the "to" line. Example: Email from firstname.lastname@example.org arrives. I click "reply" on the phone and the reply goes out to email@example.com; firstname.lastname@example.org; email@example.com; firstname.lastname@example.org etc etc *10 times*, instead of just once. It also copies me about 10 times! Is anybody else seeing this? I use this for work emails, so it looks very unprofessional like I am trying to spam my clients! I have another couple of days before my 30-day return period is up, so hopefully someone else know how to fix this. Is there some setting I am overlooking?
I know Android cannot handle PDFs natively. However, the Nexus One (and possibly other phones) come pre-Installed with QuickOffice Viewer. How would I determine whether the user has a PDF viewer installed?
Currently, the code to start the PDF download looks pretty simple:
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); startActivity(intent);
After the download, the user clicks on the downloaded file to invoke the viewer. However, if there is no PDF viewer, Android reports "Cannot download. The content is not supported on the phone." I want to determine if the user will get this message, and if so, direct them to PDF apps in the Android Market.
I have just gotten my first Android based device, the HTC Droid Incredible.
I am not new to the world of smartphones (I have owned a Blackberry and have worked on many other Blackberries), but I am new to the whole world of Android.
I really do like it so far, but I have a question...
How does Android handle data? What I mean by this question is this: Does Android use a store and forward approach to sending data (emails)? Or does it send it out and if it doesn't have a good connection, it will just fail out, never to try again?
And based on the fact that it uses data, I also assume that it will never lose it's data connection even though a cell phone tower might be buried under voice calls?
The reason I ask this is because during 9/11, many people's cell phones could not make or receive calls but those who had some of the first Blackberries were able to send and receive emails just fine due to the store and forward approach.
Also, another reason is that this device will be used in a SHTF type of situation due to it's capabilities and I want to make sure that it will work with data (sending emails), although I may not be able to make voice calls with it.
I have as a lot a people troubles with the new ContactsContract class.
My problem is like in 1.5 and 1.6 devices, we can add a key to a contact with the Contacts.People.Extensions class. But now there is a problem with this content provider.. It's unknown by new devices. And it's the only provider who does not work. Does someone know why is it not working anymore ? And is there a new way to put some extensions for contacts ( with the ContactContract class maybe?
Does anybody know if there is any event to handle incoming calls?? I'm developing an app that streams audio from the microphone and I would like to have a listener that stops the recording, etc when there is an incoming call...and that restarts the process when the telephone call is over.
I'm thinking about using a ViewFlipper for an Wizard like Activity. But I see one problem with this approach. The back button. Will the back button go back to the last shown activity or will the the Viewflipper somehow catch the back button event and only change to the last shown activity?
I have an onKeyDown event which is only needed for handling the Up and Down hardware keys in my app. For these it returns true, as they are handled. For anything else it returns false which I understand means that the OS should handle them. However, when I press the Back button, my onKeyDown is called and returns false, but there is no other effect. I want/would expect the OS to finish the current Activity and resume the previous one.
I'm working on an open source project for android and am wondering whether there are any best practices (or at least well-argued hints) on how to manage the private key for signing the APKs.
On the one hand, the key should be secured, on the other hand, at least the members of the core team should be able to create "official" releases.
My first suggestion was to just distribute the encrypted private key in the source repository and give out the passphrase to committers, but the trust (from the community to the individual) cannot be revoked.
Is there any other way to share the signing rights (e.g. by setting up a private CA and creating keys for each committer) among the members?
Now, from here I could press the back button to kill the activity, but I also want a press of the lock button to silence the alarm. How would I go about creating a handler for presses of the lock screen button?
I'm trying to modify two TextViews in exactly the same way. I thought I can give them same id and with findViewById() and setText() methods change those TextViews in two lines. But it seems only one TextView is changed.Is there a way to do this?Or I have to make different ids for every element, get every element by findViewById() method and set it's text?
How do you guys like the physical buttons vs. the soft buttons (glass) on other phones? I've got an Incredible that I really like, but I'm having two issues that I'm not liking. Call quality and battery life. I looked at the Droid X and really didn't like the physical buttons. How many of you were disappointed by the physical buttons but have found them to be OK after using them?
Been an increasing amount of talk lately about Froyo (2.2) and how it will have flash and all that jazz. I use a non-rooted, standard ROM Droid, and I'm wondering how well it will handle all of these improvements. I assume the newer android devices with their gHz processors will do fine, but how do you think us Droid users will fair? And don't just say it can handle it. I know it will work, but how well is my question?
How does the droid X handle 3d games? Mainly the gameloft games i love to play.
I had the vibrant with the powervr sgx540 and it wax nice but my wife took over that phone. I have the HTC G2 with the Andreno 205 which is a little slower than the 540 but still good but i want to know how well the droid x with the powervr sgx530 performs in realworld games. im thinking of returning the G2 and going for an X. i need some motivation!
Just wonder what limitations there are for UI elements in AppWidgets? I tried a ListView and was met with an error. I saw the other post that EditText isn't available.Just wondering if there was a full list somewhere?
I'm having trouble positioning the layout elements. The AutoComplete in my TableLayout and the button after it are expanding the TableRow larger than the width of the screen. Anyone have an idea why? Below is my XML code as well as a picture of the problem...
Specifically related to when/how often the backup is sent from phone to google servers, and whether that data is accessible from somewhere other than the DROID.I'm curious as to how to plan restores if a install a jacked up app.I've done a hard reset already, in an attempt to cure the 3g -> 1x issue, and was surprised the auto-restore re-installed my wallpaper without any type of user intervention.
Well i have Handcent and have set it to pop up so i can reply system wide. While looking at You Tube videos it pops up i reply and when i go back to my video its just blank will not restart or anything else i have to hit back and click on the vid from the start. Its just annoying. Anyone know a work around this. I am Rooted i also have Tasker (but not that good where i can figure out how to do this) Does this happen to everyone is this just the network not being able to handle text and data at the same time. It worked fine on my old iphone.