I have created a Phone & Tablet app for android and have the generic layout folder populated with the layouts, I then created two additional folders in the res directory with the suffix -sw600dp & -sw720dp and it is not working and the app is crashing every time no matter what I try. Can someone please give me some other options.
Log Cat Error:
04-01 02:34:23.567: E/AndroidRuntime(898): FATAL EXCEPTION: main
04-01 02:34:23.567: E/AndroidRuntime(898): java.lang.NullPointerException
04-01 02:34:23.567: E/AndroidRuntime(898): at za.co.astroweb.watsonline.wats_online_fragment$getBlogPosts.onPostExecute(wats_online_fragment.java:173)
04-01 02:34:23.567: E/AndroidRuntime(898): at za.co.astroweb.watsonline.wats_online_fragment$getBlogPosts.onPostExecute(wats_online_fragment.java:1)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.os.AsyncTask.finish(AsyncTask.java:631)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.os.AsyncTask.access$600(AsyncTask.java:177)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.os.Looper.loop(Looper.java:137)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.app.ActivityThread.main(ActivityThread.java:5103)
04-01 02:34:23.567: E/AndroidRuntime(898): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 02:34:23.567: E/AndroidRuntime(898): at java.lang.reflect.Method.invoke(Method.java:525)
04-01 02:34:23.567: E/AndroidRuntime(898): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
04-01 02:34:23.567: E/AndroidRuntime(898): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-01 02:34:23.567: E/AndroidRuntime(898): at dalvik.system.NativeStart.main(Native Method)
Related
this is my log file
04-01 17:21:32.460: E/dalvikvm(296): Could not find class 'android.app.Notification$Builder', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:21:32.470: E/dalvikvm(296): Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:21:32.651: E/AndroidRuntime(296): FATAL EXCEPTION: main
04-01 17:21:32.651: E/AndroidRuntime(296): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tutos.android.gmapv2/com.tutos.android.gmapv2.MyMapActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.os.Looper.loop(Looper.java:123)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-01 17:21:32.651: E/AndroidRuntime(296): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 17:21:32.651: E/AndroidRuntime(296): at java.lang.reflect.Method.invoke(Method.java:521)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-01 17:21:32.651: E/AndroidRuntime(296): at dalvik.system.NativeStart.main(Native Method)
04-01 17:21:32.651: E/AndroidRuntime(296): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:21:32.651: E/AndroidRuntime(296): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:582)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.Activity.setContentView(Activity.java:1647)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.tutos.android.gmapv2.MyMapActivity.onCreate(MyMapActivity.java:19)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-01 17:21:32.651: E/AndroidRuntime(296): ... 11 more
04-01 17:21:32.651: E/AndroidRuntime(296): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 7095000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.common.GooglePlayServicesUtil.zzJ(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.internal.zzx.zzad(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.internal.zzx.zzac(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.dynamic.zza.zza(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.dynamic.zza.onInflate(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
04-01 17:21:32.651: E/AndroidRuntime(296): ... 19 more
04-01 17:25:30.440: E/dalvikvm(305): Could not find class 'android.app.Notification$Builder', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:25:30.460: E/dalvikvm(305): Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:25:30.530: E/AndroidRuntime(305): FATAL EXCEPTION: main
04-01 17:25:30.530: E/AndroidRuntime(305): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tutos.android.gmapv2/com.tutos.android.gmapv2.MyMapActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.os.Looper.loop(Looper.java:123)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-01 17:25:30.530: E/AndroidRuntime(305): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 17:25:30.530: E/AndroidRuntime(305): at java.lang.reflect.Method.invoke(Method.java:521)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-01 17:25:30.530: E/AndroidRuntime(305): at dalvik.system.NativeStart.main(Native Method)
04-01 17:25:30.530: E/AndroidRuntime(305): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:25:30.530: E/AndroidRuntime(305): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:582)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.Activity.setContentView(Activity.java:1647)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.tutos.android.gmapv2.MyMapActivity.onCreate(MyMapActivity.java:19)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-01 17:25:30.530: E/AndroidRuntime(305): ... 11 more
04-01 17:25:30.530: E/AndroidRuntime(305): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 7095000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.common.GooglePlayServicesUtil.zzJ(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.internal.zzx.zzad(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.internal.zzx.zzac(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.dynamic.zza.zza(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.dynamic.zza.onInflate(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
04-01 17:25:30.530: E/AndroidRuntime(305): ... 19 more
Your manifest.xml file is missing the below line, just add it and it should fix your problem.
Edit your application's AndroidManifest.xml file, and add the following declaration within the element. This embeds the version of Google Play services that the app was compiled with.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Android developers guide for more details https://developers.google.com/maps/documentation/android/start
I've been having so much problem with this Live Wallpaper.
I have read alot online about these, and I thought I understood and got them.
When I tried to apply them to this live wallpaper, everything has been going very rough.
I've spent all day and night :-(
Could you someone please help me out?
My goal is to store the new password from edittextpreference to the
Sharedpreference, and then retrieve this password to compared with the login
password to if they are matched.
For example,
I have 2 edittextpreferences:
1) is for create new password which will be saved to the SharedPreference
2) is for login password.
The users will be granted the access when the login password is matched with the
one in the SharedPreference.
Please help me out,
I would be appreciated for your help.
prefs.java Code:
#SuppressWarnings("deprecation")
#Override
protected void onDestroy() {
getPreferenceManager().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(this);
super.onDestroy();
}
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
// TODO Auto-generated method stub
{
}
}
{
SharedPreferences mlogin_password = this.getSharedPreferences("data_storage", MODE_PRIVATE);
Editor login_password = mlogin_password.edit();
login_password.putString("login", "login_pw2");
login_password.commit();
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(Context);
String s = sp.getString("login", null);
Sorry for 10000000 of error codes :-(
Logcat:
at android.util.Log.println_native(Native Method)
at android.util.Log.v(Log.java:117)
at rare_war.weapons.prefs.<init>(prefs.java:60)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at rare_war.weapons.prefs.<init>(prefs.java:65)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at rare_war.weapons.prefs.<init>(prefs.java:65)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:62)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:62)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:62)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:62)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:62)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:64)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getPackageName(ContextWrapper.java:135)
at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
at rare_war.weapons.prefs.<init>(prefs.java:66)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:63)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getPackageName(ContextWrapper.java:135)
at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
at rare_war.weapons.prefs.<init>(prefs.java:65)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
at rare_war.weapons.prefs.<init>(prefs.java:68)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
at rare_war.weapons.prefs.<init>(prefs.java:68)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
at rare_war.weapons.prefs.<init>(prefs.java:68)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
at rare_war.weapons.prefs.<init>(prefs.java:75)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
at rare_war.weapons.prefs.<init>(prefs.java:74)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:68)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:68)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:68)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
at rare_war.weapons.prefs.<init>(prefs.java:75)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at rare_war.weapons.prefs.<init>(prefs.java:68)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
... 11 more
My goal is to store the new password from edittextpreference to the
Sharedpreference...
Not a good idea. You shouldn't store passwords on SharedPreferences
I would suggest using a different approach like storing the encrypted password on a server and then check what the user entered against it.
Please, also make sure you read the Android guide on SharedPreferences
Hi you are saving password on sharedPreference named 'data_storage' and retrieving from default sharedPreference thats why you are not getting saved password.Try to save and retrieve preference value from same sharedPreference.
Why don't you use getSharedPreferences for the key "data_storage" and not for getDefaultSharedPreferences, in other words, Context? I'm not really sure about it, but you should try.
The mechanism works as follows: you save the key under a string name "date_storage" then you retrieve they key. In both cases you need to get the SharedPreferences with the line:
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(Context);
After that use the "sp.get()" methods to get the required value for the saved string key ("data_storage").
I can't find following error in my code. It looks like the problem is in the asynctask onpostexecute.
java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:672)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:368)
at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160)
at android.app.Dialog.dismissDialog(Dialog.java:319)
at android.app.Dialog.dismiss(Dialog.java:302)
at www.mobilezar.mn.Advertisements$InitialLoading.onPostExecute(Advertisements.java:216)
at www.mobilezar.mn.Advertisements$InitialLoading.onPostExecute(Advertisements.java:1)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
when i adding an animation xml file to my project(i was trying scale, rotate, set) and try to launch it in Android 2.1 virtual machine, it crashed with following messages in logcat
05-16 00:14:01.821: E/AndroidRuntime(898): Uncaught handler: thread main exiting due to uncaught exception
05-16 00:14:01.861: E/AndroidRuntime(898): java.lang.RuntimeException: Unable to start activity ComponentInfo{su.k_r.tasstelecom/su.k_r.tasstelecom.CategoriesActivity}: android.view.InflateException: Binary XML file line #31: Error inflating class com.actionbarsherlock.internal.widget.ActionBarView
05-16 00:14:01.861: E/AndroidRuntime(898): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.os.Looper.loop(Looper.java:123)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.app.ActivityThread.main(ActivityThread.java:4363)
05-16 00:14:01.861: E/AndroidRuntime(898): at java.lang.reflect.Method.invokeNative(Native Method)
05-16 00:14:01.861: E/AndroidRuntime(898): at java.lang.reflect.Method.invoke(Method.java:521)
05-16 00:14:01.861: E/AndroidRuntime(898): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
05-16 00:14:01.861: E/AndroidRuntime(898): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-16 00:14:01.861: E/AndroidRuntime(898): at dalvik.system.NativeStart.main(Native Method)
05-16 00:14:01.861: E/AndroidRuntime(898): Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class com.actionbarsherlock.internal.widget.ActionBarView
05-16 00:14:01.861: E/AndroidRuntime(898): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-16 00:14:01.861: E/AndroidRuntime(898): at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1042)
05-16 00:14:01.861: E/AndroidRuntime(898): at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:912)
05-16 00:14:01.861: E/AndroidRuntime(898): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:846)
05-16 00:14:01.861: E/AndroidRuntime(898): at com.actionbarsherlock.app.SherlockListActivity.setContentView(SherlockListActivity.java:212)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.app.ListActivity.ensureList(ListActivity.java:305)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.app.ListActivity.getListView(ListActivity.java:290)
05-16 00:14:01.861: E/AndroidRuntime(898): at su.k_r.tasstelecom.CategoriesActivity.onCreate(CategoriesActivity.java:72)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
05-16 00:14:01.861: E/AndroidRuntime(898): ... 11 more
05-16 00:14:01.861: E/AndroidRuntime(898): Caused by: java.lang.reflect.InvocationTargetException
05-16 00:14:01.861: E/AndroidRuntime(898): at com.actionbarsherlock.internal.widget.ActionBarView.<init>(ActionBarView.java:235)
05-16 00:14:01.861: E/AndroidRuntime(898): at java.lang.reflect.Constructor.constructNative(Native Method)
05-16 00:14:01.861: E/AndroidRuntime(898): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-16 00:14:01.861: E/AndroidRuntime(898): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
05-16 00:14:01.861: E/AndroidRuntime(898): ... 26 more
05-16 00:14:01.861: E/AndroidRuntime(898): Caused by: java.lang.NullPointerException
05-16 00:14:01.861: E/AndroidRuntime(898): at com.actionbarsherlock.internal.widget.ActionBarView$HomeView.setUp(ActionBarView.java:1302)
05-16 00:14:01.861: E/AndroidRuntime(898): ... 30 more
I don't even use animation in code.
Where i'm doing wrong?
In android 4.0 everything works great
Cleaning ABS project fix problem
I'm confused at how to make adview from admob work with a listview. I'm new to ads and have just finished the basic tutorial but now trying to put in in my own app. I have some things commented out that I tried to do to begin with.
// Create the adView
AdView adView = new AdView(this, AdSize.BANNER, myID);
// Lookup your LinearLayout assuming it’s been given
// the attribute android:id="#+id/mainLayout"
// LinearLayout layout = (LinearLayout)findViewById(R.id.linearLayout);
// Add the adView to it
lv.addView(adView);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
<TextView android:id="#+id/itemName" android:layout_width="wrap_content"
android:layout_height="50dip" android:text="Test view"
android:textSize = "25sp"
android:singleLine = "true"/>
04-01 19:28:58.163: ERROR/AndroidRuntime(421): FATAL EXCEPTION: main
04-01 19:28:58.163: ERROR/AndroidRuntime(421):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{org.demo.textaway2/org.demo.textaway2.TextAway2}:
java.lang.UnsupportedOperationException: addView(View) is not
supported in AdapterView 04-01 19:28:58.163:
ERROR/AndroidRuntime(421): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): at
android.app.ActivityThread.access$2300(ActivityThread.java:125) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): at
android.os.Handler.dispatchMessage(Handler.java:99) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
android.os.Looper.loop(Looper.java:123) 04-01 19:28:58.163:
ERROR/AndroidRuntime(421): at
android.app.ActivityThread.main(ActivityThread.java:4627) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
java.lang.reflect.Method.invokeNative(Native Method) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
java.lang.reflect.Method.invoke(Method.java:521) 04-01 19:28:58.163:
ERROR/AndroidRuntime(421): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
dalvik.system.NativeStart.main(Native Method) 04-01 19:28:58.163:
ERROR/AndroidRuntime(421): Caused by:
java.lang.UnsupportedOperationException: addView(View) is not
supported in AdapterView 04-01 19:28:58.163:
ERROR/AndroidRuntime(421): at
android.widget.AdapterView.addView(AdapterView.java:435) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
org.demo.textaway2.TextAway2.onCreate(TextAway2.java:164) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): ... 11 more
The stack trace includes this:
addView(View) is not supported in AdapterView
Which answers your question - you can't use AdMob in an AdapterView or its subclasses, which you're trying to do. You'll either need to write your own View class to render the list objects, use a different ad service (adwhirl etc - perhaps another doesn't have this limitation) or move the ad(s) outside the list, into a footer/header.