Segmented Control in Android - android

We all know segmented control that is IOS but not in android. So I have an application that need something like that. For example let suppose I have a list of students and teacher marks the student either absent or present. and on click of each option there is a service call . for this I am using a library which is as follows:
compile 'info.hoang8f:android-segmented:1.0.6'
As I told you I have a list of students so in list I have the following case;
Case 1: If the teacher review the attendance the of last day , I fetch a list of students that are either absent or present. So on this , the segmented control that I am using in list fires the onCheckChangedlistener which run the code which is also performing some task , where as I only want to perform the task only when user change the listener. In short listener should not fire when I change any check pragmatically. and Also it fires the onCheckChangedListener multiple times. which creates problem for me :
So I have couple of question:
1) what can be used in android in place of the Segmented control library as I stated above.
2) what is possible workaround for this problem. I tried using flag but I am working in getview of listview.

this is a good library in response to what you achieve. I have used this and found the similar problem. So hence by putting flag , and making a raw check over it does a work for me . But As you are using list, i think you can not achieve what you are looking for.
I will suggest to use the radio button to get the check or you can make your custom control like this and see this library

Related

Search implementation Questions on android

I am a newbie here and hope you can help me out to clear some of my understanding (or misunderstanding). I have been reading for days and trying out based on Android guide to implement search function but it really didn't work out well. Perhaps I've got the whole concept wrong so do help me out here if you can be kind.
I have an app which data is from remote xml and I want to implement search function. I have 1 main activity (under my SRC -> my package)that list all the data retrieved from the xml. My questions:
1) In the guide, it saws we must define a .Searchable Activity. I supposed this is to handle the search query and store the result? If this is a case, do I need to create a new activity or I can use my main activity as .Searchable Activity?
2) After the above item is done, I supposed I need to create an activity to receive the result and do something. I take it as I need to create "public class SearchableActivity extends ListActivity" in the activity I define in item 1? The problem is that I don't know what to do with this as the guide are incomplete.
3) Presumingly I did it successfully and upon search, there are some results return, how do I show (or filter to show the search result) in my main activity? I do not want to have another UI to show the result as I prefer it just get filter to show the matched records
4) Lastly, since my data is from remote xml, do I need to "search" based on remote xml or it will search based on cache info on the app?
I am sorry for being so ignorant but I am totally new here and hope you can help me out. So far I have no problem, getting the dialog shown on my action bar. The only problem is that the search didn't work at all :( upon search, there is just nothing happened.
Thanks very much in advance. Cheers!
For searching in a list you can use built-in functions of android, but if you want a good result you can use your own function. The simplest function is:
for(int i = 0 ; i < arraylisy.size() ; i++)
{
if(arraylist.get(i) == youobject)
return true;
}
return false;
but there are better functions like binary search that you can use.
Now, how to create search activity?
First: create XML file an add a listview in it.
Second: create java file and link xml file to it.
Now use above code to search an object on your list. If in every search you find several items then add them to new listview.
Now create an adapter and send your search list to that.
Finally set your adapter to listview.

Dynamic search results in Android App using SearchView

I'm new to Android development and i would like to make a single activity to show featured results using Youtube API and when a search query is typed, i want to update the same list with search results.
I got stuck in my first step, which is configuring the SearchView and receiving data from it. After adding a SeachView to the layout, i made a reference for it in the Activity java code, then internet documentation went too fuzzy for and i couldn't understand what should i do in my case (dynamic results).
you need to make listView's adapter extend from Filterable, and use its getFilter() function according to the query that is changing in the SearchView, using the function setOnQueryTextListener() .
it's that easy.
i also suggest that you watch the "the world of listView" lecture in case you want to learn some tips about using a listView. they also explain how the filter works.

MvvmCross AutoView dynamic dialog sections

I'm implementing a dialog view, using AutoViews that are available in MVVMCross.AutoView.
Does any one know if it is possible to create dinamic sections. e.g. Something like being able to bind the Elements list of a Section, to a notifiable list in the ViewModel.
What you are looking for is not implemented currently within the Dialog part of AutoViews - just as it's not implemented in the source MonoTouch.Dialog or MonoDroid.Dialog
Adding INotifyCollectionChanged-aware sections to Dialog would definitely be possible, but it would require some skill and time to merge it into the Dialog core code.
If your list (ObservableCollection) is standalone, however - if it doesn't rely on sitting within a larger Dialog - then the list part of AutoViews should work OK for you.
You can see a list AutoView implemented in https://github.com/slodge/MvvmCross/blob/vnext/Sample%20-%20CustomerManagement/CustomerManagement%20-%20AutoViews/CustomerManagement/ViewModels/CustomerListViewModel.cs - this works off of an IObservableCollection and seems to update as you add/remove customers.
Note that AutoViews is still very 'young' - and it'll remain so until we start getting a few more platforms working - there are people working on WP and WinRT Dialog implementations, but these are 'spare time' projects and the people are busy!

Android Graphical UI Builders - Connect event

Maybe this question has been ask already, but could not find any answer for almost 2hours of internet search.
There is a graphical UI designer wich is coming along with the last android SDK.
Looks pretty cool and well done.
Nevertheless I * cannot find how to attach an event to the control through the graphical editor.
Of course I can add it manually into the xml, but in that case, what's the purpose of having such tool without that function ?
I mean all the other SDK I had in other languages always include that function.
I've also not been able to find doc about how to use this tool. Quite sad...
Thanks
If you want to add a click event handler, select the button (widget) in the GUI that you want to listen for, and look for the property onClick. Enter the name of the method you want to call when the user clicks on that widget, like.. onMyButtonClick
Then add the method to your Activity
public void onMyButtonClick(View v) {
// I heard the button click
}
The GUI builder is getting there, and is not yet as easy to use as the one in XCode, but it's not hard when you get used to it.

add item to the settings in android framework

i am working in android frameworks.i want to add an item to the existing settings in the android OS.can u plz tell me how to do this?
First read about PreferenceActivity. These group of classes handle user prefs.
Then depending on your task, do something like this.
In case you want to add a live wallpaper or an input method add android:settingsActivity in your Manifest. (Example : here)
Or follow this tutorial

Categories

Resources