Android : Group Of Views Controls On Multiple Screens
Aug 15, 2010
I am working on an Android project where a group of buttons needs to show on the bottom of every screen (activity) in the application. The group of buttons are basically a navigation bar. I want to know the best way to do this without creating new buttons for every activity. I have been around programming (C++/C#) for many years but am pretty new to Android and Java so if someone can point me in a general direction.
View 2 Replies
Sep 3, 2010
Before I go down the difficult path of merging some button and relative layout code, I wanted to ask if there was an easy way to group a set of controls as a focusable, clickable button? My educated guess is no...
I have 3 text labels of various attributes (font size) which I would like to put on a button. Having HTML text *may* work, but I would lose all the niceties of styles and layout alignments.
Any other solution anybody can think of?
View 5 Replies
View Related
Aug 16, 2010
Are there design guidelines to help decide if an application with multiple views should be designed with multiple activities or just one activity and control the back button itself.
I've tried both. My most complex applications using one activity per screen. However, now that I'm successfully written an app with just one activity and handling the back button myself, I don't see any compelling reason to use multiple activities. The one activity application is much simpler and more straightforward.
What advantages of multiple activities am I missing?
View 8 Replies
View Related
Feb 18, 2010
I'm working on an application using xml layouts.
I wish to know which is better:
1. Use few activities and change its contentview
2. Use an activity for each 'view' needed
If both works, in which case which option would be better?
View 1 Replies
View Related
Jan 2, 2010
How do I use the ResourceCursorTreeAdapter with the following constructor?
ResourceCursorTreeAdapter(Context context, Cursor cursor, int collapsedGroupLayout, int expandedGroupLayout, int childLayout)
I'm trying to use a it as follows. code...
View 2 Replies
View Related
Sep 20, 2010
i've got an ExpandableListView with my own layouts for the group and child views. a certain group-type will require a different layout. is that possible - i.e. a ELV with different layouts for a group view. i've got my own sub-class of SimpleExpandableListAdapter.
View 6 Replies
View Related
Feb 12, 2009
I'm looking for a way to iterate a viewgroup to retrieve all child views without calling findViewById(). Does view count and view position line up? So can I get the view count and then use that as a counter to call getChildAt(int index)?
View 2 Replies
View Related
Jun 9, 2010
I have an activity with two edittext controls. I am calling the requestFocus on the second edittext field since by default the focus goes to the first edittext control. The focus appears to be in the second edittext field (the second one gets the highlighted border), but if we try to enter any characters using the hardware keyboard the text appears in the first edittext control.
View 1 Replies
View Related
Apr 23, 2010
I am learning how to program on Android phone. However I am unsure how to make my application work for the different screen sizes and resolutions.
I read the tutorial on the android site and still unsure how to do it.
First I know there are different files so could make a layout for each of the sizes but my problem is most of the screen needs to be dynamically created so there would not be much to put in these files.
So I am not sure how to android to re size dynamic controls based on the screen size.
I have also read it is bad practice to make controls in anything but the xml file as it separates view logic and programming logic. However they never talk about if you need to make these controls dynamically what you should do.
So is there some other way to do it that is considered good practice?
Edit
I get this error when I try to run the switcher application.
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: Error type 2
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: Error: Unable to connect to activity manager; is the system running?
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: usage: am [start|broadcast|instrument|profile]
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: am start [-D] INTENT
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: am broadcast INTENT
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: am instrument [-r] [-e <ARG_NAME> <ARG_VALUE>] [-p <PROF_FILE>]
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: [-w] <COMPONENT>
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: am profile <PROCESS> [start <PROF_FILE>|stop]
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: INTENT is described with:
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: [-c <CATEGORY> [-c <CATEGORY>] ...]
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: [-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[2010-04-27 12:06:41 - ViewSwitcherTest] ActivityManager: [-n <COMPONENT>] [-f <FLAGS>] [<URI>]
To your question: It's dynamic because
the buttons in my example grow and
shrink depending on one of the 3
possibles sizes, because they use
scaled pixel (You probably know that
you don't have to deal with screen
sizes itself). So a scaled pixel
compared to a real a pixel has a size
of 0.75px, 1.0px or 1.5px. Android
automatically and dynamically adjusts
it to the actual size. So you don't
have to care about this in your code.
So if I use scaled pixels then I don't have to worry about different screen sizes?
At the moment I don't know an example
except in games where you have to deal
with "real" pixel. But if you want use
it, multiply it with the value of the
current density. This is your "ratio".
I don't have the example with the ball
anymore but I have another which uses
the same technics. You can run it on
different screen sizes and you will
see that the buttons will always fit
into the layout. You could use the
same technics for your intents. In
this example you can scroll with the
"Scrn" buttons from one view to
another of 4 views. (At the moment
they all have a black background so
you don't see that they are different
views). The "Enter" button exits the
test. It's an Eclipse project. You can
download
So if I want to deal with ratio then I use real pixels and not scaled pixels? What advantage does this give me?
will scaled pixels work with changing from portrait to landscape( ie will it fill up the new found space)?
Finally should I make the controls now through code or is there another way? As I said I am getting data from a webservice that must look like this
checkbox label label
It can be one record or 10,000 records I don't know so these have to be appended to something that is like a window panel( the controls in there get a scroll bar).
View 3 Replies
View Related
Aug 3, 2010
I start a browser and from the browser,I start a video which occupies only a small part of the screen,say the bottom right corner.
Now the browser will be pushed to the 2nd position in the window order and Video will come to the first position. Is it possible that browser can have the control for active window and receive the key events though the video is the Top Most window.
View 4 Replies
View Related
May 20, 2010
I am working on a graphics application in Android. I have a question regarding MULTIPLE SURFACE VIEWS. Can I be rendering multiple surface views at the same time. Initially, when I had two surface views in the same activity, it didn't seem to work, as it used to show only one at any time. But, with one surface view attached to one activity, is there any way I can keep the background activity's Surface View alive so that both the surfaces get rendered together?
View 2 Replies
View Related
Aug 5, 2009
what would be the outcome of using findViewById when multiple child views have the same ID lets say for example when using a layout to dynamically produce multiples of the same control?
View 4 Replies
View Related
Jan 17, 2010
I have a ListView that could have 4 different views for a row depending on the data for the row. I have the ListView working correctly overriding getViewTypeCount and getItemViewTYpe. I originally was trying to dynamiclly update the view type count as new views were inflated by forcing calls to getViewTypeCount because it was possible that maybe one or two views may be all that would be needed. The app never functioned correctly crashing after there was more than one view added. The problem was fixed by setting getViewTypeCount to always return 4. I noticed getViewTypeCount is automatically called on app start-up and never called again unless a force call is made. So I'm just curious if this can be changed dynamically or do you need to know the number of max views you can possibly have and override getViewTypeCount to return that max value.
View 1 Replies
View Related
Jun 15, 2010
I tried to add these views to list view using this kind of factory but everytime I try and add the view to a ListActivity, it comes up with nothing. What am I doing wrong?
View 3 Replies
View Related
Jul 31, 2010
My situation is the following: I have written one MapActivity class that is able to display a set of places as well as single places. On startup, the application creates an instance of this MapActivity and displays multiple places. If the user clicks on a certain place, then a new Activity is launched that shows the details of the selected place. This activity has a menu item that allows the user to view the place on a map - this causes that a new instance of the MapActivity is created, except that now only this single place is displayed.
The problem now is that if the user navigates back to the first MapActivity (the one that shows multiple places) the tiles won't be loaded anymore + sometimes OutOfMemoryErrors are encountered. According to the Android JavaDocs, it is only possible to have one MapActivity per process. However, I don't want to define my MapActivity as a singleInstance/singleTask, since the user should always be able to navigate back to the first MapActivity that shows multiple places. I have seen that the Google Places app (which has come with Google Map 4.4) for Android uses multiple MapActivity instances. How is this possible?
View 1 Replies
View Related
Dec 3, 2009
I am getting my feet wet developing software for the Android. My test app will have multiple screens (each having their own layout file). The main screen will direct the user to view the other screens based on user input. I kinda see this as layers of cake. Bottom layer being main; then you add and remove layers as the user makes UI inputs. The crazy trouble is how to view a second layer. I have created a second class which has its own onCreate method, which has its on setContentView(R.layout.secondlayer).
This class extends Activity much like my primary class does. I have a click event on a button within the main layout. This button will instantiate the new second layer class which I have done. And that is where my story endsI don't know what to do from this point. This is surely a newbie question If someone has an example that would be extremely helpful teach me to fish and I will be on my way.
View 6 Replies
View Related
Jul 19, 2010
I have an application using ListView inside Tabs, and I'd like to switch to a separate View(data collection widget) on clicking an item in the List.I'm adding each List's row's children to a ViewFlipper and the items are added at runtime so there is no definite number of views. As such, i would want to navigate/switch to a particular View in the ViewFlipper.Any pointers?
View 3 Replies
View Related
Jan 15, 2010
I have developed some apps for Android, and this questions stays always:
How should I structure my UI? Should I launch activity after activity and leave the phone to make the "back" button, or should I choose more optimized, but more complex to implement, way with switching manually Views and then manually doing the "Back" button functionality?
View 4 Replies
View Related
Jun 20, 2010
I am new to developing for android. I have a question regarding some best practices. My app is like a dashboard from which multiple different "sub-activities" can be started and done. I am wondering what is the best way to structure the app. One way is to have different layouts and load and unload them appropriately. The other is to start new activities using intents. At least this is what I have gathered from what I have read.
View 3 Replies
View Related
Oct 10, 2010
Let's say I have MyActivity and inside my onCreate method I initialize MyBackgroundView, then MyPlayer1View then MyPlayer2View. I want to be able to touch the screen, figure out if I have touched Player1 or Player2 and then respond with changes to the players if I have touched them.
My problem is, where do I put the onTouchListener? Can only MyBackgroundView listen for touches, or can the players listen for touches too? If MyBackgroundView can only accept touches, do I need to call view.ontouchlistener that says, you have touched me, and I have a player at those coordinates, so I'll pass the motion event to the player and let it handle it? Or do call view.ontouchlistener in each of the players that says, you've touched me, now I will react to the motion event?
View 1 Replies
View Related
Jun 11, 2010
In the Supporting Multiple Screens document in the Android Dev Guide, some example screen configurations are given. One of them states that the small-ldpi designation is given to QVGA (240x320) screens with a physical size of 2.6"-3.0". According to this DPI calculator, a 2.8" QVGA display equates to 143 dpi. However, further down the page the document explicitly states that all screens over 140 dpi are considered "medium" density.
So which is it, ldpi or mdpi? Is this a mistake? Does anyone know what the HTC Tattoo or similar device actually reports? I don't have access to any devices like this.
Also, with the recent publishing of this document, I'm glad to see we finally have an explicit statement of the exact DPI ranges of the three density categories. But why haven't we been given the same for the small, medium, and large screen size categories? I'd like to know the exact ranges for all these.
View 1 Replies
View Related
Oct 9, 2009
I am working on an application where I wish to have multiple screens (each of full display size) attached to each other horizontally, and switch between them by using the finger (swipe right / swipe left). The home screen does exactly what I want, but its implementation seems to be more complex than I thought. What would be your preferred way to achieve this functionality? Is there any Layout or View that I could reuse? More generally, it should work with the 1.5 SDK, so the gesture interface is not available.
View 3 Replies
View Related
Oct 29, 2010
Could it be possible to make each screen have a different wallpaper while scrolling? I mean, taking as an example a case with three screens, it will be necessary to set a x3 screen width wallpaper to fit 1/3 on each screen, or directly setting different images for each screen. so the scrolling make it visually a different wallpaper on each screen rather than sliding the wallpaper a 50% each side.
View 2 Replies
View Related
May 27, 2009
I want to create a listview with rows that have an image and two textviews. This must be a very common activity but I can't find a class/or source code that does this.
View 9 Replies
View Related
Nov 7, 2010
Basically what I am trying to accomplish is I want a canvas I can pass bitmaps to, to be displayed on the screen with the rest of my view objects (buttons, textviews, etc).
View 1 Replies
View Related
Nov 10, 2010
First off, sorry if this is too subjective, I just didnt know how else/where to ask.Anyway, in the light of all my recent questions, I'm getting ready to release an Android app soon, and most of the testing has been done on my phone, the Droid. I really dont have the money to test on "multiple" devices, nor do I know anyone with an older phone that I could ask for help that would possibly get any kind of bug. Not to mention, when I do get a bug report, how would I go about fixing it for that particular phone without having to buy it to make sure it actually gets fixed, or that the person didnt just came across a one-time freakish accident of a glitch?
View 4 Replies
View Related
Jun 9, 2010
I have read the topic about supporting multiple screen size as well as different DPI. I am wondering which of the following way is better in supporting multiple screens:
1. Have different layout for different screen size (stretch the images)
2. Have different set of graphics for different screen (use the same layout)
3. Have different set of graphics and different set of layout for each of the screen
Which way is the easiest? And which way is the most optical way to design? Or is there another better way?
View 2 Replies
View Related
Nov 11, 2010
I am trying to develop an application for which I want multiple screen support. I have read the Android article on Best practices for Multiple Screen Support. As per the article we have to follow 3 important things
1. Mention support for different screen sizes(large, medium and small) and any density in AndroidManifest.xml.
2. Place images of 3 dpi's (120, 160, 240) in 3 folders res/ldpi, res/mdpi and res/hdpi.
3. In layout's the dimension should be mentioned in "dip" units. Then Android will take care of the scaling on its own.
I have implemented all these points in my project. The images are picked up correctly from the appropriate folders. But the arrangements of the controls in not same.
e.g. I ran the app on three emulators
1. Resolution 240*320 dpi 120.
2. Resolution 240*320 dpi 160.
3. Resolution 240*320 dpi 240.
(All the emulator have same resolution but different density.)
The problem is the position of the controls is not same on all the three emulator. As per my understanding if the android:layout_marginLeft and android:layout_marginTop are mentioned in "dip" then this problem should not occur. As the density of the emulator increases the controls get placed more towards the right. Is it absolutely necessary that I provide layouts for all combination's of screen dimension and density even if the layout is same for all the devices?
Images:
https://docs.google.com/leaf?id=0By3GYC3k5AMDNzUwNjkwMWEtOGQzZC00MjQ0LWE2OTgtYjFhYzZmM2ExOGVl&hl=en&authkey=CLOEsZsI
View 1 Replies
View Related
Jul 25, 2010
I've read the article "Supporting Multiple Screen" on Android developers site. But that doesn't apply to game logic.Let me get straight to the point. My situation is as follows:
- I'm creating a game using LunarLander code as a base.
- In my game, there'll be an object flying up from the bottom of the screen. The object will fly in projectile motion.
- I set the starting velocity, gravity and angle so that the highest point(of projectile motion) is almost at the top of the screen.
- The screen tested is Motorola Milestone. (480x854 resolution) Meaning the object travels around 854 pixels vertically.
I'm thinking of adjusting starting velocity based on screensizes. But that sounds unreliable when we've so many devices/resolutions out there. How do you combat these kind of problem when making games?
View 3 Replies
View Related
Aug 6, 2010
I have read the Android UI trick 2 on Android developers, which tells people how to include a layout in another layout file multiple times, and give these included layouts different id. However, the sample here is overwriting the layout id, not the id of the views IN this layout. For example, if the workspace_screen.xml looks like this: And I include it three times in another layout file. Do I end up with three TextViews with id firstText, and another three with secondText? Isn't there an id collision? And how do I find the secondText TextView in the third included layout with findViewById? What should I input in the findViewById method?
View 1 Replies
View Related