Animate newly added items to my listview? - java

I have a adapter that displays the SMS / MMS messages on the phone. I am trying to animate a new message being either sent or received. Instead of the message item just appearing in the list I want to animate a new message into the listview. Here is a video of something similar to what I am wanting to accomplish
Listview Animation Video
I know that I could apply the animation into the getView() method of the adapter, but I want to only animate the new messages. Anyone know of a possible way for me to do this? Thanks!

You can do that using Layout Transitions. This link also may help you.
But this class is available only on API Level 11+, so if you want to provide compatibility to earlier android API Levels, you have to try something different.

Related

Display different ui on TV screen when connect with screen casting with android app in android studio?

I want to show a different UI when the app is casting a screen with a TV in android studio.
I tried a lot but haven't succeeded yet. Please help me to sort out this problem.
It's a bit late but I'd be happy to help you.
First you must create a new file in the layout directory, for example: custom_cast_ui.xml.
In your activity you need to call custom_cast_ui.xml like this: setContentView(R.layout.custom_cast_ui);
If you need to call elements like ImageView, you can do it as normal, because the new layout has already been set. Like this: ImageView imageView = findViewById(R.id.img_example);

Recyclerview in a recyclerview activity

using firebase-ui and some coding I have set up my code to work like this:
1) it retrieves data from firebase (image, text and so on), then it passes them to another activity.
2) the new activity receives datas like strings and shows them.
Just to give you an idea I am looking forward to building a streaming app. What I want to do is to show an episode list via recyclerview.
What I am doing right now is a nested scroll view and a copy-paste script to pass up to 26 episodes, but this is not a really good method and I would like to have some suggestions in order to go forward in the best way and solve this problem.
this is a screenshot of the app: https://imgur.com/a/vgBnZTA I am just passing strings to the 2nd activity, then i check if it is not a null string, if it is i hide the layout, otherwise it shows, but it is just a copypaste of code. I hope i was clear enough
Thanks everyone for your support

scroll view for widget

I'm making a widget that contains values from a feed that is pulled from a mysql database. (fortunatley this is not a problem)
My problem is that I need a scrollview within the widget so that the content can be viewed.
Does Anyone know how I can do this? I know I can't have a scrollview in a widget but need an alternative so that content can be scrolled.
Any help would be appreciated
On Android 3.0 and higher, use a ListView, StackView, etc.
On earlier versions of Android, you cannot scroll, period. All you can do is provide a couple of buttons to rotate the contents of the app widget through your data set.

View different images depending on what item in my list view I click

I'm fairly new to Android programming and I've got this project I need to finish and I'm currently stuck.
I've got a standard listview in a Menu class with an array containing around 20 different elements. So what I want to do is load images in an imageview depending on which item in the listview I click, and since I'm a beginner the only idea I had was to make a new activity for each imageview which seems like a pretty bad way to do it since I'd need about 20-30 new activities..
To sum things up what I want is:
Code for making ONE activity that will display a different image depending on which item in the listview I click, probably pretty basic coding I want as simple solution as possible.
If possible I'm also looking for a solution that includes an SQLite database that stores the URL of an image and then display it in a single activity, also depending on which item I press in my current listview.
(I hope you understand my needs, and if you need I can also post my current code for the Menu class if it helps you help me) Or you can just show me a different way to make this work, I appreciate every answer! Thanks in advance!
NOTE
And please keep in mind, I'm a noob at Java and Android so keep it rather simple or at least explain what you do.
When you click on a list item, display the image in another view in the same layout, unless you want the image to take up the entire screen real estate. If you want it in the entire screen, go to a new Activity by sending the activity an Intent.
Activities are the "controller" of your application. They interact with the visible UI and the input from the user. You don't need a separate activity for each image, just an activity that's associated with a "place" in the UI (an ImageView) where you'll display the image.
I'd start by adding the images as resources under res/drawable before going on to databases.
You are going to have to do most of this yourself. There really isn't any substitute for taking the time to learn Java and Android. There are several tutorials and Android University classes under the Resources tab in the Developers Guide; I suggest you do all of them.

Android layout in java code

i'm making an app that requires indefinite textviews and images. i'm trying to implement a Pulse News app UI but having a hard time implementing one. so i thought of an idea to make a UI like that with the use of textviews, imageview and horizontal scroll view.
textview string values are from parsed xml online and images or the imageviews will be images from a specific directory in the sdcard that my app is using.
can anyone give me ideas how can i do it without using an xml layout or is there any or other options or ways for doing this? thanks...
You can create a viewgroup with one textview and an image. Then it can be added dynamically to your layout many times. This can be done by creating objects in a loop. You can change the content in each viewgroup at the time of inflation.
though i dont know what exactly how pulse new app looks like, but by going through your question (horizontal scroll view in particular) I guess you want to implement a "Gallery" type implementation where in you can swipe left/right on page basis.
If my assumption is correct then you will like to see to ViewPager of android backward compatiblity pkg.

Categories