Fatal Exception Main (unable to start activity) Caused by: java.lang.NullPointerException - android

i'm noob at android and i face a strange exception when i try to settext or setcolor or anything that was working before
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pageNoSeek = (SeekBar)findViewById(R.id.pageNoSeekBar);
pageNotv = (TextView)findViewById(R.id.pageNotv);
nextButton=(ImageButton)findViewById(R.id.leftButton);
backButton=(ImageButton)findViewById(R.id.rightButton);
mainText = (TextView)findViewById(R.id.mainText);
mainText.setTextColor(Color.RED);
}
as shown in code above there's nothing unusual .. acutally i've used this same code before at another machine .. it gives error at setTextColor or setTextSize if i added it..
> 03-20 07:55:17.552: E/AndroidRuntime(1718): FATAL EXCEPTION: main
03-20 07:55:17.552: E/AndroidRuntime(1718): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.thedarkdimension.keyboardShortcut/com.thedarkdimension.keyboardShortcut.StoryViewController}: java.lang.NullPointerException
03-20 07:55:17.552: E/AndroidRuntime(1718): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-20 07:55:17.552: E/AndroidRuntime(1718): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-20 07:55:17.552: E/AndroidRuntime(1718): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-20 07:55:17.552: E/AndroidRuntime(1718): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-20 07:55:17.552: E/AndroidRuntime(1718): at android.os.Handler.dispatchMessage(Handler.java:99)
03-20 07:55:17.552: E/AndroidRuntime(1718): at android.os.Looper.loop(Looper.java:137)
03-20 07:55:17.552: E/AndroidRuntime(1718): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-20 07:55:17.552: E/AndroidRuntime(1718): at java.lang.reflect.Method.invokeNative(Native Method)
03-20 07:55:17.552: E/AndroidRuntime(1718): at java.lang.reflect.Method.invoke(Method.java:511)
03-20 07:55:17.552: E/AndroidRuntime(1718): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-20 07:55:17.552: E/AndroidRuntime(1718): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-20 07:55:17.552: E/AndroidRuntime(1718): at dalvik.system.NativeStart.main(Native Method)
03-20 07:55:17.552: E/AndroidRuntime(1718): Caused by: java.lang.NullPointerException
03-20 07:55:17.552: E/AndroidRuntime(1718): at com.thedarkdimension.keyboardShortcut.StoryViewController.getNextPage(StoryViewController.java:95)
03-20 07:55:17.552: E/AndroidRuntime(1718): at com.thedarkdimension.keyboardShortcut.StoryViewController.connectToDB(StoryViewController.java:84)
03-20 07:55:17.552: E/AndroidRuntime(1718): at com.thedarkdimension.keyboardShortcut.StoryViewController.onCreate(StoryViewController.java:47)
03-20 07:55:17.552: E/AndroidRuntime(1718): at android.app.Activity.performCreate(Activity.java:5104)
03-20 07:55:17.552: E/AndroidRuntime(1718): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-20 07:55:17.552: E/AndroidRuntime(1718): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-20 07:55:17.552: E/AndroidRuntime(1718): ... 11 more
and i can't get it .. can anyone help :)

From you code snippet for onCreate it seems that you have not called setContentView.
For this reason all calls for (X)findViewById(R.id.x); returns null and thus you are getting a Null Pointer Exception when you try to operate on the variables. [mainText is null since the view was not found].
Solution:
Call setContentView first and then initialize your variables and do the remaining stuff

Related

login with facebook in phonegap 4.2

I am new in phonegap and i am tring to login with facebook in phonegap using phonegap-facebook-plugin
i think there are some problem in my setup.
i have installed this plugin and add plugin in config.xml file.
<gap:plugin name="com.phonegap.plugins.facebookconnect">
<param name="APP_ID" value="1547160042188072" />
<param name="APP_NAME" value="XXXXXXXXXXX" />
</gap:plugin>
there is folder in plugin folder named as com.phonegap.plugins.facebookconnect. so i think plugin is add in project.
here is my html where i call the fb login fuinction
<img src="images/btnFB.png" class="socialimg">
my function is
function fbLogin(){
var fbLoginSuccess = function (userData) {
alert("UserInfo: " + JSON.stringify(userData));
}
facebookConnectPlugin.login(["public_profile"],
fbLoginSuccess,
function (error) { alert("" + error) }
);
}
when i call this function it gives error :
03-20 09:18:05.782: D/CordovaActivity(2607): Resuming the App
03-20 09:18:15.852: W/System.err(2607): java.lang.ClassNotFoundException: org.apache.cordova.facebook.ConnectPlugin
03-20 09:18:15.942: W/System.err(2607): at java.lang.Class.classForName(Native Method)
03-20 09:18:15.942: W/System.err(2607): at java.lang.Class.forName(Class.java:251)
03-20 09:18:15.962: W/System.err(2607): at java.lang.Class.forName(Class.java:216)
03-20 09:18:15.962: W/System.err(2607): at org.apache.cordova.PluginManager.instantiatePlugin(PluginManager.java:345)
03-20 09:18:15.962: W/System.err(2607): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:189)
03-20 09:18:15.982: W/System.err(2607): at org.apache.cordova.PluginManager.exec(PluginManager.java:137)
03-20 09:18:15.982: W/System.err(2607): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
03-20 09:18:15.992: W/System.err(2607): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:40)
03-20 09:18:15.992: W/System.err(2607): at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
03-20 09:18:15.992: W/System.err(2607): at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
03-20 09:18:15.992: W/System.err(2607): at android.os.Handler.dispatchMessage(Handler.java:102)
03-20 09:18:15.992: W/System.err(2607): at android.os.Looper.loop(Looper.java:136)
03-20 09:18:15.992: W/System.err(2607): at android.os.HandlerThread.run(HandlerThread.java:61)
03-20 09:18:15.992: W/System.err(2607): Caused by: java.lang.NoClassDefFoundError: org/apache/cordova/facebook/ConnectPlugin
03-20 09:18:15.992: W/System.err(2607): ... 13 more
03-20 09:18:16.022: W/System.err(2607): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.cordova.facebook.ConnectPlugin" on path: DexPathList[[zip file "/data/app/com.syonserver.couponspring-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.syonserver.couponspring-1, /system/lib]]
03-20 09:18:16.042: W/System.err(2607): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-20 09:18:16.042: W/System.err(2607): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
03-20 09:18:16.042: W/System.err(2607): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
03-20 09:18:16.042: W/System.err(2607): ... 13 more
03-20 09:18:16.052: I/System.out(2607): Error adding plugin org.apache.cordova.facebook.ConnectPlugin.
03-20 09:18:16.052: W/System.err(2607): java.lang.NullPointerException
03-20 09:18:16.052: W/System.err(2607): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:191)
03-20 09:18:16.052: W/System.err(2607): at org.apache.cordova.PluginManager.exec(PluginManager.java:137)
03-20 09:18:16.052: W/System.err(2607): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
03-20 09:18:16.052: W/System.err(2607): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:40)
03-20 09:18:16.052: W/System.err(2607): at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
03-20 09:18:16.062: W/System.err(2607): at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
03-20 09:18:16.062: W/System.err(2607): at android.os.Handler.dispatchMessage(Handler.java:102)
03-20 09:18:16.062: W/System.err(2607): at android.os.Looper.loop(Looper.java:136)
03-20 09:18:16.062: W/System.err(2607): at android.os.HandlerThread.run(HandlerThread.java:61)
please help.
It's looking for your ConnectPlugin class to be in the org.apache.cordova.facebook namespace. Check either what you have set for the package at the top of your ConnectPlugin.java file or under the org.apache.cordova.facebook namespace is there any file named ConnectPlugin.java.
The moto is that you have to kept a file under the org.apache.cordova.facebook namespace and name should be ConnectPlugin.java

Android Eclipse application, compatible error

I'm developing Android app just for hobby, and I made an app, when I test on my phones works well, I tested on :
Alcatel idol OneTouch 2S ( 6050y )
Sony Xperia Tipo ( st21i )
Samsung Galaxy Ace
Asus Memo Pad HD7 (Tablet)
Works great, and no error at all...
but when I tested on Samsung Galaxy S4, and Samsung Galaxy S3..
no background music (on Galaxy S4 and no background pics are shown ), and what I click I see report error message so application crushes..
Error Log:
03-20 16:55:07.366: D/skia(29417): --- allocation failed for scaled bitmap
03-20 16:55:07.376: D/AndroidRuntime(29417): Shutting down VM
03-20 16:55:07.376: W/dalvikvm(29417): threadid=1: thread exiting with uncaught exception (group=0x4206c700)
03-20 16:55:07.391: E/AndroidRuntime(29417): FATAL EXCEPTION: main
03-20 16:55:07.391: E/AndroidRuntime(29417): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.**********a/com.***********a.Info}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.app.ActivityThread.access$700(ActivityThread.java:159)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.os.Handler.dispatchMessage(Handler.java:99)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.os.Looper.loop(Looper.java:176)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.app.ActivityThread.main(ActivityThread.java:5419)
03-20 16:55:07.391: E/AndroidRuntime(29417): at java.lang.reflect.Method.invokeNative(Native Method)
03-20 16:55:07.391: E/AndroidRuntime(29417): at java.lang.reflect.Method.invoke(Method.java:525)
03-20 16:55:07.391: E/AndroidRuntime(29417): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
03-20 16:55:07.391: E/AndroidRuntime(29417): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
03-20 16:55:07.391: E/AndroidRuntime(29417): at dalvik.system.NativeStart.main(Native Method)
03-20 16:55:07.391: E/AndroidRuntime(29417): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.view.LayoutInflater.createView(LayoutInflater.java:626)
03-20 16:55:07.391: E/AndroidRuntime(29417): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
03-20 16:55:07.391: E/AndroidRuntime(29417): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:361)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.app.Activity.setContentView(Activity.java:1956)
03-20 16:55:07.391: E/AndroidRuntime(29417): at *********.Info.onCreate(Info.java:16)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.app.Activity.performCreate(Activity.java:5372)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
03-20 16:55:07.391: E/AndroidRuntime(29417): ... 11 more
03-20 16:55:07.391: E/AndroidRuntime(29417): Caused by: java.lang.reflect.InvocationTargetException
03-20 16:55:07.391: E/AndroidRuntime(29417): at java.lang.reflect.Constructor.constructNative(Native Method)
03-20 16:55:07.391: E/AndroidRuntime(29417): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.view.LayoutInflater.createView(LayoutInflater.java:600)
03-20 16:55:07.391: E/AndroidRuntime(29417): ... 23 more
03-20 16:55:07.391: E/AndroidRuntime(29417): Caused by: java.lang.OutOfMemoryError
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:832)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.content.res.Resources.loadDrawable(Resources.java:2988)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.view.View.<init>(View.java:3563)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.view.ViewGroup.<init>(ViewGroup.java:475)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.widget.LinearLayout.<init>(LinearLayout.java:176)
03-20 16:55:07.391: E/AndroidRuntime(29417): at android.widget.LinearLayout.<init>(LinearLayout.java:172)
03-20 16:55:07.391: E/AndroidRuntime(29417): ... 26 more
Please any help ?

Store/Save & Retrieve to/from SharedPreference Failure

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").

Binary XML file line #7: Error inflating class fragment

i do everything, research every but still not working. i read many page from here but not :(
I tried every solution.
Error logs:
03-20 14:46:49.627: I/Process(1895): Sending signal. PID: 1895 SIG: 9
03-20 14:46:59.608: E/Trace(1937): error opening trace file: No such file or directory (2)
03-20 14:46:59.608: W/Trace(1937): Unexpected value from nativeGetEnabledTags: 0
03-20 14:46:59.608: W/Trace(1937): Unexpected value from nativeGetEnabledTags: 0
03-20 14:46:59.608: W/Trace(1937): Unexpected value from nativeGetEnabledTags: 0
03-20 14:46:59.707: W/Trace(1937): Unexpected value from nativeGetEnabledTags: 0
03-20 14:46:59.707: W/Trace(1937): Unexpected value from nativeGetEnabledTags: 0
03-20 14:47:00.207: D/AndroidRuntime(1937): Shutting down VM
03-20 14:47:00.217: W/dalvikvm(1937): threadid=1: thread exiting with uncaught exception (group=0xb5dcc908)
03-20 14:47:00.327: E/AndroidRuntime(1937): FATAL EXCEPTION: main
03-20 14:47:00.327: E/AndroidRuntime(1937): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.panetest/com.example.panetest.PaneTest}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.os.Handler.dispatchMessage(Handler.java:99)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.os.Looper.loop(Looper.java:137)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-20 14:47:00.327: E/AndroidRuntime(1937): at java.lang.reflect.Method.invokeNative(Native Method)
03-20 14:47:00.327: E/AndroidRuntime(1937): at java.lang.reflect.Method.invoke(Method.java:511)
03-20 14:47:00.327: E/AndroidRuntime(1937): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-20 14:47:00.327: E/AndroidRuntime(1937): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-20 14:47:00.327: E/AndroidRuntime(1937): at dalvik.system.NativeStart.main(Native Method)
03-20 14:47:00.327: E/AndroidRuntime(1937): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-20 14:47:00.327: E/AndroidRuntime(1937): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Activity.setContentView(Activity.java:1881)
03-20 14:47:00.327: E/AndroidRuntime(1937): at com.example.panetest.PaneTest.onCreate(PaneTest.java:16)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Activity.performCreate(Activity.java:5104)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-20 14:47:00.327: E/AndroidRuntime(1937): ... 11 more
03-20 14:47:00.327: E/AndroidRuntime(1937): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.example.panetest.FirstPane: make sure class name exists, is public, and has an empty constructor that is public
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Fragment.instantiate(Fragment.java:592)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Fragment.instantiate(Fragment.java:560)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Activity.onCreateView(Activity.java:4709)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-20 14:47:00.327: E/AndroidRuntime(1937): ... 21 more
03-20 14:47:00.327: E/AndroidRuntime(1937): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.panetest.FirstPane" on path: /data/app/com.example.panetest-1.apk
03-20 14:47:00.327: E/AndroidRuntime(1937): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
03-20 14:47:00.327: E/AndroidRuntime(1937): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-20 14:47:00.327: E/AndroidRuntime(1937): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Fragment.instantiate(Fragment.java:582)
03-20 14:47:00.327: E/AndroidRuntime(1937): ... 24 more
activity_pane_test.xml
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/slidingpanelayout">
<fragment android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.panetest.FirstPane"
android:id="#+id/fragment_firstpane"/>
<fragment android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.panetest.SecondPane"
android:id="#+id/fragment_secondpane"/>
PaneTest.java
package com.example.panetest;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.widget.SlidingPaneLayout;
import android.view.Menu;
public class PaneTest extends Activity {
SlidingPaneLayout pane; #Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pane_test);
pane = (SlidingPaneLayout) findViewById(R.id.slidingpanelayout);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.pane_test, menu);
return true;
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.panetest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.panetest.PaneTest"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Please anyone provide solution.
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.panetest.FirstPane" on path: /data/app/com.example.panetest-1.apk
Your project does not seem to have a class FirstPane in package com.example.panetest.

App Crashes after moving an image button! android

So my app Ive been developing lately is going great, and I just updated the image in the background of the app. Well the app was working right before I tweaked an image button to line up with this image I made. Right after I moved it, the app will no longer work and I have tried everything with no success. Here is the xml of the activity
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/title_screen"
tools:context=".TitleScreen" >
<TextView
android:id="#+id/txtCoins"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="18dp"
android:layout_marginTop="11dp"
android:text="000"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#f3c50d"
android:textSize="12sp" />
<ImageButton
android:id="#+id/imageBtnPlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txtCoins"
android:layout_centerHorizontal="true"
android:layout_marginTop="51dp"
android:background="#null"
android:src="#drawable/btn_play" />
</RelativeLayout>
EDIT: Here is my logcat
03-20 17:08:29.847: W/dalvikvm(28692): threadid=1: thread exiting with uncaught exception (group=0x416282a0)
03-20 17:08:29.852: E/AndroidRuntime(28692): FATAL EXCEPTION: main
03-20 17:08:29.852: E/AndroidRuntime(28692): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ChonBonStudios.Tidbits/com.ChonBonStudios.Tidbits.TitleScreen}: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.ImageButton
03-20 17:08:29.852: E/AndroidRuntime(28692): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
03-20 17:08:29.852: E/AndroidRuntime(28692): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
03-20 17:08:29.852: E/AndroidRuntime(28692): at android.app.ActivityThread.access$600(ActivityThread.java:140)
03-20 17:08:29.852: E/AndroidRuntime(28692): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
03-20 17:08:29.852: E/AndroidRuntime(28692): at android.os.Handler.dispatchMessage(Handler.java:99)
03-20 17:08:29.852: E/AndroidRuntime(28692): at android.os.Looper.loop(Looper.java:137)
03-20 17:08:29.852: E/AndroidRuntime(28692): at android.app.ActivityThread.main(ActivityThread.java:4898)
03-20 17:08:29.852: E/AndroidRuntime(28692): at java.lang.reflect.Method.invokeNative(Native Method)
03-20 17:08:29.852: E/AndroidRuntime(28692): at java.lang.reflect.Method.invoke(Method.java:511)
03-20 17:08:29.852: E/AndroidRuntime(28692): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
03-20 17:08:29.852: E/AndroidRuntime(28692): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
03-20 17:08:29.852: E/AndroidRuntime(28692): at dalvik.system.NativeStart.main(Native Method)
03-20 17:08:29.852: E/AndroidRuntime(28692): Caused by: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.ImageButton
03-20 17:08:29.852: E/AndroidRuntime(28692): at com.ChonBonStudios.Tidbits.TitleScreen.onCreate(TitleScreen.java:20)
03-20 17:08:29.852: E/AndroidRuntime(28692): at android.app.Activity.performCreate(Activity.java:5191)
03-20 17:08:29.852: E/AndroidRuntime(28692): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
03-20 17:08:29.852: E/AndroidRuntime(28692): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
03-20 17:08:29.852: E/AndroidRuntime(28692): ... 11 more
android.widget.TextView cannot be cast to android.widget.ImageButton
You are casting to the wrong class in your activity change TextView to ImageButton somewhere in com.ChonBonStudios.Tidbits.TitleScreen class.
this is a common issue. Clean your project by selecting Project - Clean and it will work. And like gpasci said, check if you initialize your fields correctly
If I understand you correctly you just have switched the position of the TextView and the ImageButton in the layout, no code changes.
Try to simply clean the project and/or restart Eclipse. Sometimes I had a similar problem where the auto-generated Ids were just ouf of sync and that's the reason why a findViewById(R.id.imageBtnPlay) actually returns the TextView.

Categories

Resources