I am a new to android developing. I am developing an android app for a shopping mall...
i want to have a screen where a list is displayed. Name of the mall and its photo should be displayed in the first section with its short one line address...
In the next sections the products should be displayed in the same way....
Product photo, Product Name and its price...
Please suggest me what topics should i read to create such a screen....
could fragments be used to create this screen???
Thanks in advance...
There are many ways. Like you can create a Customized List view for each screen. You can first create an Array List of objects of MallClassPojo. Like:
ArrayList<MallClassPojo> mallList.
Where your MallClassPojo contains the getter setter methods for Mall name,Mall image url or resourceID and short description of mall. Pass this mallList to your adapter class. Retrieve the details and show them in your customised List View. The next screen can be prepared in the same way also.
Well then you can create an Array List of JSON objects. In a JSON Object you can add different data like in one object you can add the company data and in another you can add product data. Isn't it?
Related
i am a novice in android and i was trying to make an application that has two fragments, one with a listView with topics which when one is clicked it opens a topic description in the other fragment. i would like to know how to also store the large string for the description
If the data is dynamic you can store your topics and desciptions in a sqlite database. You have several possibilities:
You load the topic and description at the start and give over the description with a method or an interface to the second fragment.
You store the data in a database and give every entry a unique id and use a method or an interface to communicate with the second fragment and put the id to it. And then you use the id to get the description from database.
UPDATE #1
You can use arrays in your resource files. Create two arrays. One with your topics and the other with your descriptions. But the topics and descriptions have to be in the same order. For example the description of the second topic have to be on the second position in its array. Now you use the first array for your listview and the second(with the descriptions) in the description fragment. The "setOnItemClickListener" method of the listview have the position as a parameter. This is the same as the position of the topics and desciption in your arrays (when you dont resort anything).
I'am using StickyGridHeaders for GridView with sections.
this library is using R.array.countries to populate GridView with provided data and extracting first letter from passed string array to create section heading.
I m trying to pass an ArrayList of objects that will contain ArrayList for sections text named as "sectionArrayList" and "contentArrayListPrivate" and "contentArrayListPublic".
Now i want to play a for loop that will play till < sectionArrayList.size and will check is there any sections then show section text and then show all contents associated with this section by contentArrayListPrivate.size and similar for others but unable to achieve my target.
Can someone please point me towards right direction how to achieve this task ?
want to achive something like:
I downloaded it and checked to solve your problem. so here is solution.
First of all that project is replaced to SuperSlim it is showing on your given link itself, so get superslim.
Then follow the example in that project to achieve it. In that example there is a file named CountryNamesAdapter.java open it, in the 37th line there i found this
final String[] countryNames = context.getResources().getStringArray(R.array.country_names);
which means the data is loaded from Array resource
replace it with
your data - convert your arraylist to string array and assign it like this
final String[] countryNames = myData.
I have a parse object named Card and another called Category. I have 15 categories and gazillions of cards. I want to attach each card to one of the categories but in Parse when I try to set a relationship it redirects me to a screen where I actually have to create another category, but I just wanna choose from the existing ones.
What am I doing wrong?
Answer is simple, should just have used the Pointer type of relationship.
I have a small issue with ArrayList. I have to fetch the document from the server.
The document contains 7 fields of data. I have to show the document names in the list view.
For this I have added different fields data to the different ArrayList. So when I click on the document name, based on the position of the document, I fetched the all fields data from the different Arraylist based on the position.
But Have a small issue using by using the above procedure. Is there any procedure that is not depend on the position, what I want is irrespective of position if I click on the Document,based on the keyword document data to be extract.
Any Help Appreciated.
Thanks in Advance.
I got your point. If you try to manage different ArrayLists then it would be difficult to manage it. I mean if you delete item from particular position from particular ArrayList then you will have to delete items from same position from other ArrayList, if you forgot to do so then it will be unbalanced.
Solution:
Instead feasible solution is to create ArrayList<Object> or ArrayList<HashMap<String,String>>, so your every item is the type of particular object, and every object contains detail and everything of particular items.
For example: ArrayList<Documents>, here ArrayList will contains list of Documents objects, and every objects contains values of 7 fields.
Its simply easy to define Documents class with getter/setter attributes.
I have a doubt. I have 3 array list dynamic values. I need to display these dynamic values in a listview. can someone please tell me how can i achieve this.
I have name[] array, status[] array and image[] array. I need to dynamically display the values in listview in a android sample
This is what i have:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,NameList);
In this i am able to display i am able to display all the names in NameList[].
An array list only accepts an array of values, so as you see, you can only pass in the names. You have two options,
The simple option is to create a compound object, say Person, that has a name, status, and image. Then you create a Person[], and create the array list on that, and pass it into the array adapter. You must implement Person.toString() to print out the Person object as you'd like.
If you need to be able to lay out the Person fields in a more flexible way then you could simply by implementing toString() on Person, you need to create a custom list adapter. You can take a look at this post to get you started,
Categorise the listview