Hi i need to bind a value with in dialog header dynamically and even toggle button click events the value want to be changed in textview.. i've got the null pointer exception error.. plz help me to find wat i did wrong ??
dialog = new Dialog(context1);
window = dialog.getWindow();
dialog.requestWindowFeature(dialog.getWindow().FEATURE_CUSTOM_TITLE);
window.setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.lv_train_header);
bindTrainTimings(Area_Index1, Area_Index);
bindTrainTimings(Area_Index, Area_Index1);
tvStart = (TextView) dialog.findViewById(R.id.idTvStart);
tvEnd = (TextView) dialog.findViewById(R.id.idTvEnd);
tg = (ToggleButton) dialog.findViewById(R.id.tglBtn);
dialog.getWindow().getAttributes().windowAnimations = R.style.Animations_SmileWindow;
Log.d("listData111111", "listData.toString()");
tvStart.setText("hello");
tvEnd.setText("hai");
tg.setOnClickListener(new OnClickListener() {
public void onClick(View v) { // TODO Auto-generated method stub //
Log.d("tg.setOnClickListener", "tg.setOnClickListener"); //
Log.d("Toggle loading2", listData1.toString()); if (tg.isChecked()) {
if (Area_Index < Area_Index1) {
customAdapter = new MyCustomAdapter2( Train_Origin_Destination.this,
listData1); } else if (Area_Index > Area_Index1) {
customAdapter = new MyCustomAdapter2( Train_Origin_Destination.this,
listData); } lvTrainTime1.setAdapter(customAdapter);
} else {
if (Area_Index < Area_Index1) {
customAdapter = new MyCustomAdapter2( Train_Origin_Destination.this,
listData); } else if (Area_Index > Area_Index1) {
customAdapter = new MyCustomAdapter2( Train_Origin_Destination.this,
listData1); } lvTrainTime1.setAdapter(customAdapter);
} } });
dialog.show();
LogCat Error :
04-23 11:04:55.753: E/AndroidRuntime(846): FATAL EXCEPTION: main
04-23 11:04:55.753: E/AndroidRuntime(846): java.lang.NullPointerException
04-23 11:04:55.753: E/AndroidRuntime(846): at com.example.train.Train_Origin_Destination.onClick(Train_Origin_Destination.java:570)
04-23 11:04:55.753: E/AndroidRuntime(846): at android.view.View.performClick(View.java:4084)
04-23 11:04:55.753: E/AndroidRuntime(846): at android.view.View$PerformClick.run(View.java:16966)
04-23 11:04:55.753: E/AndroidRuntime(846): at android.os.Handler.handleCallback(Handler.java:615)
04-23 11:04:55.753: E/AndroidRuntime(846): at android.os.Handler.dispatchMessage(Handler.java:92)
04-23 11:04:55.753: E/AndroidRuntime(846): at android.os.Looper.loop(Looper.java:137)
04-23 11:04:55.753: E/AndroidRuntime(846): at android.app.ActivityThread.main(ActivityThread.java:4745)
04-23 11:04:55.753: E/AndroidRuntime(846): at java.lang.reflect.Method.invokeNative(Native Method)
04-23 11:04:55.753: E/AndroidRuntime(846): at java.lang.reflect.Method.invoke(Method.java:511)
04-23 11:04:55.753: E/AndroidRuntime(846): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
04-23 11:04:55.753: E/AndroidRuntime(846): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-23 11:04:55.753: E/AndroidRuntime(846): at dalvik.system.NativeStart.main(Native Method)
.
stackoverflow.comm
No comments:
Post a Comment