Posts by Douglas Mesquita • 809 points
28 posts
-
1
votes3
answers629
viewsA: Why does my Actionbar due to an error stay inside my Statusbar?
Tries to recreate the project using Android Studio. A very important step is to update the Android Studio sometimes have "bugle" version. As you are using a standard sample it is not to take error.…
-
1
votes2
answers2499
viewsA: Android: Send data via POST
Uses native Android library Volley. Here has another example of how to implement. final String url = "some/url"; final JSONObject jsonBody = new JSONObject("{\"type\":\"example\"}"); new…
-
1
votes1
answer422
viewsQ: Mockito-Android Test return method
I’m trying to test a return of a method from my class on an Android project. I’m doing it this way: MyClass var = Mockito.mock(MyClass.class); With this, I already have my instance. Now I need to…
-
1
votes1
answer135
viewsA: Ringer Mode Vibrate on Android
Call the startVibrate method within the method you expect to vibrate... private void metodoQueVibra(){ startVibrate(); } public void startVibrate() { long pattern[] = { 0, 100, 200, 300, 400 };…
androidanswered Douglas Mesquita 809 -
0
votes3
answers1459
viewsA: Parse Complex of JSON
You can use the JSON Schema. Simply you pass the JSON and it returns the POJO, then you can use the GSON. I did a test with your JSON file and these classes were returned, after generated just make…
-
9
votes2
answers9199
viewsA: Testing an application’s Internet connection
This method validates if there is a connection. public static boolean isOnline(Context context) { ConnectivityManager cm = (ConnectivityManager)…
androidanswered Douglas Mesquita 809 -
1
votes1
answer247
viewsQ: Problem when climbing APK
I’m trying to upload an apk to Google Play and I got the following message: You uploaded an APK using the 5208000 version of Google Play Services. Use 5100000 or lower version. In my buil.Radle file…
-
4
votes1
answer108
viewsA: Problem in Context and Sharedpreferences on android with service
Removes only the variable ctx and uses the getApplicationContext() of the Service class where necessary. Ex.: public void test(){ TextView textView = new TextView(getApplicationContext()); }…
-
4
votes1
answer3848
viewsA: Custom popup
With Dialogfragment you get this way below mButton.setOnclickListener(new OnclickListener(){ test(); }); public void test(){ Dialog dialog = new Dialog(this, R.style.FullHeightDialog);…
androidanswered Douglas Mesquita 809 -
-1
votes1
answer1198
viewsA: Best way to model a chat database
Another solution would be to use Dropbox. If the user wanted to have message history, they could log in through Dropbox and then you would have access to save files to their account through the…
-
2
votes1
answer600
viewsA: Best way to store images in database
You can use the library Universal Image Loader for Android she works exactly on these issues of loading image url in listview or gridview. You can still do processing to render the image size.…
-
0
votes1
answer87
viewsQ: Check if Sim Card is installed
Hello, I wonder if it is possible to check if the sim card on the device is installed on Android.
androidasked Douglas Mesquita 809 -
0
votes2
answers145
viewsA: Eclipse Android plugin error
I managed to solve it that way: Open the %you_user% in the folder . android delete the "cache folder" delete the ddms.cfg which file Initiate the eclipse This also works :D…
-
1
votes2
answers145
viewsQ: Eclipse Android plugin error
I am trying to start Eclipse and it is always 0% when loading the projects. The following Apare message: the user Operation is Waiting for Android SDK Content Loader to complete Someone’s been…
-
1
votes1
answer304
viewsA: Read message from USSD Android code
This link talks generally about the subject: Where is the security breach? To execute a USSD code, you must insert it on your phone’s keyboard and press "Connect". What Borgaonkar discovered is that…
-
2
votes1
answer920
viewsQ: Proguard.cfg Android file
How do I "obfuscate" my classes, methods, variables and etc in the proguard.cfg Android configuration file? My intention is to hinder decompilation (reverse engineering) of the project.
-
1
votes2
answers675
viewsA: How to modify and save the new modified listview item?
An option would be to retrieve the items via the method get of lisView and write the data to a file Shared Preference android String favorito = listView.getSelectedItem(); SharedPreferences settings…
-
-2
votes3
answers20150
viewsQ: Converts negative number to positive
Is there a native java library that helps me in an elegant way to convert a negative number to positive. I didn’t mean to do it that way: public class Main { public static void main(String[] args) {…
javaasked Douglas Mesquita 809 -
0
votes3
answers489
viewsA: Http Connection with timeout does not work
It can also be done that way: //Recupera um content via HTTP GET. public static InputStream getInputStreamFromUrl(String url) { InputStream content = null; try { HttpClient httpclient = new…
androidanswered Douglas Mesquita 809 -
2
votes2
answers672
viewsQ: Identify Dual Sim Card on Android
I’m trying to identify yes card on the Galaxy Y smartphone however, this smartphone is dual chip and I can not display. I did some research but I just found how to identify only one sim card…
androidasked Douglas Mesquita 809 -
1
votes2
answers2277
viewsQ: Read file in Assets folder
How do I read a text file inside the Assets folder in an Android project? Ex: my_project/assets/file.txt
androidasked Douglas Mesquita 809 -
2
votes1
answer327
viewsA: Doubt about Registration ID in Google Cloud Message
Well when I log a device into the GCM server, is the id it receives unique? If I uninstall the application and install again, I can guarantee that that device is already registered, IE, it uses the…
androidanswered Douglas Mesquita 809 -
1
votes2
answers11473
viewsA: Icon with notification counter
There’s this library that does just that here. Android does not allow you to change the icon after APK is generated, basically the library View Badger create a widget above the app icon. Remember…
androidanswered Douglas Mesquita 809 -
9
votes2
answers4470
viewsQ: Convert date dd/mm/yyyy to yyyy-mm-dd’T'HH:mm:ss
How do I convert a date into format dd/mm/yyyy for the format supported by Sqlite yyyy-MM-dd'T'HH:mm:ss? Example: public static String converteStringEmData(String stringData) throws ParseException {…
-
10
votes1
answer3183
viewsQ: Save value in Sharedpreference
How I do to save and recover information in an Android Prefence file. Example String a = "stack overflow" int b = 32; boolean c = true;
-
1
votes1
answer60
viewsA: Android Test - Call Method
You have full access to all Activity methods whether implicitly or explicitly. Type: public void testNomeAplicacao() { TextView nomeAplicacao = (TextView) demo.findViewById(R.id.nomeAplicacao);…
-
0
votes2
answers201
viewsA: Better/Secure way to transfer sensitive data to an android application through JSON
The safest option I see would be SSL. However, if you want to use something less robust, serialize the JSON string and send it via POST. It’s an option :D
-
0
votes3
answers647
viewsA: GPS location returns only null (0.0.0.0)
You need to wait for the GPS to calibrate. Creates a loading structure that alerts you after the onLocationChanged(Location location) is different from null. Example: public void…