last day (14 days later) » 

9:34 AM
0
A: java.lang.NullPointerException in SimonVT menuDrawer?

FireSunReplace toggleButton = (ToggleButton) findViewById(R.id.toggleButton1); registerNewAccount = (RelativeLayout) findViewById(R.id.registerNewAccount); with View menuLayout = LayoutInflater.from(this).inflate(R.layout.slide_menu,null); toggleButton = (ToggleButton) menuLayout.findViewById(R.i...

 
Giving error: Error:(867, 86) <identifier> expectedLayoutInflater.from(this).inflate(R.layout.slide_menu.null);
 
Sorry,I missed a dot syntax.Now will be right.
 
still getting same error.
 
Sorry,please try again.
 
I mean my app is crashing and giving the same log as mentioned in my question.
 
9:34 AM
The error log show the error is in a method called slideMenu and in line 864,it may be not your toggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton arg0, boolean isChecked) { // text.setText("Status: " + isChecked); } });
 
Yes,the error is in this method.
Hi there
 
Then what is your line 864 code?
 
toggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

@Override
public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
// text.setText("Status: " + isChecked);
}
});
above is my line 864 code
 
Are you sure toggleButton is null?
 
Actully it work fine for registeredNewAccount,but when i add any other layout it gives null exception
are you understanding?
 
9:38 AM
Sorry,I didn't
So you'd better explain when your app will crash in your question
 
ok,I'm saying in slide_menu.xml i have 3 layouts like layout1,layout2 and layout3.they are working fine when i'm using method onclickListner but when i try to add layout4 that is toggleButton it gives null exception i don't know why
have you understood now?
 
Please show your code.
 
ok
public void slideMenu() {

mDrawer = MenuDrawer.attach(this, Position.RIGHT);
mDrawer.setContentView(R.layout.pro);
mDrawer.setMenuView(R.layout.slide_menu);
mDrawer.setMenuSize(600);
// toggleButton = (ToggleButton) findViewById(R.id.toggleButton1);
registerNewAccount = (RelativeLayout) findViewById(R.id.registerNewAccount);
becomeAnAgent = (RelativeLayout) findViewById(R.id.becomeAnAgent);
logout = (Button) findViewById(R.id.logout);
search_button = (Button) findViewById(R.id.searchButton);
becomeAnAgent.setOnClickListener(new View.OnClickListener() {
}
you want xml code also
?
 
I didn't see your code for adding another layout?
 
9:57 AM
registerNewAccount = (RelativeLayout) findViewById(R.id.registerNewAccount);
becomeAnAgent = (RelativeLayout) findViewById(R.id.becomeAnAgent);
these are the layout which i added.
 
Sorry,I can't understand your question and why your app crash.I think you should explain more clearly in stackoverflow so that others can help you easier.
 
Thanks for your help
 

last day (14 days later) »