Android :: Application With Multiple Views - Best Practice For Structure?
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
Jul 22, 2010
I'm trying to structure a URI that accesses my data by id. Currently my URIs are query based like so: How could I structure a similar URI so that I could query for notes in multiple lists?
View 2 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
Apr 8, 2010
I am still learning bu find Android the cool platform for allot of useful applications. I have written a Service for doing GPS tracking and it consists of a Service and a Control activity to manage, monitor and configure the service. I am looking for the preferred way for the Control Activity to define settings for the Service, things like IP address and Update interval. I envision something like a Registry on windows where these settings can be shares and updated.
View 9 Replies
View Related
Apr 19, 2009
What is the best way to release two versions of an application? E.g. a free version with limited features, and a paid version with the full feature set. #ifdef would be the ideal way to do this, but Java doesn't support it. Could I do something like: try {import com.foo.myapplication.ExtraFeatures; } catch (Exception e) { // ignore it, this must be the free version}? I could manage with this kind of construct, although #ifdef really would be ideal.
View 10 Replies
View Related
Mar 9, 2010
I'm having troubles with users that report that if they leave the application opened and after a few hours when they return to it the app crashes. I'm pretty sure it is because I'm not storing/restoring the status correctly when my process is killed by the system, but I would like to be able to test it in a repeatable way. Which is the best way to simulate the same behavior that happens when Android kills my process on low memory conditions?
View 4 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
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
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
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
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
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
Sep 27, 2009
I need a LinearLayout to contain 3 TableLayouts, and I can't get it to work. This is where the problem is I'm sure:
mTableLayout.addView(mLinearLayout, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); mLinearLayout.addView(nTableLayout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); mLinearLayout.addView(oTableLayout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); mLinearLayout.addView(pTableLayout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
How Do I make this work? I can get it to work just find when I only add a single child view, but when I have multiple children view objects my app crashes.
View 6 Replies
View Related
Sep 10, 2010
I want to build a data structure in my application to store many entries indexed by keys. Each entry has several parameters to retrieve and update.
View 2 Replies
View Related
Oct 27, 2010
In my application, I am going to create a few listviews that are dependent on the listview before it. For example,Then, depending on user choice, will go next screen, let's say, it contains a submenu of each type of school,that may be different or may be the same to other states.What I want to know, is how to populate these different lists dynamically as the user goes on? I don't know what the best of doing this is, and I seem to be looking in the all the wrong places because I keep getting stuck. Once all the data is added into whatever structure is used, it will be static. I basically just need help as to how to code information into some sort of hashtable or anything of the sort that can be easily referenced, and later when the Application is updated, be able to add more schools/states/submenus etc.
View 1 Replies
View Related
Jun 11, 2013
I am using a linear layout to draw a scalable background in my app. I am then defining multiple imageviews inside the linear layout, all of which are PNGs containing a transparency layer. I am wanting to overlay these transparent imageviews on top of the background. My issue is that only the first defined imageview shows on top of the background, any subsequent imageviews do not appear.
CODE: Note that imgSen1 appears properly with transparency overlaid on the background. imgSen2 does not appear. If I define imgSen2 first, and imgSen1 second, imgSen2 then appears properly, as if only the first defined imageview can be seen. I would like to have multiple imageviews with transparency overlaying the background.
<LinearLayout
android:layout_width="627dp"
android:layout_height="436dp"[code]...
View 1 Replies
View Related
Jan 6, 2010
I have a simple ListView and on that ListView I have placed a number of custom defined Views. The CustomView has ImageView and two TextViews.
The CustomView also has a "stateful drawable" as background, so that the background image (a 9-patch) changes if you press the Row in the ListView. When pressing the Row, the background image changes to a Red-ish thing.
The problem is that when the background changes from the default greyish, all the Views in the CustomView (ImageView and TextViews) still have their greyish background and thus creates very ugly greay boxes on top of the now redish background.
What is the best way to solve that problem? I hoped that such things were handled automatically (as it is done in for example .NET), but I was wrong it seems.
View 1 Replies
View Related
May 6, 2013
I created an android application project and have dug through the code and It is unclear how I'm going to set separate views for each list item. The original code is as follows
Code:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_item_detail, container, false);
[code]...
On reviewing this code it is clear that the view hasn't been changed, only the content has been changed from the dummy item. I would prefer to have each dummyItem have its own view, layout, etc.The code for establishing these views are in the dummy content
Code:
static {
// Add 3 sample items.
addItem(new DummyItem("1", "Live"));
addItem(new DummyItem("2", "Settings"));
addItem(new DummyItem("3", "About"));
}
What I would like to do would be more like the following where each item would have its own view and layout.
Code:
static {
// Add 3 sample items.
addItem(new LiveDummyItem("1", "Live"));
addItem(new SettingsDummyItem("2", "Settings"));
addItem(new AboutDummyItem("3", "About"));
}
I thought there may be some type of container I can use to swap views in and out or possibly that I may be able to grab a view from the dummy item itself.
View 2 Replies
View Related
Nov 16, 2010
I am implementing a music player application in Android. My play list selection screen is implemented as a tab selector widget which contains a ListActivity inside each of the tabs: Artist, Albums, Songs.
I want to update the ListView in each of the ListActivity when I delete an item from any of the lists.
i.e. When I long press an item in the Artists list a context menu is drawn with "Delete Artist"
And it should delete all the songs from this artist in the Songs ListView, delete all the albums by this artist in the Albums ListView, and finally delete the entry for the artist in the Artist ListView.
Each of the ListActivity has its own fillData() method, which updates the ListView when the button in the context menu is pressed.
How can I call the fillData() method of the Albums ListActivity after I update the ListView inside of the Artists ListActivity?
View 1 Replies
View Related
Feb 28, 2010
I want to populate a table, defined in layout xml file through the programmatic way. I have define Table with a single row defining its header, with all the attributes set. Now i want to know a way so that i can just replicate that header row in the table with new content.
I tried using inflator inflate(int,view) method, but at runtime it showed up with error.
Here is the XML code for the layout file defining the table
CODE:.................
View 1 Replies
View Related
Mar 6, 2010
I have the following XML code:.................
The idea is to change the views, whenever I press one of the radio buttons. When I press a button the first time everything works out fine, but the second time I press a button, I get an IllegalStateException, and I can't quite see why I'm getting this.
Also, the Activity seems to set all my global variables to null, which is why I have to create them every time I switch from portrait to landscape or vice versa. So I would like to know if there is a way I can save my views in the Bundle, or any other way in which I can permanently save my views, so I don't have to add or create them every time, I flip the phone. And whenever I flip the phone, it seems that it rereads the main XML file, causing the RadioGroup to be set to 2D even if the 3D button is checked. This is because I've said the 2D button to be checked from when the app is first created, but I would like to also save the state of that RadioGroup.
View 5 Replies
View Related
Jun 16, 2010
How do you align views relative to the "middle" part of another view? I think it is best explained with a pic of the UI I'm trying to create in android.
View 2 Replies
View Related