I'm new into android development, and at this stage I try to mimic some functionalities from other apps (please consider the image from bellow).
For example, there is one app o google play which gives details about all the sensors from a device. I know how to read the values from any sensor and how to get a list of all the sensors, but I don't know how to take all the values from all the sensors and to display them in real time.
Are there some good practices or design patterns which can help me achieve the real-time values in an elegant manner?
if you want to design this you have to use fragment on main activity then you have to use viewpager and tabhost to swipe tab and then you have to use recycler view or list view to display data then u have to use censer data try any one censer then u will get deep onto in censer its easy library .first you design this.
Related
I would like to display some information from a Firebase database on the screen of my Nest Hub.
Let's say I want to scroll through 10 items and display their details every 5s.
If I am not wrong, I am tied to only 2 possibilities
Assistant Actions
I read the doc and made some POC, but it seems overcompliacted, I have to create a project, that I cannot deploy publicly, create a Firebase function to create the webhook, and I don't really have complex Assistant commands to send, so it seems overcomplicated at first sight.
=> Maybe I missed a way to make that simple?
Cast SDK
As an Android dev familiar with Java and now Kotlin, this seems easier, but as far as I understand, I can only cast Media to the Nest. Should I then create a layout with all my info, turn them to image files, and finally create a slideshow for the Nest Hub?
Thanks for any advise
Part of this answer depends on your use-case. Creating an Action via Actions Builder would give you a fair amount of flexibility over the interaction model, as it will support voice commands and you'd be able to trigger it directly from the device ("Talk to X").
Creating something via Cast may be easier, as you're just projecting content (a webview). While easier, you'd need to be able to start it from another device and can't control it with voice. Control can be done through the casting device.
Based on the use-case you've given, as a passive display, I would suggest going with the Cast SDK. You can look at implementing a custom web receiver to manage your web app.
My Android app has a recyclerView of 1500-1700 items in the forms of cards, each card representing some textual data. Each card has certain tags on them [for example] #2016 #India #blue #music etc. Cards can have multiple tags.
I want to add a tag based search to this recyclerView. For example, when "2016 music" is searched, it should only show that cards that has both these tags, "2016" and "music".
All I can think of is, whenever a tag is added to the search bar, I go through all the items and remove all those cards that doesn't have that following tag. But Scanning 1500 items every time a tag is added to the search bar must consume a lot of time.
What would be the optimum way to implement a tag based search in recyclerViews with too many items?
All I can think of is, whenever a tag is added to the search bar, I go through all the items and remove all those cards that doesn't have that following tag
That is definitely a bad approach. The ideal way is to update the adapter. ie when user searches for a TAG , use Loader to retrieve data from your content provider, and update the adater's data and invoke notifyDataSetChanged().
Now there are other aspects to this question, like what data storage options to use for the fastest way, eg(mysql,realm,etc). Which you should choose according to your data size and other factors, which should be asked as a different question if you do not find much info after research(chances are scarce).
TIP
When building projects like these, it would be a best practice to follow an architecture, preferably MVC or MVP, which would make development and debugging easy, also would make the data flow perfect.
Links with further info on MVC and MVP is provided below.Choose which suits best for your requirement. Hope it helps.
Model View Controller pattern
MVP architecture in Android
Writing better Android apps with MVP
Android Application Architecture
What is the intuition behind views and adapters in Android, that means from where did the person who made this concept get the thought process necessary to create these elements? To elaborate, the concept of circle originated from nature, moon sun such celestial bodies, like wise what is the intuition behind using listview and adapters?
As you probably already know, using ListView (and more recently, RecyclerView) on Android requires the use of an Adapter to get the data from the data source and turn it into something displayable which can then then be shown in the list.
So why did the engineers at Google implement ListView and the backing Adapters the way they did ?
It essentially comes to a few things:
Performance:
Imagine you have 1000 contacts, each with a picture and various pieces of information. You want it to work well, load quickly, and scroll smoothly. The naive way of doing this might be to create a scrollable layout to hold the contacts list, and then simply add a sub-layout for each contact. Unfortunately, this will fail all three requirements: It won't work well, as there won't be enough memory (ram) for all those contacts and especially the associated pictures, and the app will run out of memory and crash; It won't load quickly, as all the contacts and the contact pictures have to be loaded into memory before the list can be shown, which will take a long time; And it won't scroll smoothly because you don't have all of the advanced caching, pre-rendering, and bitmap texture caching that ListView and the adapter does. Use a ListView and an Adapter, and it solves all these problems for you.
Adaptability and ease of use for developers: ListView and Adapters are used for lots of different things, from contacts lists all the way to to complex pages with different answers, comments, and tons of other information in the Stack Exchange Android app. Adapters make working with data from different sources easy: there's a single, common API, which can be used and extended to display any kind of data, much more easily than if every developer had to implement their own solution. Want to load more data when the user has scrolled to the bottom of your list ? Sure, it's easy. Want to have different kinds of items in your list ? Sure, It's really easy.
So, did Google and the Android developers and engineers invent this idea of using adapters ? No.
In fact almost every system or environment which involves showing a list of items uses something similar: The actual list of items, an Adapter behind it, to transform the data and make it displayable, and then the actual data source, which can be anything which gives a list of items, from a database to a web service. It's essentially this: data source > adapter > list where it's displayed. This kind of pattern is used in desktop Windows applications, on iOS, web applications, so the Google engineers took this concept and adapted it to Android.
That's why ListView and Adapters work (and are used) the way they do.
PS: here's a Google IO video by the Google engineers on how to use ListView and Adapters correctly, and a little bit on how they work under the hood: http://youtube.com/watch?v=wDBM6wVEO70.
i want to create a chat app using flex 4.5 mobile project for android device. For the chat screen, i wanted it to look glossy and stylish. Hence i thought i would use the list component and disable the selection in it. I m able to add the chat messages into the list. But i doubt if large chat data might hinder the performance. Im using a collection and i ve binded it with the list. Whenever i receive a chat i update the collection and it gets displayed in the list. Can someone tell me if his could pose a performance problem as list component is not intended for this purpose.
Thanks..
Why wouldn't a list be intended for this purpose? I'd say a List is the exact component to use for this kind of task. I don't see any performance issues unless you're doing something wrong with the eventListeners or your ItemRenderer. For best performance, use an AS only renderer.
However, as memory is always a concern on mobile devices, you might wanna consider limiting the amount of items in the list, say 100 or so. You likely won't get back to the beginning of the list (your conversation) anyway.
I have a project which will be a portal to book a conference room. It will be a private app that will be run on a cheap tablet and mounted in the conference room. The app will just update a webserver backend.
I would like to implement a UI that is essentially a grid. The day of the week will be on the x axis and the hours on the y axis. If a particular time has already been books a different color will show. To book the room you press on the cell that corresponds to the day and time you would like and asks to confirm this.
I have played around with a grid view and table layout and can't find anything that fits the bill so suggestions are most welcome.
I have not used openGL yet would this be a good opportunity to learn about it?
There are many ways you could accomplish a layout like that. Personally I am a fan of using RelativeLayouts. They usually tend to require a little bit more to get setup looking how you want. But it is far easier down the line if you decide you want to make any non-trivial changes to the layout. openGL would allow you to do this, but I think you are better off using the layouts and views provided already. At the very most maybe you'll want to create your own subclass of View that fits your needs see Creating Custom Views if you want more info on that.