Category Archives: Android

Android unable to retrieve nearby places using google api

Questions: I am trying to get the nearby places of the location I send by using the google map’s api. Below is the url(,151.1957362&radius=1500&type=restaurant&keyword=cruise&key=YOUR_API_KEY).I created a POJO class using DTO Generator plugin.But in the response method of the retrofit the status variable in the POJO class gives me ‘REQUEST_DENIED’.(Main Log.e(“Res”,response.body().getStatus()); Am I using retrofit… Read More »

Programatically Enable Wireless Display automatically in android

Questions: I Need to Enable the Wireless Display Promatically through my Application. I open the Settings screen using below Code, Intent intent = new Intent(Settings.ACTION_CAST_SETTINGS); startActivityForResult(intent, 0); I tried with Request Code as 1 (startActivityForResult(intent,1);) but this doesn’t help. I didn’t found any reference for the same in Docs. has anyone tried this? Answers:

retrofit 2 – path with “?” AND addQueryParameter

Questions: we get URL paths from a server but also have to add query parameters on top of that. In retrofit, this results in something along the lines of -> /some/path/%3Fquery1=1?query2=1&query3=1 I have a custom interceptor (see bottom of post) in place to handle this but I feel like this is a BAD way to… Read More »

Change field type of a GreenDao entity

Questions: Let’s assume we have a GreenDao(version 3.2.2) entity. @Entity class Stats { @Id private Long id; private int points; private int fieldGoals; private int per; @Generated(hash = 608515378) Stat(Long id, int points, int fieldGoals, int per) { … } … getter and setter here … } Later, we decided to change the type of… Read More »

relaunch application without changing

Questions: I found some code to press home button from code Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(startMain); and This one : moveTaskToBack(true); I have a activity that is in single task And a alertDialog with a button then you click on the button one of those code run and go to home so… Read More »

How to create a rhombus shaped button in android studio

Questions: I want to create a button with a rhombus shape like on the Material website: (This is the picture) I searched the web and didn’t find an answer so I’m asking it here. I already found out how to create a rhombus shape: <layer-list xmlns:android=””> <item android:height=”60dp” android:width=”60dp” android:right=”20dp” android:left=”20dp” android:gravity=”center”> <rotate android:fromDegrees=”45″ android:pivotX=”50%”… Read More »

How to increase match rate in admob?

Questions: I just getting 10k visitors daily in my android app but match rate is only 33% every day, in this I losing my earning,How to increase match rate or what is reason behind this why it low? My app Answers: