New list of top digital marketing companies in Kolkataby Simran Aggarwal your beauty our passion Now let's see how we can direct our user to the other activities when they click on one of the items here. OK. So that's the one thing to do for one this show the details to the user. So how do we do it? We add something called on digital marketing company item click listener if you show type list we've added on item click listener and this will be equal to something and then something is up to view dot. And when you see it it will show you some options and you want one with the code block and Adapter. You teach your lawn and everything.
So choose this one and hit enter on each of these inputs you. So one thing to pay attention here is that these I hear this I will do an index top digital marketing companies in Kolkata of the clicked item. So we will know which item the user clicked by looking. DS I hear. OK. So within this block, we can just write whatever we want it to happen when a user clicks on item k.
Digital Marketing Agency services
So if they click on Pisa classroom a file or a London Bridge we will know by the I variable if they click on Pisa I will be zero if they click on Colosseum I will be one if they click on a file I will be too. And if they click on London Bridge I will be a treat. OK. So we will use these.
So I will create an intent First of all because I want to take the top digital marketing companies in Kolkata user to the other activity right. So how do we create the Internet? We use application contacts and we just say details activity. Collin Cullen cluster job so we can say start activity and start intent right. So it will take the user to detail activity and we want to transmit some information to the detail activity right. So how do we do it? Intent that put extra.
- So do one thing to pass to direct to ease the name. So how do I reach the name? I will say landmark names and in which index I want to pass this info. I write so I give me the index of my users chosen landmark and it will be the same in the landmark names.
- If a user chooses the first one the index will be top digital marketing companies in Kolkata zero and it will just take me to the pizza. So how do I retrieved is in here. App detail activity. I create a name and say intent. Gets tiring extra name your ID know how to use this right. So tax-free you up tax will be now equal to name.
- So since we have already done this before I think you know how to create and pass Imphal and retrieve the info. But you will have learned how to work with lists we use and in Texas. So if I click on a piece here I see pizza by click on the class you here I see the classroom and the same thing for a file and sending it for London Bridge.
Advantages of Digital MarketingBut I think our text field is not big enough so that I think we should make it bigger so that everything will look fine. So we are done with passing info between activities but not completely because we have one thing left to do this is to pass the image and let's do that in the next lecture. In the lecture, we're going to top digital marketing companies in Kolkata transmit the image info from one activity to another and it's not easy as transferring the stream. OK so we can actually say intent that put extra and tries to transferred image with putting extra but since images are bigger objects don't tax than strings it will most probably not work or slow down our application show in Android.
- We don't use this kind of thing to pass the image is what we use is actually a global object or a global variable. So if you come from Java you know you have static things in Java where you can reach from both activities. I won't show you how to do that for at least for now but I will show you how to create a global class and use DOS class to transfer our beach files.
- The big image is to create and need coupling class and I will call these Globals. OK so it will work as a global variable for us and so we can change this variable and use it within multiple activities. OK, so how do we do it. If I create do some top digital marketing companies in Kolkata variable here like and bitmap like let's call this chosen image OK.
- And actually, let's make this a bitmap malleable and not initialize but just initialize it with no. OK so if I go here to the main activity and before I start my activity for I start my intent I can say while global.
And this will be a global object a global dot chosen image will be equal to my chosen image but this won't work because you divide because I create an object here and if I do the same thing in the details activity it means that I'm creating another object. And those two objects have not accessed to each other have not do not have the same attributes. So we use top digital marketing companies in Kolkata something called companion object in order to solve this problem. OK. So within this companion object, we will create another kind of class and we will use this companion object to solve the problem that I was telling you about. So I just take this chosen image inside my companion object and let us call my companion object chosen. So within this companion object, I have only one variable and this is chosen an image. And let's actually create a function within this companion object which is a return image function and will return a bitmap.
Created on May 25th 2019 06:54. Viewed 780 times.
No comment, be the first to comment.