button - Android NPE TypeFace -
I set a font from each asset folder, present the button button, I do not understand That is why I get a NPE in line 56 this is: 04-25 18: 18: 49.983: E / Android Time (1853): Reason by: Java.lang.NullPointerException Enter the code here -25 18: 18: 49.983: E / Android Random (1853 ): On the main. Login. Context (login .java 56) Your findViewById has failed, either because you did not set the content view Or because you use the ID that does not exist. Remember that the execution () function does not end in execution - to do that you need to return, so if you go to that branch if / else you never show content view and ViewById is never empty Will not done. / P> pswet.setTypeface (tf); Where am I wrong?
@ Override protected zero on creet {bundle saved instenstate} {super. Contents (Saved Instance State); Shared shared contexts Prefs = getSharedPreferences ("SharedPrefName", MODE_PRIVATE); Boolean value; String name = getPackageName () + "_PREFERENCES"; Shared References SP = getSharedPreferences (name, MODE_PRIVATE); // Control if there is no password (! Sp.contains (Util.PREF_PSW) || "" .equals (sp.getString (Util.PREF_PSW, null)) {intent intention = new intent (this, MainActivity.class ); StartActivity; End(); // Check if the key is not / have not been placed for the password; if (value = sharedPrefs.getBoolean ("check", true)) {setContentView (R.layout.tastiera_password); } Other {intention intent = new intent (this, main activity category); StartActivity; End(); Typeface TF = typeAssets (), "roboto.ttf"); PswET = (TextView) findViewById (R.id.psw); Pswet.setTypeface (tf); BB1 = (button) Find VVBIID (RIDB1); Bb1.setTypeface (tf); BB2 = (find buttons) VVBIID (RID. B2); Bb2.setTypeface (tf); BB3 = Find (VBBID) (RDB3); Bb3.setTypeface (tf); Find BB4 = (button) VVBIID (RID.B4); Bb4.setTypeface (tf); BB5 = (button) Find VVBIID (RID.B5); Bb5.setTypeface (tf); BB6 = (button) Find VVBIID (RID.B6); Bb6.setTypeface (tf); BB7 = (Find Button) VVBIID (RID.B7); Bb7.setTypeface (tf); BB 8 = (VoWBIID) (RID. B8); Bb8.setTypeface (tf); BB 9 = Find (VVBiID) (RID. B9); Bb9.setTypeface (tf); BB = 0 (find buttons) VVBIID (RIDB); Bb0.setTypeface (tf); // Set listener for all button int numbersBatone [] = {RID.B1, RID. B2, RID.B3, RID.B4, RID.B5, R.D.B. 6, RID. B7, RID B8, RID B9, RIDB;}; Number buttonClickListered NumberClickListon = new numberButtonClicklist (); (For int id: numberbutton) {see v = searchwbiid; V.setOnClickListener (numberClickListener); }} Private class numberButtonClickLastner enforces OnClickListener {@Override Public Zero (click V) {string text = (string) ((button) v) .getText (); SetCurrentString (getCurrentString () + text); } Public Zero Setset string (string S) {currentString = s; Pswet.setText (s); } Public string getCurrentString () {currentString return}; }}
Comments
Post a Comment