Skip to main content

Posts

Android Notifications - lesson learned from implementation

Recently some Conf Call Dialer users asked to add notifications to the application, so (since it seems to be a good idea) I've spent few hours implementing them in the app. Everything went smoothly, except of one rather funny problem, after executing NotificationManager.notify, notifications were not showing up and I was getting all the time the following warning in the LogCat (12345 is the id assigned to the notification): notify: id corrupted: sent 12345, got back 0 My code seemed to be rather simple (mostly copy paste from the javadoc, with some app specific logic added): NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this). setContentTitle(event.subject).setContentText(event.timeFrom + " " + additionalText); // ... NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(notificationId, mBuilder.build()); Googling didn't help, so I compare ...

Azure Storage Explorer - for all your Azure Storage management needs

If you are like me a heavy Azure user you may try the following tool that in an easy (and faster than the management UI) way allows you to manage content of your storages. Works like a dream, setup takes like 10 seconds. http://azurestorageexplorer.codeplex.com/

Rendering AdMob view on Canvas (SurfaceView) in android

If you're wondering how put a working AdMob view into your SurfaceView and are tired of looking in the Internet for solution (somehow most suggestions that I found on forums didnt work), here it is... Assumptions: A. We request the ad on creation (you may want to refresh it later though...) B. The AdView is put on the bottom of the screen C. It's a production ready code, but if you want to test it - add testDevices to the adRequest D. You've already set AndroidManifest properly as described in the Getting Started tutorial 1. In the activity that initializes your SurfaceView add a field representing your adView, for example: private AdView adView; 2. In the onCreate method of the same activity put the following code: // window manager preparation WindowManager.LayoutParams windowParams = new WindowManager.LayoutParams(); windowParams.gravity = Gravity.BOTTOM; windowParams.x = 0; windowParams.y = 0; windowParams.height = WindowManager.Lay...

ArrayAdapter notifyOnDataSetChanged doesn't refresh underlying ListView

If for any reason you're using ArrayAdapter to feed your ListView on Android you may be struggling with the fact that whatever you do - executing notifyOnDataSetChanged doesn't result in the corresponding ListView getting refreshed. There is one simple solution for this (and no, I am not talking about one that I saw on one forum where it was suggested to recreate the ArrayAdapter , which on a first glance may be a good idea at least until you're happy with the list jumping every time to the top). So what you need to do to have your ListView updated is: 1. Either execute  arrayAdapter.remove(itemToRemove); // if you want to delete item from the list or arrayAdapter.add(itemToAdd); // if you want to add an item to the list or 2. Execute arrayAdapter.clear(); // get rid of all elements arrayAdapter.addAdd(listOfItems); // add them back to the list Both work just fine.

How to join conference calls on Android

Since I am working for a global company for last few years, I spend quite a lot of time on conference calls. Still, joining conference calls especially if you're on a move isn't easy - I always had challenges when trying to memorize participant codes (again - especially while driving :)). But then - when you think about it, we have all the required information in the Android calendar, so it's only a matter of handling it properly. So here it is - Conference Call Dialer . I hope it will make your life easier (at least when it comes to joining conference calls :)) Additional information about the Conference Call Dialer : Functionality: - Retrieve information about meetings from the calendar - Dial into conference calls with conf code from the invitation - Manage and use multiple gateways (e.g. of your company and of your customers) - Review the invitations where conf code could be retrieved - A widgets for the home screen - Convenient "My conference call...

PreviewImage not showing up in widget list on android?

Few things to keep in mind when you're trying to set a preview image for your android widget: Set the android:icon attribute on the corresponding receiver in your AndroidManifest.xml to the same drawable as the one mentioned in the android:previewImag e attribute of your widget.xml file. Don't use too big (when it comes to resolution) preview images, as android anyway will scale them up. As a rule of thumb I've noticed that I have to scale down preview images (from their original size after doing screenshot in ddms) to 75% for small widgets (taking 1 row) and approx 50% for full screen widgets. Otherwise you'll get error saying that the widget dragging couldn't be initialized. Most widgets anyway don't use preview, so don't worry about it too much :)

Easy swipe gesture handling on android

Recently I wanted to implement swipe functionality for activity in my android app but couldn't find a nice and simple example that would explain what do you really need to do. There are multiple sites that are bloated with code, but somehow I couldn't believe that to implement such a simple (and kinda basic if you think about it) functionality you need to write tens of lines of code. So if you're like me, looking for a simple and elegant solution for swipe gesture handling, here it is... First some theory - to implement swipe you will need to: 1. Create a GestureDetector 2. Create an OnGestureListener by extending GestureDetector.SimpleOnGestureListener 3. Implement onFling method in listener created in step 2 4. Handle the onTouchEvent in your activity Now let's jump to the code: import android.app.Activity; import android.os.Bundle; import android.view.GestureDetector; import android.view.MotionEvent; public class MySwipeSupportedActivity extends ...