ShowCaseView does not hide when touching outside - android

new ShowcaseView.Builder(mainTabActivity)
.withHoloShowcase()
.setTarget(new ViewTarget(recyclerView.findViewHolderForAdapterPosition(0).itemView))
.setContentTitle(getString(R.string.tutorial_welcome))
.setContentText(getString(R.string.tutorial_cardview_add))
.hideOnTouchOutside()
.build();
This is my code when attaching the showcaseview onto the recyclerview first item. It works although the animation seems to be laggy I don't know why, and also the problem is when I touch outside or press the "ok" button. The showcaseview does not hide instead I have to press the "ok" or touchoutside for a few times "four times" I think, to make it go away completely. Am I missing something?
I am using this https://github.com/amlcurran/ShowcaseView library.
I have tried giving it an onClickListener and calling removeAllViews() but it's crashing the app.

I found a solution, what I did was to directly initiate the whole thing in the adapter of the recyclerview and hold it in a condition that would prevent it from popping up more than once.

Related

How do I make an Android activity like shown in this image?

How do I make an Android activity like the one shown in this image.
I am asking specifically about how to make a component such as the repeat and reminder components. And also, the two tabs showing Add Event and Add Task.
I'd also like to know the name by which they are referred.
Touching Repeat, a list dialog box appears. Touching Reminder, different times can be set which can be removed by a minus sign (-) which appears beside them. The tabs cannot be slid, but they need to be clicked to go to a particular tab.
It looks like it's just a listview on top of a tabbed activity.
When you create a new Activity, you can just specify tabbed activity and Android studio takes care of creating the tabs.
Then for the items, you just use listview, unless it'll turn out to be a really long list, then a recyclerview is recommended.
Hope that helps (:

What is the most idiomatic way to show a retry button when the receiveError event happens on a WebViewClient?

I would like to show a retry button when my application cannot load a page. As far as I understand, whenever this happens, the onReceiveError() method on WebViewClient is called.
I have a piece of code that does an animation. It makes a button visible and animates the y property of it until it reaches the middle of the screen. However, I would like to be able to fire this piece of code in the onReceiveError() method, and animate the button down and make it invisible when onPageFinished() happens.
My problem is not with the animation bit of the code. My problem is in where to put it. I can't put the animation code inside the WebViewClient since as I said above, I have to reach through the WebView to its parent activity, and animate a Button defined on that activity. This violates every object-oriented best practice I'm aware of, so I have a bad feeling about it. However, I don't know where else I can put it. I'm looking for a best practice defined by the community on code like this, where a dependency of a view (i.e. WebViewClient) needs to change something on an activity.
I'm new to Android development, so please be gentle.

Manually Show ExpandableListView

How to show ExpandableListView manually if i touch a button. So far, the only way i can open it is by sliding the screen.
I couldn't find any method like show() like on Toast. I've tried looking for any similar sound method on android reference.
I think you can try scrollTo method to scroll to a postion.
For open/ close a group, you can use expand method.
I found the answer. Turns out, i was wrong. I should've animate the container. In this case, the drawer.
I got my answer from here. How to open Drawer Layout only with button?
I just need to call opendrawer().

android set a view to invisible and back to visible

I have a FrameLayout I want to disappear it on a button click and make it reappear on a button click
I tried this to disappear and it worked great
background.setVisibility(View.INVISIBLE);
background.invalidate();
but when I tried to get it back using the below code it didn't work.
background.setVisibility(View.VISIBLE);
background.invalidate();
What is the right way to do this?
check the thread on which you are executing these
just have a look at this example. This may help you!
And I think the method invalidate() invalidates the view (after invisible the view)and so it's not reverting back(invisible to visible).

Menu does not showup first time after install

i a facing very weird problem in my app. i am inflating a layout on pressing menu key. and setting that layout on popupwindow. the prob i am facing is that when i install build on device and press menu key, popup does not show up. but if i navigate to some other screen and come back to previous screen, menu key works perfectly.
even if i cllose app and open it next time, menu key works fine. it does not work for the first time after install.
thanks in advance.
Maybe you set your click listener for the menu button in the wrong lifecycle method? Perhaps it doesn't add the listener until after onPause()? Seeing some source would be very helpful to be sure.
I think android pretty much decides on its own when it updates its layouts and redraws the view. Maybe your newly inflated view doesnt affect the other layouts in a way that makes this seem neccessary. I would try to call requestLayout()/forceLayout() on the main layout...
Not sure though...

Categories

Resources