Custom auto complete with progress bar - android

I am trying to create a custom auto complete text view that contains a progress bar (circle in my case).My problem is that every time the user inputs a char a web service is accessed and there is some delay until a display some results.I would like to place a progress circle that will suggest to the user that there is some work in progress.As an excelent example of what i would want you could take a look at googles maps address auto complete.
Thanks for any suggestions.

I think an AutoCompleteTextView is something what you are looking for.
Also, link to a tutorial.
Edit: For the progress bar part, I would have had a infinite progress bar on the title bar of my application. I feel that would be a more complete solution as I can re-use it for any other task also. Something similar is discussed here.

Use the below code for the implementation
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<AutoCompleteTextView
android:id="#+id/lkjk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="3"
android:dropDownHeight="200dp"
android:ems="10"
>
<requestFocus />
</AutoCompleteTextView>
<ProgressBar
android:id="#+id/progress_bar"
android:layout_width="25dip"
android:layout_height="25dip"
android:layout_gravity="right" />
</FrameLayout>

Follow http://developer.android.com/resources/tutorials/views/hello-autocomplete.html think and user Progress bar and u need to Use Handler in this case

Related

How to make dynamic ring progress bar in android?

I want to create circular progress bar that shows progress of file uploading and downloading as whats app shows. I have seen number or libraries available on github. I do know this question has been asked and I have gone through those as well as mentioned in below link.
https://github.com/lzyzsd/CircleProgress
https://stackoverflow.com/questions/37238185/how-to-create-a-circularprogressbar-like-whatsapp-during-image-uploading
But above links refer to library. Is there any way to create circular progress bar without using any library?
In one of the link over stackoverflow I found below code
ObjectAnimator animation = ObjectAnimator.ofInt (progressBar, "progress", 0, 500);
animation.setDuration (5000);
animation.setInterpolator (new DecelerateInterpolator());
But above code does not set progress dynamically. Means that progress bar works for 5 seconds. It is not mandatory that progress bar should always run for 5 seconds. File size can be vary so is progress bar. My question is how Can I make circular progress bar dynamically without using library?
use this link to dynamically create circular progress bar How to Create a circular progressbar in Android which rotates on it? or How to create circular ProgressBar in android?
You can do that by following way when image view holds from server it hides progress bar until file loads from sever the progress bar rotates.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="#+id/progress"
android:visibility="visible"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="55dip"
android:minHeight="35dip"
android:minWidth="55dip"
android:maxWidth="10dip"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<ImageView
android:id="#+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"/>
</RelativeLayout>
Hope this will help you
layout Xml
<ProgressBar
android:id="#+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:max="500"
android:progress="0"
android:progressDrawable="#drawable/circular" />
Now create the drawable in your resources with the following shape. Play with the radius (you can use innerRadius instead of innerRadiusRatio) and thickness values.
<shape
android:innerRadiusRatio="2.3"
android:shape="ring"
android:thickness="3.8sp" >
<solid android:color="#color/yourColor" />
1.use this library may be it help you out:
https://github.com/CardinalNow/Android-CircleProgressIndicator
you can also try this one:
Show Progress bar while downloading

How to create speed animation bar in Android?

I will be glad to get some help with how to do a speed animation bar for android app. Something like what is shown here so it fills up automatically but for an app.
So far I found this code, which pretty resembles what I was aiming for but
I don't want the animation to show on a pop up, but as part of the page.
If you are not sure please point me to the right source so I will figure out how this works.
Any help would be much appreciated:)
Add progress base in your activity layout (R.layout.main);
<ProgressBar
android:id="#+id/mybar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="38dp" />
And instead of doing this
progressBar = new ProgressDialog(v.getContext());
do this after setContentView();
progressBar = (ProgressBar) findViewById(R.id.mybar);

Set Button at reached point in progress bar in android

I am working on Android application. I am using progressBar component inside my application and I trying to put small button on the reached point in the progressBar. but all my tries fails to do this
The code of my progressBar.
<ProgressBar
android:id="#+id/progressBarStartScreen"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="14dp"
android:minHeight="14dip"
android:progressDrawable="#drawable/customprogressbar"
>
</ProgressBar>
And my button code is
<Button
android:id="#+id/setttingButton"
android:layout_width="wrap_content"
android:layout_height="51dp"
android:layout_weight="1"
android:background="#fff"
android:text="Reached Point"
android:textColor="#d85546"
android:textSize="25sp"
android:textStyle="bold" />
This image to describe what I mean.
Please There are any one to help me to put the button on the reached pointed in Progress bar.
Thanks and Regards
You can try to use this work around
#Override
protected void onProgressUpdate() {
//Do something...
}
This might not be exactly what you're looking for, but I'm quite positive that when the user touches the progress bar, it will move slightly.
This will work best when you set progressBar.setMax() to a high number.

How to show a Horizontal Android Indeterminate Progress Bar

How to show an indeterminate horizontal progress bar in android? The animation of the progress bar should start from 0 to 100 and then go back from 100 to 0 continuously. I am not looking for the wheel progress bar.
I already knew that setIndeterminate will give an infinite horizontal progress bar. But it will be similar to the loading wheel, except that it will be horizontal. If you see my question I was looking for horizontal bar which starts from 0 and goes all the way to 100 (a gradual increase). If you want to achieve this in Android, you must use your progress bar as below:
<ProgressBar
android:id="#+id/progress_horizontal"
android:indeterminateOnly="false"
android:indeterminateDrawable="#drawable/progress_indeterminate_horizontal"
android:progressDrawable="#drawable/progress_horizontal"
android:minHeight="24dip"
android:maxHeight="24dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
As I wanted to change the background of my progress bar, I changed the ProgressDrawable and IndeterminateDrawable. The original drawables are located under frameworks/base/core/res/res/drawable. Copy them to your project and change the color according to your needs.
Create a thread which updates the progress count and does a Thread.Sleep. Then it sends the message to the Handler which will update the progress bar in UI thread.
Use the method setIndeterminate of ProgressBar:
android.widget.ProgressBar bar = new android.widget.ProgressBar(context);
bar.setIndeterminate(true);
But yeah, you could have found this pretty quickly in the developer docs.
http://developer.android.com/reference/android/widget/ProgressBar.html#setIndeterminate%28boolean%29
Maybe a bit late, but you can do something like this:
<ProgressBar
android:id="#+id/progress"
android:layout_width="match_parent"
android:layout_height="10dp"
android:indeterminate="true"
style="?android:attr/progressBarStyleHorizontal" />
Hope it helps someone!
To expand on Vinoth Answer, here is a ready code:
<ProgressBar
android:id="#+id/progressBarLoadingRecite"
android:indeterminateDrawable="#android:drawable/progress_indeterminate_horizontal"
android:minHeight="24dip"
android:layout_marginTop="20dip"
android:indeterminate="true"
android:maxHeight="24dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
In the xml defining your progress bar, you can add
style="#android:style/Widget.ProgressBar.Horizontal"

Is there a view for a button bar? (Image link describing the view)

I am looking for a view or some sort of information regarding the bottom bar in default applications of Android such as Email, or Unlock pattern as shown in the picture below. I have not been able find anything about this on Androids site nor from Google searches.
Image: http://img11.imageshack.us/i/viewdn.jpg/
I believe that Christopher is correct; there is no special widget to create the bar in your image. However, if you want to emulate it, you can create a layout and use the style style="#android:style/ButtonBar". That will give you the light gray background and the correct margins.
I don't believe there's any standard view for the button bar used at the bottom of these apps; it's generally just two Button items placed together in a LinearLayout or RelativeLayout.
For example, looking at the Android Open Source Project, you can see the button bar for one of the email app setup screens is defined as two plain old Button objects.
However, it is surprising that Google didn't abstract more of the common stuff into an Android theme or sublayout, rather than having the same views and attributes in each layout XML.
From: http://code.google.com/p/k9mail/source/browse/k9mail/trunk/res/layout/account_setup_basics.xml?r=1314
<RelativeLayout
android:layout_marginTop="-45dip"
android:padding="0dip"
android:layout_alignParentBottom="true"
android:gravity="bottom|right"
android:background="#android:drawable/bottom_bar"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<Button
android:id="#+id/manual_setup"
android:text="#string/account_setup_basics_manual_setup_action"
android:minWidth="#dimen/button_minWidth"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginBottom="-4dip"
android:layout_alignParentLeft="true"
android:layout_centerVertical="false"
/>
<Button
android:id="#+id/next"
android:text="#string/next_action"
android:minWidth="#dimen/button_minWidth"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:drawableRight="#drawable/button_indicator_next"
android:layout_marginBottom="-4dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="false"
/>
</RelativeLayout>

Categories

Resources