Since getActivity().managedQuery is UI Thread Blocking, it gets deprecated in API 15.
So.... how to get the cursor for SimpleCursorAdapter ?!?!?
You can replace the Cursor with CursorLoader, but a lot of work is needed...
Maybe Google should consider restructure SimpleCursorAdapter to meet the loader structure in the next release....
http://mobile.tutsplus.com/tutorials/android/android-sdk_loading-data_cursorloader/
Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts
Saturday, March 23, 2013
Saturday, January 26, 2013
AdMob 中 AdView 在 Proguard 之下的 "Proguard returned with error code 1"
多手升級一下 App 中的 Proguard version 同 AdMob SDK 立即出了:
Proguard returned with error code 1. See console
Note: there were 160 duplicate class definitions.
Warning: com.google.ads.m: can't find referenced class com.google.ads.internal.state.AdState
Warning: com.google.ads.m: can't find referenced class com.google.ads.internal.state.AdState
You should check if you need to specify additional program jars.
Warning: there were 2 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
先在 Project -> Build Path -> Export 中手動加入了
GoogleAdMobAdsSdk-6.2.1.jar
但那Error老在
又修改了一下 proguard-project.txt:
加入了:
-keepattributes *Annotation*
-keep public class com.google.ads.** {*;}
-libraryjars /libs/GoogleAdMobAdsSdk-6.2.1.jar
都无功而返:
只好學一下AdView 中的example 加入一些
-dontpreverify -repackageclasses '
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.content.Context {
public void *(android.view.View);
public void *(android.view.MenuItem);
}
但是............
所以話AdMob 是 Google API 中最失敗的一個
次次要Update 都要花費一些時間.
最後只好問問全能的Google.
Case Close.
Proguard returned with error code 1. See console
Note: there were 160 duplicate class definitions.
Warning: com.google.ads.m: can't find referenced class com.google.ads.internal.state.AdState
Warning: com.google.ads.m: can't find referenced class com.google.ads.internal.state.AdState
You should check if you need to specify additional program jars.
Warning: there were 2 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
先在 Project -> Build Path -> Export 中手動加入了
GoogleAdMobAdsSdk-6.2.1.jar
但那Error老在
又修改了一下 proguard-project.txt:
加入了:
-keepattributes *Annotation*
-keep public class com.google.ads.** {*;}
-libraryjars /libs/GoogleAdMobAdsSdk-6.2.1.jar
都无功而返:
只好學一下AdView 中的example 加入一些
-dontpreverify -repackageclasses '
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.content.Context {
public void *(android.view.View);
public void *(android.view.MenuItem);
}
但是............
所以話AdMob 是 Google API 中最失敗的一個
次次要Update 都要花費一些時間.
最後只好問問全能的Google.
This problem started with AdMob SDK 6.1.0 and 6.2.1 (for Android). To fix the error, add this to your proguard.cfg file:
中文是叫大家加下會的一句在 proguard.cfg:
-dontwarn com.google.ads.**
Case Close.
Wednesday, March 28, 2012
Android :: Hide Virtual Keyboard on App Start ( 隱藏鍵盤)
最近在做一個睇星坐APP, 一開始有一個 edittext, 但一當 load activity 時就該edittext 就立即on focus 彈出 virtual keyboard
google 一下, 只要在Activity::OnCreate 中加入以下 code 即可 !!!
// hidden keyboard
this.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
google 一下, 只要在Activity::OnCreate 中加入以下 code 即可 !!!
// hidden keyboard
this.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Tuesday, February 07, 2012
Set up DfpAdView/AdView of admob
教學有很多, 但大多十分多肺話, 所以我的十分精簡:
1) Reg On Admob site to get the Publisher ID - a14exxxxxxxxxx
2) Mainfest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<activity
android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
3) Add a LinearLayout called ad_layout to the Activity "XML" file that u want to show the ad.
4a) Add the code to the correspondence Activity "JAVA Code" file
------- Field -------
private DfpAdView mAdView;
I----- onCreate ------
final LinearLayout adRow = (LinearLayout) findViewById(R.id.ad_layout);
mAdView = new DfpAdView(this, AdSize.SMART_BANNER, "a14exxxxxxxxxx");
adRow.addView(mAdView);
mAdView.loadAd(new AdRequest());
4b) Change DfpAdView to AdView, if u want AdView
5) Override onDestory
@Override
protected void onDestroy() {
if (mAdView != null) {
mAdView.removeAllViews();
mAdView.destroy();
}
super.onDestroy();
}
6) Run Test !!!!
PS: Add DfpInterstitialAd Later
1) Reg On Admob site to get the Publisher ID - a14exxxxxxxxxx
2) Mainfest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<activity
android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
3) Add a LinearLayout called ad_layout to the Activity "XML" file that u want to show the ad.
4a) Add the code to the correspondence Activity "JAVA Code" file
------- Field -------
private DfpAdView mAdView;
I----- onCreate ------
final LinearLayout adRow = (LinearLayout) findViewById(R.id.ad_layout);
mAdView = new DfpAdView(this, AdSize.SMART_BANNER, "a14exxxxxxxxxx");
adRow.addView(mAdView);
mAdView.loadAd(new AdRequest());
4b) Change DfpAdView to AdView, if u want AdView
5) Override onDestory
@Override
protected void onDestroy() {
if (mAdView != null) {
mAdView.removeAllViews();
mAdView.destroy();
}
super.onDestroy();
}
6) Run Test !!!!
PS: Add DfpInterstitialAd Later
Subscribe to:
Posts (Atom)