I try to make a widget for gmail in order to have the number of unread messages in my gmail box (the only existing app I found is not free and for a such basic feature, that's a shame!). To manage it, I thought about using the GmailProvider package, especially the android.provider.Gmail.LabelCursor class, you can find its documentation here
I use dynamic loading because I don't have the source code so I can't do a regular import statement (see here
But I can't manage loading the class in my application, always get an ClassNotFoundException...
final String apkFile = "/system/app/Gmail.apk:/system/app/GmailProvider.apk";
dalvik.system.PathClassLoader clsLoader =
Class<?> gmailProviderHandler =
Class.forName("android.provider.Gmail.LabelCursor", true, clsLoader);
Method m = gmailProviderHandler.getDeclaredMethod("getNumConversations", (Class)null);
int nbConv = ((Integer)m.invoke(gmailProviderHandler, (Object)null)).intValue();
Any idea ?
An other solution would be to use the atom feed, but using this package seems nicer to me.
Alternatively, is there a way I can get the source of this package, maybe the class name has changed since the javadoc (not official) has been written ???