Skip to main content

Posts

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");  }

Android-Studio : Error: Could not create the Java Virtual Machine

Solution: Changed below file to modify vm heap option. C:\Program Files\Android\android-studio\bin\studio.exe.vmoptions & increased -Xms128m to -Xms512m and restarted Android Studio. You should create a new environment variable named _JAVA_OPTIONS, set it to -Xms256m -Xmx1024m and it should work. Follow this steps: Run regedit Go to HKEY_CURRENT_USER Select Environment Add a new String Value and enter _JAVA_OPTIONS for Value name Enter -Xms256m -Xmx512m for Value data Reboot computer

Android Studio: Failed to complete Gradle execution

Problem: Failed to complete Gradle execution Cause:  A fatal exception has occurred. Program will exit Solution Go to File -> Settings -> Gradle Input the following in the "Gradle VM options:" box: -XX:MaxHeapSize=256m -Xmx256m Hit apply and Android Studio should build your project successfully.

Android: Place Search using Google Places API

The Google Places API allows you to query for place information on a variety of categories, such as: establishments, prominent points of interest, geographic locations, and much more. You can search for places either by proximity or a text string. A Place Search returns a list of Places along with summary information about each Place; If you want to view additional information it is extracted using Place Details query. An HTTP URL is used for search query specifying the type of Place you are searching, latitude and longitude of your location and radius.The HTTP URL should look like: https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=YourAPIKey Mandatory parameters key — Your application's API key. This key identifies your application for purposes of quota management and so that Places added from your application are made immediately available to your app. Vis...

Android: Adt doesn't create default hello world

Problem While creating project SRC and LAYOUT folder is empty. Solutions Check your Android Developer Tool build version. If it shows v22.3.0m then update your ADT version. This problem was because of New version of SDK and ADT so to update ADT please add this address: https://dl-ssl.google.com/android/eclipse/ ** Be aware it doesn't work with exciting address begin with http so go to Install New software in ADT and do these steps: Then Select this and press Next and Next and accept licence and press finish to download and install: Now after restart ADT if you create a project it will work another problem i saw was the AVD doesn't work correctly you can not add new device to solve this problem run this command from SDK path: ~/Program/android/adt/sdk/tools $ ./android avd After add your device go to ADT and open AVD from eclipse and press Refresh. It should work now.