I ran into an interesting situation with using a ProgressBar in an App Widget... The documentation (http://developer.android.com/guide/topics/appwidgets/index.html) says that ProgressBar is a supported widget class...
I have no problem getting the ProgressBar to display in my App Widget but the problem is that I want it to only be displayed as visual feedback to the user when background processing is happening.
On ImageViews I do this via RemoteViews.setViewVisibility() and everything works fine. However, with ProgressBar I get an exception saying that ProgressBar can't use this method.
Is this intentional or is this a bug? Is there any way to workaround this problem?
An even simpler idea, is to put the progress bar inside some container (say a linear layout) and show/hide the container.
It might be a bug. There's a particular annotation (#RemotableViewMethod) you need in the Java source code of Android itself to mark a method as being available via RemoteViews. View has this for setVisibility(), but ProgressBar overrides that method and does not have the annotation on its own edition. If #RemotableViewMethod is not inherited, and the override "undoes" the annotation, that would explain the symptom you see.
A workaround is to use two app widget layouts and choose the one you want (with or without ProgressBar) when you create your RemoteViews object when updating your app widget.
I'll make a note to try to replicate this and, if I see the same thing, I'll post an issue on it on the Android issue tracker.
Related
Is it possible to completely change the Layout of a Crouton? I've seen a few of posts about changing the view which actually came down to just wanting to change the font but nothing about actually changing the layout.
I've already got croutons displaying nicely and been playing about with styles but couldn't quite find how to do what I want. Basically what I want is something like this, which dismisses the crouton when clicking the cross. So it's just a textview and a button!
I did see this within the Crouton Library but couldn't really see how to use it for my purpose.
public static Crouton make(Activity activity, View customView) {
return new Crouton(activity, customView);
}
Follow this link you may get answer
Another Link
His idea is to show in-app notifications (not to be confused with Android’s persistent notifications) at a fixed place of the Activity to which the notification is relevant. This way the context of the notification is always correct
Friends,
I am trying to develop an application which requires the below UI:
I know its not a feasible thing to run a ListView with-in ListView or with-in a ScrollView. So I'll like to know that Is there any other way to do this same thing ? as the UI has to be same as its running in its LIVE iOS App.
Thanks in advance.
Solution: Thanks guys for all of your answers, but as I told that the Expandable-ListView is not the option in my condition. So I have creating a dynamic layout in Java Class file using an amount of various Layouts & Widget's Array. It took a lot of practice but it covered the necessity.
android-expandable-listview-simple
check this it will help you
You don't really describe your problem in detail but from your indication of a blue bar at the left, I suppose that you want to have some sort of a secondary ScrollView inside the primary ListView; which itself has its one scrolling view. If so, then using an ExpdandableListView will not be the solution that you want.
Android has some difficulties managing a ScrollView inside another ScrollView but if this is what you want, then take a look at: ScrollView Inside ScrollView .
Be warned that these solutions are not perfect and that probably you will never achieve the same level of control for this type of thing on Android as you can have on iOS.
Dialogs # Android Developer says to avoid ProgressDialog to indicate loading, and instead, to put an activity indicator right in the layout.
Progress & Activity # Android Developer discusses activity indicators, but doesn't name the classes used. I've had no luck searching for Android classes with names like ActivityBar, ActivityCircle, or ActivityIndicator.
Where can I find documentation (tutorials, examples, or API documentation) on Android's support for including activity indicators right in my layout, avoiding a ProgressDialog?
Update: full.stack.ex pointed me the right answer.
First, include the following code in the Activity's onCreate() method before invoking setContentView():
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
Next, just before loading (e.g. firing up an AsyncTaskLoader), use this call to make the spinner appear:
setProgressBarIndeterminateVisibility(true);
Finally, after the load is completed, hide the spinner again:
MainActivity.this.setProgressBarIndeterminateVisibility(false);
Bingo! No ProgressDialog required. Making the spinner visible seems to slow down loading considerably in the emulator (it takes minutes instead of seconds), but not on my actual phone. I'm not sure if there's any way to make the spinner use fewer CPU cycles.
It's not really obvious from the documentation that there's a window feature for that.
It's a built-in progress indicator:
Activity.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
developer.android.com/reference/android/app/Activity.html#requestWindowFeature(int)
You're talking about ProgressBar class (I guess): http://developer.android.com/reference/android/widget/ProgressBar.html
Ive tended to use an animated gif image in the past. Good site for generating them is
http://www.ajaxload.info/
Can anyone tell me what control or how do you create the pop-up effect used in these images to display the legend?
The screenshots are taken from an app called FlyOKC.
Any help is greatly appreciated, thank you.
This is not exactly a custom dialog. But, yes it is still a customized view. And it is more or less called Quick Action Dialog in android. I would suggest you to follow the tutorials below for generating an exactly same popover (or even better) with Android. Check the screenshot also.
http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
http://www.androidpatterns.com/uap_pattern/quick-actions (Pattern Reference)
That's certainly using a custom version of a dialog. The idea is to implement your layout in a xml and inflate it in a dialog. There's a lot of tutorials around, try that one.
Actually, that can be achieved by using RelativeLayout and switching the legend view's visible state between View.VISIBLE and View.GONE in button's click handler.
To get the exact animation you'll need to jump some hoops.
Here are related threads:
How does one Animate Layout properties of ViewGroups?
How do I animate View.setVisibility(GONE)
Also, I think another (and possibly easier) way would be to use Fragments API with transition effects, in which case this is the thread to read:
Animate the transition between fragments
I am currently working on an Android app, I have completed all the 'hard stuff', such as getting my database working, and so on. Now I need to make the UI look decent.
I would like to make something that has a 'frame' layout that is clickable. You would click on a 'frame' to find out more information, a bit like the Amazon app.
If anyone has any ideas, tutorials or good links, I would be very grateful.
Thanks in advance.
Take a look at Gallery. It's built in to Android and does what I think you're looking for (at least, it describes the Amazon app's UI; since FrameLayout has a very explicit meaning in Android that is not at all what you're talking about, I ignored that part).
EDIT: A screenshot would have been helpful but I think you're actually talking about a simple list-like view.
Oh. That's either a ListView, or more likely just a vertical LinearLayout inside a ScrollView. I can tell you what I'd do: Each item in the LinearLayout would have a background set, with a width of match_parent and a height of wrap_content, using a 9patch with the right-pointing arrow inside it. I'd also define an identical but blue-highlighted version of the image for the pressed state and use a state drawable XML to let it know which to use. Then I'd just bind an onClick listener for each item I wanted to fire off a click action on.