I have a RecyclerView, when I click in the first view it adds another view like in the image, what I want is to set the “add” view which ID is “1” to be fixed in the last position of the recycler instead in the first. My adapter: In the activity: Answer I solved it by creating a custom…
Tag: android
Android how to play different sound for each item in recyclerview
I build app with images of animals, and after you click on animal, its play sound for that animal. I use Recyclerview for displaying all animals items. My problem is that i do not know how to handle click event for playing sounds for each animal. I do know how to play same sound for each item in recyclerview …
Flip a Bitmap image horizontally or vertically
By using this code we can rotate an image: But how can we flip an image horizontally or vertically? Answer Given cx,cy is the centre of the image: Flip in x: Flip in y: Altogether:
Starting a new activity on navigation drawer item click
I know this is a question frequently asked, but after reading the many questions and solutions on stack overflow I am confused. I am confused with regards to Fragments and what is required to start an activity from clicking an item in the navigation drawer. I’ve checked these posts but only got confused…
Running command using “exec” channel with JSch does not return any output
I am trying to execute a command on a Linux server using SSH from Android with JSch. As far as I know I am connecting to the server, but when I attempt to retrieve the results of the command I am getting nothing. Connect to server: Retrieve data: What am I missing here? Answer You disconnect immediately after…
Billing service unavailable on device. (response: 3:Billing Unavailable)
I’ve been struggling with this problem for days now. I know there are a lot of questions with the same problem on SO but i couldn’t get it to work. What I have done Uploaded APK in beta phase Created Merchant account Added test user Code AndroidManifest.xml <uses-permission android:name=”…
Android – RecyclerView with one layout, multiple setVisibility
I have a basically all in one layout which has everything needed for my app’s main feed. All variable items (images, video thumbnails.. Etc.) are set to GONE at first and set to VISIBLE when it is needed. The problem is sometimes, might be due to RecyclerView’s recycling behavior, the item which i…
Error in Fragment: “Already managing a GoogleApiClient with id 0”
Everything works right the first time, if you launch a second time you see this error: Here’s my code: As I understand it, the problem is in these lines: I tried explicitly passing an id of 0: but that still didn’t work. What am I missing? Answer You should call stopAutoManage() in the onPause() m…
Fullscreen DialogFragment overlaps with StatusBar
I created a full screen dialog with the official Guide The problem is, that my Toolbar overlaps with the status bar and I cannot figure out how to solve this. DialogFragment Layout Toolbar Activity creating Dialog EDIT After removing StatusBarTransparency from v21-styles it looks like this Answer The problem …
Android: Redirect to another Activity after delay
So I am developing a simple app for a college project, And I have been able to integrate a Facebook login using fragments. But I now am stuck trying to redirect the user after they login. I simply want to redirect them to the second activity page Here is my code for the Facebook login success Answer To make a