android - Launching another Activity creates a blank screen and crashes -
UPDATE: Fixed, this was due to missing properties in the views and I do not know how the debugger works: )
I'm really new to Android. I've just completed the Notepad tutorial and doing something like that (most codes are exactly the same). Events through which I am going:
- Debug app
- Click on the menu, which contains the correct item
- Click on Insert New activity opens (GoalEdit)
- I hit a breakpoint on the first line of
GoalEdit.onCreate
and get these warnings:
a. (Activity Manager) The launch timeout has ended, keep awake!
b (ActivityManager) Activity Record Timeline {...} - I have a breakpack in
setContentView
in GoalEdit.onCreate - passed this After being:
A activityTrade. Fo: Source not found.
The related code is below:
GoalsList.java
/ ** * of this activity Add a menu for * / @ override public boolean on cret option menu (menu menu) {super.onCreateOptionsMenu (menu); Menu.add (0, INSERT_ID, 0, R.string.menu_insert); Back true; } / ** * Select the menu item (menu item item) {Switch (ITATIID)} {Case INSERT_ID: createGoal; menu item selected from menu item-selected event * / @ override public boolean. Back true; } Return super. Paramountime selected (feature ID, item); } / ** * Edit activity to create a new goal * Open / Personal Zero () {Intent I = new intent (this, GoalEdit.class); StartActivityForResult (i, ACTIVITY_CREATE); }
GoalEdit.java
@ override protected zero creation (bundle savedinstenstate) {super.onCreate (savedInstanceState ); MDbGoals = New GoDDbTable (this); MDbGoals.open (); SetContentView (R.layout.goal_edit); MName = (edit text) findViewById (R.id.name); Button Finish BTN = (Find Button) VVBIID (R. Diffinish); MRowId = (saved instenstat == empty)? Empty: (Long) Saved InstantState. Get Serializable (GoalDbTable.KEY_ROWID); If (mRowId == faucet) {Bundle Extras = Milentant (). GetExtras (); MRowId = (extra! = Null)? Extras.getLong (GoalDbTable.KEY_ROWID): empty; } PopulateFields (); FinishBtn.setOnClickListener (see new. OnClickListener () {@Override Click Public Zero (see V) {Set Result (RESULT_OK); Finish ();}}) } Private Zero populateFields () {if (mRowId! = Null) {cursor target = MDB authorization.find (mRowId); StartManagingCursor (target); MName.setText (target.getstring (goal.getColumnIndexOrThrow (GoalDbTable.KEY_NAME))); }} @ Override Resume at Zero () {Super. Rebirth (); PopulateFields (); }
I think the error is that it can not get GoalEdit (although it can clearly do this). Is there any clear evidence in my code (or should I look at other things)?
Edit: Find out how to use a debugger is a bit better, some have to start over again to display exceptions more often. .mygoals / com.rossmasters.mygoals.GoalEdit}: java.lang.RuntimeException: Binary XML file line # 9: You must supply the layout_width feature.
I'm not sure what file is, however, I've added layout_width's
to each item.
Ross enables your logcat and what is your problem,
Window> Show view> Other> Android> Logcat
You may miss a property in your target_edit.example layout
/ Html>
Comments
Post a Comment