Android – is there a way to access calendar entries without using gdata java client?
                                        
                    •
                    Android                                    
                Can I get calendar entries offline through my mobile phone? It seems that the only way is to use gdata - Java - client
resolvent:
These answers are good, but they all involve hard coding the calendar URI (I see three different versions on different Android devices)
A better way to get the URI (hard coded class and field names) would be as follows:
Class<?> calendarProviderClass = Class.forName("android.provider.Calendar");
Field uriField = calendarProviderClass.getField("CONTENT_URI");
Uri calendarUri = (Uri) uriField.get(null);
This is not perfect (it will break if they delete the android.provider.calendar class or the content_uri field), but it can run on more platforms than any single URI hard code
Note that these reflection methods throw exceptions that need to be caught or re - thrown by the calling method
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        