Android ADB device offline, can’t issue commands

I just got the same problem today after my Nexus 7 and Galaxy Nexus were updated to Android 4.2.2. The thing that fixed it for me was to upgrade the SDK platform-tools to r16.0.1. For me, this version was not displayed in my SDK Manager, so I pulled it down from http://dl.google.com/android/repository/platform-tools_r16.0.1-windows.zip directly. You then need to rename the platform-tools directory and unzip … Read more

Is there an equivalent to iOS’s Keychain for user credentials on Android?

Is there an equivalent to iOS’s Keychain on Android? My understanding of the Preferences API is that it is not encrypted. For my application it doesn’t matter whether these credentials are persisted across devices (i.e. a different use-case to iPhone-like Keychain in Android?) I also looked at the KeyStore API but it seems to leave the actual storage of user … Read more

Getting java.net.SocketTimeoutException: Connection timed out in android

I’ve searched all over the web and after reading lot of docs regarding connection timeout exception, the thing I understood is that, preventing SocketTimeoutException is beyond our limit. One way to effectively handle it is to define a connection timeout and later handle it by using a try-catch block. Hope this will help anyone in future who are facing … Read more

SQLiteDatabase.query method

tableColumns null for all columns as in SELECT * FROM … new String[] { “column1”, “column2”, … } for specific columns as in SELECT column1, column2 FROM … – you can also put complex expressions here:new String[] { “(SELECT max(column1) FROM table1) AS max” } would give you a column named max holding the max value of column1 whereClause the part you put after WHERE without … Read more

How to update Notification with RemoteViews?

Here’s a detail example for you to update the notification using RemoteViews: Layout for the Notification, i.e. res/layout/custom_notification_small.xml: Hope this example helps you a lot! NOTE: You can’t update the custom NotificationCompat on pre-Honeycomb, so I added an alternative way to update it on pre-Honeycomb, i.e. checking the API level first and use the deprecated Notification instead.

RecyclerView vs. ListView

RecyclerView was created as a ListView improvement, so yes, you can create an attached list with ListView control, but using RecyclerView is easier as it: Reuses cells while scrolling up/down – this is possible with implementing View Holder in the ListView adapter, but it was an optional thing, while in the RecycleView it’s the default way of writing adapter. Decouples list from its container – so you can … Read more

How do I get the dialer to open with phone number displayed?

Two ways to achieve it. 1) Need to start the dialer via code, without user interaction. You need Action_Dial, use below code it will open Dialer with number specified The ‘tel:’ prefix is required, otherwhise the following exception will be thrown: java.lang.IllegalStateException: Could not execute method of the activity. Action_Dial doesn’t require any permission. If you want … Read more

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