Skip to main content

Posts

Error: Retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23

My project is going on easily but suddenly what I found below bugs when developing an app. I know it's minor bug but it may be useful to anyone. Here is the error: Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Solution: This happens because after updates your android studio uses API 23 by default. 1) First check that your compile SDK version must match the support library's major version. If you are using version 23 of the support library, you need to compile against version 23 of the Android SDK. Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.   2) Go to your project structure -> Properties -> and change Build tool version to
Recent posts

How to show only one child of expandable list at a time?

If you have "ExpandableListView" and show only one child of expandable Listview at a time, then below is the code for it. expendListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { int previousGroup = -1; @Override public void onGroupExpand(int groupPosition) { if(groupPosition != previousGroup) expendListView.collapseGroup(previousGroup); previousGroup = groupPosition; } }); "groupPosition" will return the open group id. So when I expand the other group then open group will collapse. You can also expand specific item of "ExpandableListView" by applying following code: expendListView.expandGroup(i);

Put Multiple Marker on Map? It's So Damm Easy..

If you want to put multiple marker on google map, then just follow some snip of code below and enjoy it. // Initialize variables private GoogleMap mMap; private HashMap<Marker, Integer> mHashMap = new HashMap<Marker, Integer>(); private ArrayList<My_Custom_Model_Class> myList = new ArrayList<My_Custom_Model_Class>();  // Add Multiple marker on Map for (int i = 0; i < myList.size(); i++) { double latitude = myList.getLatitude(); double longitude = myList.getLongitude(); Marker marker = mMap.addMarker(new MarkerOptions().position(new LatLng(latitude,longitude))).title(myList.getTitle()) .icon(BitmapDescriptorFactory.fromResource(R.drawable.location_icon)); mHashMap.put(marker, i); } // If you want to get particular marker click @Override public boolean onMarkerClick(Marker marker) { int pos = mHashMap.get(marker); Log.i("Position of arraylist", pos+""); }

Youtube API: Service Intent must be explicit

Whe n I am using Youtube API and open the video in my application then it shows me below error in Android L Problem java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.youtube.api.service.START } Solution: *  The new android youtube SDK as been released! No more implicit intent problem: https://developers.google.com/youtube/android/player/downloads/

Be aware while Posting photo from a native ShareDialog in Facebook android SDK

Add the content provider to your manifest. <provider  android:name="com.facebook.NativeAppCallContentProvider" android:authorities="com.facebook.app.NativeAppCallContentProvider{Facebook-App-Id}" android:exported="true" /> Make sure exported=true (as above) Example: <provider android:name="com.facebook.NativeAppCallContentProvider" android:authorities="com.facebook.app.NativeAppCallContentProvider123456" android:exported="true" />

Fragment: App loads with white screen for 3 secs before showing proper UI

Issue: 1) When my application start then white/black screen appears, and then main UI is display.  2) Before my fragment load in activity black/white screen appears for 3/4 seconds and then fragment load. Solution: To fix this nasty problem, update the /res/values/styles.xml to include <item name="android:windowDisablePreview">true</item> or <item name="android:windowBackground">@android:color/black</item> for example : <!-- Application theme. -->  <style name="AppTheme" parent="AppBaseTheme">  <!-- All customizations that are NOT specific to a particular API-level can go here. -->  <item name="android:windowDisablePreview">true</item>  <!-- <item name="android:windowBackground">@android:color/black</item> -->  </style>

Android: Check whether activity is in stack or not.

Solution There's possibility to check current tasks and their stack using ActivityManager . So, to determine if an activity is the last one: request android.permission.GET_TASKS permissions in the manifest. Use the following code: ActivityManager mngr = (ActivityManager) getSystemService( ACTIVITY_SERVICE );  List<ActivityManager.RunningTaskInfo> taskList = mngr.getRunningTasks(10); if(taskList.get(0).numActivities == 1 && taskList.get(0).topActivity.getClassName().equals(this.getClass().getName())) {             Log.i(TAG, "This is last activity in the stack");  }