How do I get the current GPS location programmatically in Android?

I have created a small application with step by step description to get current location’s GPS coordinates. Complete example source code is in Get Current Location coordinates , City name – in Android. See how it works: All we need to do is add this permission in the manifest file: <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” /> And create … Read more

decompiling DEX into Java sourcecode

It’s easy Get these tools: dex2jar to translate dex files to jar files jd-gui to view the java files in the jar The source code is quite readable as dex2jar makes some optimizations. Procedure: And here’s the procedure on how to decompile: Step 1: Convert classes.dex in test_apk-debug.apk to test_apk-debug_dex2jar.jar d2j-dex2jar.sh -f -o output_jar.jar apk_to_decompile.apk … Read more

How do I obtain crash-data from my Android application?

You might try the ACRA (Application Crash Report for Android) library: ACRA is a library enabling Android Application to automatically post their crash reports to a GoogleDoc form. It is targetted to android applications developers to help them get data from their applications when they crash or behave erroneously. It’s easy to install in your … Read more

Set up adb on Mac OS X

Note: this was originally written on Installing ADB on macOS but that question was closed as a duplicate of this one. Note for zsh users: replace all references to ~/.bash_profile with ~/.zshrc. Option 1 – Using Homebrew This is the easiest way and will provide automatic updates. Install homebrew /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)” Install … Read more

getColor(int id) deprecated on Android 6.0 Marshmallow (API 23)

Starting from Android Support Library 23, a new getColor() method has been added to ContextCompat. Its description from the official JavaDoc: Returns a color associated with a particular resource ID Starting in M, the returned color will be styled for the specified Context’s theme. So, just call: ContextCompat.getColor(context, R.color.your_color); You can check the ContextCompat.getColor() source … Read more

Can I underline text in an Android layout?

It can be achieved if you are using a string resource xml file, which supports HTML tags like <b></b>, <i></i> and <u></u>. <resources> <string name=”your_string_here”><![CDATA[This is an <u>underline</u>.]]></string> </resources> If you want to underline something from code use: TextView textView = (TextView) view.findViewById(R.id.textview); SpannableString content = new SpannableString(“Content”); content.setSpan(new UnderlineSpan(), 0, content.length(), 0); textView.setText(content);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)