After starting to use a new AdMob SDK I noticed the following exception in the Android Market Developer Console:http://www.blogger.com/img/blank.gif
java.lang.NullPointerException
at android.webkit.WebViewDatabase.getCacheTotalSize(WebViewDatabase.java:735)
at android.webkit.CacheManager.trimCacheIfNeeded(CacheManager.java:557)
at android.webkit.WebViewWorker.handleMessage(WebViewWorker.java:195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.os.HandlerThread.run(HandlerThread.java:60)
I solved it using a suggestion I found online. You can use other ways to disable the ads, depending which SDK you use:
Anyhow, as far as I remember this issue was fixed in the Android OS 2.3+, so until this OS version will catch you have to disable the ads to people with this problem.
Wednesday, June 1, 2011
Tuesday, May 24, 2011
Improving Remote Desktop speed on Vista/Win7
A fellow kept complaining that his Remote Desktop (mstsc) connection to the office is super slow. I told him that I had the same problem since I moved from Windows XP to Windows 7 & he found the following solution:
Run the following command line:
netsh interface tcp set global autotuninglevel=disabled
to undo it:
netsh interface tcp set global autotuninglevel=normal
For full details check this post. It's not optimal, but it works & I didn't notice any problem since.
Run the following command line:
netsh interface tcp set global autotuninglevel=disabled
to undo it:
netsh interface tcp set global autotuninglevel=normal
For full details check this post. It's not optimal, but it works & I didn't notice any problem since.
Labels:
RDP,
Windows 7,
Windows Vista
Friday, May 13, 2011
Memory debugging and Android application
Using DDMS
*. Compile & run the application on an enumlator in debug (e.g. Manifest.xml, android:debuggable="true").
*. open DDMS
Checking the heap status:
*. Select your application, click on 'Show heap updates' on the toolbar.
*. Play around with your application and check the results.
Checking the allocations:
*. Select the allocation tracker tab, click on 'Start Tracking'
*. Press 'Get Allocations' when you want to check the allocations.
Note: do not use both heap status & allocations - the heap monitoring will cause a lot of allocations.
*. Compile & run the application on an enumlator in debug (e.g. Manifest.xml, android:debuggable="true").
*. open DDMS
Checking the heap status:
*. Select your application, click on 'Show heap updates' on the toolbar.
*. Play around with your application and check the results.
Checking the allocations:
*. Select the allocation tracker tab, click on 'Start Tracking'
*. Press 'Get Allocations' when you want to check the allocations.
Note: do not use both heap status & allocations - the heap monitoring will cause a lot of allocations.
Labels:
Android
Tuesday, May 3, 2011
Display ListPreference value in the preferences screen
One missing feature in the preferences activity in Android applications is to display the selected value of a ListPreference. By default, to view the selected value of a ListPreference you must click the preference and see what's selected in the combo box.
Here's an example how to create a preferences activity which displays the selected value of any number of ListPreferences in the activity.
Notes:
Here's an example how to create a preferences activity which displays the selected value of any number of ListPreferences in the activity.
public class MyPreferenceActivity extends PreferenceActivity
implements SharedPreferences.OnSharedPreferenceChangeListener {
private ArrayList<ListPreference> mListPreferences;
private String[] mListPreferencesKeys = new String[] {
"prefKey1", // The 'android:key' value of the ListPreference
"prefKey2" // The 'android:key' value of the ListPreference
....
....
....
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
mListPreferences = new ArrayList<ListPreference>();
SharedPreferences sharedPrefs = getPreferenceManager().getSharedPreferences();
sharedPrefs.registerOnSharedPreferenceChangeListener(this);
for (String prefKey : mListPreferencesKeys) {
ListPreference pref = (ListPreference)getPreferenceManager().findPreference(prefKey);
mListPreferences.add(pref);
onSharedPreferenceChanged(sharedPrefs, prefKey);
}
}
@Override
public void onSharedPreferenceChanged(SharedPreferences pref, String prefKey) {
for (ListPreference listPref : mListPreferences) {
if (listPref.getKey().equals(prefKey))
listPref.setSummary(listPref.getEntry());
}
}
}
Notes:
- This code will update the values if the user selects a new value
- If you're defining preferences keys in the strings.xml file, make the mListPreferencesKeys list an integer list, and get the string at run time using 'getString'
Labels:
Android
Wednesday, April 20, 2011
Problem uninstalling android application
From time to time I'm facing an application that refuses to uninstall using the market. Here is the procedure I'm using (if any step works - there's no need to continue):
- Uninstall using the Android Market application
- Uninstall using the settings menu from the home screen: 'Menu' -> 'Settings' -> 'Applications' -> 'Manage Applications' -> select the application & uninstall.
- Uninstall using a 3rd party tool, for example: ASTRO file manager (in the application click 'Menu' -> 'Tools' -> 'Application Manager/Backup' -> long click the application -> 'Uninstall')
- Reboot the phone and try steps 2 & 3 again.
Labels:
Android
Wednesday, April 6, 2011
Performing research on the Android Market
There are various out there that can help perform a research on Android applications.
Update Jan-2013: VisionMobile just lunched a great site for developers called Developer Economics that contain a tools atlas with all the tools that can help the developer.
- Android Market application
- Android Market web site - Has difference number of downloads scale. While the highest value in the Market application is >250K, in the web site there are different values: 50K-100K, 100K-500K, 500K-1M, 1M-5M, 5M-10M, 10M-50M
- AndroLib - Has application rating (stars) history
- AndroidZoom - Has application history: release dates & events (when the application passed a download group (e.g. 10K-50K, 50K-250K).
- AppAnnie - Market analytics (alternatives: Android App Tracker - Has application market ranking history, AndroidRanking.com - Another Android market tracking site).
Update Jan-2013: VisionMobile just lunched a great site for developers called Developer Economics that contain a tools atlas with all the tools that can help the developer.
Labels:
Android
Saturday, April 2, 2011
onActivityResult not called in time
I wrote a small program that needed to use a preference screen. After the preferences were updated the application needs to update. To do that I used startActivityForResult to start the preferences screen, and onActivityResult to update the application.
Problem: onActivityResult wasn't called in time. Using Toast I've noticed it was called BEFORE the preferences screen opens.
Solution: In my case - the application was defined as launchMode=singleInstance, removing this put things back to place.
Note: This is true for Android 2.3.3. I didn't check the documentation to see if it's a normal behavior or an issue.
Problem: onActivityResult wasn't called in time. Using Toast I've noticed it was called BEFORE the preferences screen opens.
Solution: In my case - the application was defined as launchMode=singleInstance, removing this put things back to place.
Note: This is true for Android 2.3.3. I didn't check the documentation to see if it's a normal behavior or an issue.
Labels:
Android
Subscribe to:
Comments (Atom)