Working With ListViews in Android Development Putting up a list of elements that people can see and work with is a very common tactic when working on mobile applications. It is something that developers are called upon to do all the time, and it is a good thing we have them working on these things because otherwise the apps that we all use on a regular basis simply wouldn't hold up to the workout that we put them through when using them. That is to say that they wouldn't look nearly as good as we are used to them looking at this point. Most developers will look at ListView in Android at some point in their developing career. It is a typical thing for developers to do, and you might as well get used to using this application if you intend on working in the field for very long. It will come to be expected of you. A Full View Of Information A primary reason to use ListViewer when developing a new app is simply to allow users of that app to see everything that they need to see as they are scrolling through it. They may want to spend some extra time on certain elements of what you have created, and that is all possible when you provide them with the list or "table of contents" for your application. You may be surprised to learn just how much people appreciate this and how much it truly benefits them. Funny as it might sound, these are the types of things that make a difference in the lives of people who are just trying to figure out what kind of apps they will use. The ListViewer app allows developers to provide their users with precisely what they are looking for as far as the information they need to access right when they need to access it. No more hunting around trying to find a specific aspect of the app that you are currently using. It is all right there when the developer has taken the time to use ListViewer to make it easier to scan. Accessibility is the Name of the Game Have you ever used an app that you weren't quite sure how to find everything in? There are many people who have put themselves in this unfortunate predicament before, and the results can be devastating. That is to say that they are not app with the outcome because they end up getting lost in the maze of the app and are unable to truly enjoy its benefits. Creating lists within the app makes it a lot easier for anyone to take a look at what is going on within the app and try to figure out which steps they need to take next to get to the information that they actually desire. As you might imagine, this is a very big deal when working with apps that contain valuable information within them. If you are working with something like that, then you definitely want to get to the root of what you are looking for right away. The ability for users to discover what they are looking for always begins at the development stage. When developers are working to create apps that people will actually use, they need to think carefully about the way that the average user is likely to approach the app. How is that user going to view the material that is accessible in the app, and where are they most likely to click? Those are the type of questions that developers should always ask themselves if they are serious about creating something that is going to stand the test of time. A post with code in it. Because it’s been a long time since the last one. If you work with ListViews in Android, as all Android developers will do at some point, you may notice that if you set your list items to be non-selectable the dividers that are drawn between each cell disappear. In the Holo Light theme you would normally get a thin light gray dividing line between cells. Depending on how you’ve implemented your adapter, you may find that these dividers become white/transparent when the cells are not selectable. According to Android framework engineer Romain Guy, this is the intended behavior. As Haythem Souissi points out in this Stack Overflow answer, you can work around this by ensuring that the areAllItemsEnabled method returns true, even though all items are not enabled (maybe none of them are). The isEnabled method will take care of actually disabling the cells and the dividers will be drawn between each of them. All very straightforward so far but it all goes wrong again when you try to add a non-selectable header view to the list. The way that ListView deals with headers and footers is that it creates its own adapter to wrap/decorate yours and insert the header/footer views in the appropriate places. This is fine but it’s not delegating the areAllItemsEnabled method, so our above fix no longer works. Fortunately, and unusually for Android, everything we need to resolve this issue is part of the public API. The adapter decorator class is android.widget.HeaderViewListAdapter. We just need to create our own instance, wrapping our own adapter, and override areAllItemsEnabled as above. There’s a slight complication in that we have to wrap the header view in an instance of ListView.FixedViewInfo and this is a non-static inner class of ListView, but we can reach into our bag of obscure Java tricks to create an instance from outside the enclosing class. // I assume you know how get a reference to the ListView and create your own adapter. ListView listView = (ListView) view.findViewById(android.R.id.list); CustomAdapter adapter = new CustomAdapter(context, listOfItems); // You can create any view you like for the header. TextView listHeader = (TextView) inflater.inflate(R.layout.list_header, null); listHeader.setText("My Header Text"); // This is how you create an instance of the non-static nested class, providing // it with a reference to an instance of the containing class (ListView). ListView.FixedViewInfo headerInfo = listView.new FixedViewInfo(); headerInfo.view = listHeader; headerInfo.isSelectable = false; // HeaderViewListAdapter insists on concrete ArrayLists. ArrayList headers = new ArrayList(1); headerInfoList.add(headerInfo); ArrayList footers = new ArrayList(0); HeaderViewListAdapter wrapper = new HeaderViewListAdapter(headers, footers, adapter) { @Override public boolean areAllItemsEnabled() { return true; } }; listView.setAdapter(wrapper); Create Something Unique for Android? Here is another thing that people sometimes forget about. They may want to consider creating something unique for the Android system. There are plenty of Android users out there, and it is a great platform on which to launch your application to get it started. If you discover that the ListViewer and every other piece of code you have placed into your app works out well on the Android platform, then there is a good chance that it will do great on other platforms as well. Thus, you may bring it over to those other platforms after you have given it a chance on the Android system. See what Android users love and hate about what you have created, and then fix the problems and move on to the next challenge. You may find that you have created something that users truly love and that you can market to other users on different operating devices (such as Apple iOS). The best thing to do is to figure out the issues that you may need to clean up while putting your material out to a large audience. The Android platform is a large enough audience that you should be in great shape if you begin there. They are also helpful in that they will provide you with the feedback that you may need to make your app just right. Don't Create Too Many Lists Finally, we leave you with the reminder that you shouldn't create too many lists within your app. Yes, you want people to come and check out what you are all about, but you do not want to give them the impression that they have to continue to click through sub-list after sub-list just to get to the materials that they are actually attempting to view. If you put them in a position like that, then they may feel that you are making things too challenging for them, and this is likely to upset some users. Get away from that by only using lists when they are truly necessary within your app. Otherwise, try to cut them out and keep a clean and crisp look to what you have created. At the end of the day, users want two things. The first is that they want an app that can help them solve whatever issue your app seeks to solve. The second is an app that has a user-friendly and clean look to it. You can give them both of those things if you just work with what you have created to make it as smooth and seamless as possible. It is not as challenging as you may at first believe. Give it a try, and discover a whole new world of possibilities.
Bringing Together Various Components There are situations in which it may be to the benefit of a programmer or other computer user to look at bringing together native components of a system with swing components. These are components that they have either created on their own accord or components that they have brought over from another service. Either way, combining the native components that already exist in a system with swing components is a great way to achieve some surprising results. You might want to think about giving this a try if you are thinking about how you can bring your talents up to date for use in the world as it is today. DJ Native Swing is a nice solution to embed native components (Web Browser, Flash Player, etc.). There was still a general issue that this library did not resolve though: the possibility to mix heavyweight and lightweight components with lightweight components on top, to change their Z-order or re-parent them. Fortunately, The release 0.9.3 offers interesting advances in this area. Using these features is as simple as changing some options before instantiating native components, in order to extend their behavior. You can try all the features (including the new options) with the Webstart Demo: http://djproject.sourceforge.net/ns/DJNativeSwingDemo.jnlp The Webstart demo is configured to work on Windows. It also works on Linux (GTK, x86/i386) where XULRunner is installed. Note that this demo is part of the release package. Run Tests on Every Component It is a good idea to run a demo of any components that you think you might want to put together. The reason for this is that you need to make sure those components will work for you as you anticipate that they will. This is far from a guarantee, and that is why you are called upon to pay careful attention to the things that you are running through these systems. It is entirely possible that you might find some errors that you made along the way when you are checking out the system to see where you went wrong. There is nothing bad about looking over something and realizing that you still have some room to grow and figure things out. As a matter of fact, this is a great way to grow as a person and as a programmer. You cannot begin to take steps in the right direction if you don't figure out where you can improve upon the decisions that you have made before. In my opinion, this gets us one step closer to proper native integration. What do you think? Have you got any comments or suggestions? Mixing Things Up for a New Creation Believe it or not, one of the best things that you can do to mix things up and keep your creations fresh is to look at how you can combine native components with the swing components that you bring into the system. It is a way for you to show the people who will ultimately use your creations that you are serious about making something that they stand to benefit from. If that is the kind of thing that you are into, then you need to give it a try right now. After all, there may be a tremendous number of people just waiting to see what you are all about and what you can offer to them. If you provide them with things to get excited about, then they will keep coming back for more. -Christopher
Zero trust could be the solution for your modern security perils. Read on to discover what zero trust and least privilege are — and how to get started.
Overprovisioned Kubernetes workloads are a growing concern for developer teams, particularly as budget efficiency becomes more important. This article walks through an open source way to avoid overprovisioning Kubernetes workloads with a single click.
Follow a brief explanation of CI/CD and how to implement caching of Maven dependencies in the pipelines while deploying your Mule application to CloudHub.
This blog post will help you get quickly started with DynamoDB Streams and AWS Lambda using Go. It will cover how to deploy the entire solution using AWS CDK.
Custom Resources in AWS CDK are powerful and give you much flexibility. You can leverage the Provider framework when you need more than a single API call.
Microservice applications can run in many ways, with different tradeoffs and cost structures. Let’s go over the 5 main ways we can deploy microservices.
There has been a surge of recent interest in a data infrastructure that is designed to take maximum advantage of the benefits that cloud computing provides.