Android findviewbyid提供空值
我有一个活动及其布局。我在此布局中包含了一个视图,该视图在所有活动中都很常见,用于显示错误消息。此通用视图在所有活动中都可以正常工作,但在一个活动中,findviewby id为该视图的空值。我尝试了很多次,但无法跟踪问题所在。请查看代码如果有人能给我一些建议,这是密码 活动:Android findviewbyid提供空值,android,android-layout,nullpointerexception,android-relativelayout,Android,Android Layout,Nullpointerexception,Android Relativelayout,我有一个活动及其布局。我在此布局中包含了一个视图,该视图在所有活动中都很常见,用于显示错误消息。此通用视图在所有活动中都可以正常工作,但在一个活动中,findviewby id为该视图的空值。我尝试了很多次,但无法跟踪问题所在。请查看代码如果有人能给我一些建议,这是密码 活动: public class VerificationCodeActivity extends Activity { TextView resend_code,other_numbers; EditText
public class VerificationCodeActivity extends Activity {
TextView resend_code,other_numbers;
EditText vc_code1,vc_code2,vc_code3,vc_code4;
Button verify_code;
RelativeLayout error_layout;
TextView error_textview;
Button close_error_button;
Context ctx =this;
String confirmCode;
Bundle bundle;
String usernumber,countrycode,tempid;
ArrayList<String>other_numebr_list;
String accessType;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
setContentView(R.layout.verification_code_layout);
init();
super.onCreate(savedInstanceState);
}
void init()
{
resend_code = (TextView)findViewById(R.id.vc_resend_button);
resend_code.setPaintFlags(resend_code.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
error_textview = (TextView)findViewById(R.id.error_text);
//here is the layout
error_layout=(RelativeLayout)findViewById(R.id.error_layout);
close_error_button= (Button)findViewById(R.id.close_button);
}
}
void showErrorMessage(Boolean showm,String message )
{
if(showm)
{
error_textview.setText(message);
CommonUtility.expand(error_layout);
}
else{
CommonUtility.collapse(error_layout);
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical"
android:padding="@dimen/padding_all" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/vc_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:padding="1dp"
android:text="@string/vc_message"
android:textColor="@android:color/white" />
<include
android:id="@+id/vc__em_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
layout="@layout/error_message_layout"
android:visibility="gone" />
<LinearLayout
android:id="@+id/vc_code_layout"
android:layout_width="fill_parent"
android:layout_height="@dimen/edit_box_height"
android:layout_marginTop="@dimen/margin_top"
android:background="@drawable/curve_corner_shape_layout" >
<EditText
android:id="@+id/vc_code1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
<LinearLayout
android:layout_width="@dimen/partition_line_width"
android:layout_height="fill_parent"
android:background="@android:color/white" >
</LinearLayout>
<EditText
android:id="@+id/vc_code2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
<LinearLayout
android:layout_width="@dimen/partition_line_width"
android:layout_height="fill_parent"
android:background="@android:color/white" >
</LinearLayout>
<EditText
android:id="@+id/vc_code3"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
<LinearLayout
android:layout_width="@dimen/partition_line_width"
android:layout_height="fill_parent"
android:background="@android:color/white" >
</LinearLayout>
<EditText
android:id="@+id/vc_code4"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/options"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/vc_othernumber_option"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:layout_weight=".5"
android:gravity="left"
android:padding="1dp"
android:text="@string/other_number"
android:textColor="@android:color/white"
android:visibility="gone" />
<TextView
android:id="@+id/vc_resend_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:layout_weight=".5"
android:gravity="right"
android:padding="1dp"
android:text="@string/resend"
android:textColor="@android:color/white" />
</LinearLayout>
<Button
android:id="@+id/vc_verifycode_button"
android:layout_width="fill_parent"
android:layout_height="@dimen/button_height"
android:layout_below="@id/options"
android:layout_marginTop="@dimen/margin_top"
android:background="@drawable/button_selector"
android:text="@string/verify_text"
android:textColor="@android:color/white"
android:textSize="@dimen/button_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:background="@drawable/logo_s" />
</LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/error_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/curve_corner_shape_errormsg"
android:gravity="center_vertical"
android:paddingBottom="@dimen/padding_bottom_em"
android:paddingLeft="@dimen/padding_left_em"
android:paddingRight="@dimen/padding_right_em"
android:paddingTop="@dimen/padding_top_em" >
<TextView
android:id="@+id/error_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="left|center_vertical"
android:paddingRight="@dimen/right_padding_em"
android:text="Invalid userName"
android:textColor="@android:color/white"
android:textSize="@dimen/textsize_em" />
<Button
android:id="@+id/close_button"
android:layout_width="@dimen/close_button_width"
android:layout_height="@dimen/close_button_height"
android:layout_marginTop="@dimen/close_button_margin_top"
android:layout_alignParentRight="true"
android:background="@drawable/close" />
</RelativeLayout>
10-07 17:44:04.430: E/AndroidRuntime(22640): java.lang.NullPointerException
10-07 17:44:04.430: E/AndroidRuntime(22640): at commonUtilities.CommonUtility.expand(CommonUtility.java:86)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.phone91new.VerificationCodeActivity.showErrorMessage(VerificationCodeActivity.java:244)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.phone91new.VerificationCodeActivity$VerifyCode.onPostExecute(VerificationCodeActivity.java:264)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.phone91new.VerificationCodeActivity$VerifyCode.onPostExecute(VerificationCodeActivity.java:1)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.AsyncTask.finish(AsyncTask.java:631)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.AsyncTask.access$600(AsyncTask.java:177)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.Handler.dispatchMessage(Handler.java:99)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.Looper.loop(Looper.java:155)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.app.ActivityThread.main(ActivityThread.java:5520)
10-07 17:44:04.430: E/AndroidRuntime(22640): at java.lang.reflect.Method.invokeNative(Native Method)
10-07 17:44:04.430: E/AndroidRuntime(22640): at java.lang.reflect.Method.invoke(Method.java:511)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
}
}
布局:
public class VerificationCodeActivity extends Activity {
TextView resend_code,other_numbers;
EditText vc_code1,vc_code2,vc_code3,vc_code4;
Button verify_code;
RelativeLayout error_layout;
TextView error_textview;
Button close_error_button;
Context ctx =this;
String confirmCode;
Bundle bundle;
String usernumber,countrycode,tempid;
ArrayList<String>other_numebr_list;
String accessType;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
setContentView(R.layout.verification_code_layout);
init();
super.onCreate(savedInstanceState);
}
void init()
{
resend_code = (TextView)findViewById(R.id.vc_resend_button);
resend_code.setPaintFlags(resend_code.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
error_textview = (TextView)findViewById(R.id.error_text);
//here is the layout
error_layout=(RelativeLayout)findViewById(R.id.error_layout);
close_error_button= (Button)findViewById(R.id.close_button);
}
}
void showErrorMessage(Boolean showm,String message )
{
if(showm)
{
error_textview.setText(message);
CommonUtility.expand(error_layout);
}
else{
CommonUtility.collapse(error_layout);
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical"
android:padding="@dimen/padding_all" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/vc_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:padding="1dp"
android:text="@string/vc_message"
android:textColor="@android:color/white" />
<include
android:id="@+id/vc__em_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
layout="@layout/error_message_layout"
android:visibility="gone" />
<LinearLayout
android:id="@+id/vc_code_layout"
android:layout_width="fill_parent"
android:layout_height="@dimen/edit_box_height"
android:layout_marginTop="@dimen/margin_top"
android:background="@drawable/curve_corner_shape_layout" >
<EditText
android:id="@+id/vc_code1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
<LinearLayout
android:layout_width="@dimen/partition_line_width"
android:layout_height="fill_parent"
android:background="@android:color/white" >
</LinearLayout>
<EditText
android:id="@+id/vc_code2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
<LinearLayout
android:layout_width="@dimen/partition_line_width"
android:layout_height="fill_parent"
android:background="@android:color/white" >
</LinearLayout>
<EditText
android:id="@+id/vc_code3"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
<LinearLayout
android:layout_width="@dimen/partition_line_width"
android:layout_height="fill_parent"
android:background="@android:color/white" >
</LinearLayout>
<EditText
android:id="@+id/vc_code4"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/options"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/vc_othernumber_option"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:layout_weight=".5"
android:gravity="left"
android:padding="1dp"
android:text="@string/other_number"
android:textColor="@android:color/white"
android:visibility="gone" />
<TextView
android:id="@+id/vc_resend_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:layout_weight=".5"
android:gravity="right"
android:padding="1dp"
android:text="@string/resend"
android:textColor="@android:color/white" />
</LinearLayout>
<Button
android:id="@+id/vc_verifycode_button"
android:layout_width="fill_parent"
android:layout_height="@dimen/button_height"
android:layout_below="@id/options"
android:layout_marginTop="@dimen/margin_top"
android:background="@drawable/button_selector"
android:text="@string/verify_text"
android:textColor="@android:color/white"
android:textSize="@dimen/button_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:background="@drawable/logo_s" />
</LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/error_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/curve_corner_shape_errormsg"
android:gravity="center_vertical"
android:paddingBottom="@dimen/padding_bottom_em"
android:paddingLeft="@dimen/padding_left_em"
android:paddingRight="@dimen/padding_right_em"
android:paddingTop="@dimen/padding_top_em" >
<TextView
android:id="@+id/error_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="left|center_vertical"
android:paddingRight="@dimen/right_padding_em"
android:text="Invalid userName"
android:textColor="@android:color/white"
android:textSize="@dimen/textsize_em" />
<Button
android:id="@+id/close_button"
android:layout_width="@dimen/close_button_width"
android:layout_height="@dimen/close_button_height"
android:layout_marginTop="@dimen/close_button_margin_top"
android:layout_alignParentRight="true"
android:background="@drawable/close" />
</RelativeLayout>
10-07 17:44:04.430: E/AndroidRuntime(22640): java.lang.NullPointerException
10-07 17:44:04.430: E/AndroidRuntime(22640): at commonUtilities.CommonUtility.expand(CommonUtility.java:86)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.phone91new.VerificationCodeActivity.showErrorMessage(VerificationCodeActivity.java:244)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.phone91new.VerificationCodeActivity$VerifyCode.onPostExecute(VerificationCodeActivity.java:264)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.phone91new.VerificationCodeActivity$VerifyCode.onPostExecute(VerificationCodeActivity.java:1)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.AsyncTask.finish(AsyncTask.java:631)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.AsyncTask.access$600(AsyncTask.java:177)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.Handler.dispatchMessage(Handler.java:99)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.Looper.loop(Looper.java:155)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.app.ActivityThread.main(ActivityThread.java:5520)
10-07 17:44:04.430: E/AndroidRuntime(22640): at java.lang.reflect.Method.invokeNative(Native Method)
10-07 17:44:04.430: E/AndroidRuntime(22640): at java.lang.reflect.Method.invoke(Method.java:511)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
}
日志:
public class VerificationCodeActivity extends Activity {
TextView resend_code,other_numbers;
EditText vc_code1,vc_code2,vc_code3,vc_code4;
Button verify_code;
RelativeLayout error_layout;
TextView error_textview;
Button close_error_button;
Context ctx =this;
String confirmCode;
Bundle bundle;
String usernumber,countrycode,tempid;
ArrayList<String>other_numebr_list;
String accessType;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
setContentView(R.layout.verification_code_layout);
init();
super.onCreate(savedInstanceState);
}
void init()
{
resend_code = (TextView)findViewById(R.id.vc_resend_button);
resend_code.setPaintFlags(resend_code.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
error_textview = (TextView)findViewById(R.id.error_text);
//here is the layout
error_layout=(RelativeLayout)findViewById(R.id.error_layout);
close_error_button= (Button)findViewById(R.id.close_button);
}
}
void showErrorMessage(Boolean showm,String message )
{
if(showm)
{
error_textview.setText(message);
CommonUtility.expand(error_layout);
}
else{
CommonUtility.collapse(error_layout);
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical"
android:padding="@dimen/padding_all" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/vc_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:padding="1dp"
android:text="@string/vc_message"
android:textColor="@android:color/white" />
<include
android:id="@+id/vc__em_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
layout="@layout/error_message_layout"
android:visibility="gone" />
<LinearLayout
android:id="@+id/vc_code_layout"
android:layout_width="fill_parent"
android:layout_height="@dimen/edit_box_height"
android:layout_marginTop="@dimen/margin_top"
android:background="@drawable/curve_corner_shape_layout" >
<EditText
android:id="@+id/vc_code1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
<LinearLayout
android:layout_width="@dimen/partition_line_width"
android:layout_height="fill_parent"
android:background="@android:color/white" >
</LinearLayout>
<EditText
android:id="@+id/vc_code2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
<LinearLayout
android:layout_width="@dimen/partition_line_width"
android:layout_height="fill_parent"
android:background="@android:color/white" >
</LinearLayout>
<EditText
android:id="@+id/vc_code3"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
<LinearLayout
android:layout_width="@dimen/partition_line_width"
android:layout_height="fill_parent"
android:background="@android:color/white" >
</LinearLayout>
<EditText
android:id="@+id/vc_code4"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/curve_corner_shape_edittext"
android:gravity="center"
android:hint="X"
android:inputType="numberDecimal"
android:maxLength="1"
android:textColor="@android:color/white"
android:textSize="@dimen/edit_text_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/options"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/vc_othernumber_option"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:layout_weight=".5"
android:gravity="left"
android:padding="1dp"
android:text="@string/other_number"
android:textColor="@android:color/white"
android:visibility="gone" />
<TextView
android:id="@+id/vc_resend_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:layout_weight=".5"
android:gravity="right"
android:padding="1dp"
android:text="@string/resend"
android:textColor="@android:color/white" />
</LinearLayout>
<Button
android:id="@+id/vc_verifycode_button"
android:layout_width="fill_parent"
android:layout_height="@dimen/button_height"
android:layout_below="@id/options"
android:layout_marginTop="@dimen/margin_top"
android:background="@drawable/button_selector"
android:text="@string/verify_text"
android:textColor="@android:color/white"
android:textSize="@dimen/button_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:background="@drawable/logo_s" />
</LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/error_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/curve_corner_shape_errormsg"
android:gravity="center_vertical"
android:paddingBottom="@dimen/padding_bottom_em"
android:paddingLeft="@dimen/padding_left_em"
android:paddingRight="@dimen/padding_right_em"
android:paddingTop="@dimen/padding_top_em" >
<TextView
android:id="@+id/error_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="left|center_vertical"
android:paddingRight="@dimen/right_padding_em"
android:text="Invalid userName"
android:textColor="@android:color/white"
android:textSize="@dimen/textsize_em" />
<Button
android:id="@+id/close_button"
android:layout_width="@dimen/close_button_width"
android:layout_height="@dimen/close_button_height"
android:layout_marginTop="@dimen/close_button_margin_top"
android:layout_alignParentRight="true"
android:background="@drawable/close" />
</RelativeLayout>
10-07 17:44:04.430: E/AndroidRuntime(22640): java.lang.NullPointerException
10-07 17:44:04.430: E/AndroidRuntime(22640): at commonUtilities.CommonUtility.expand(CommonUtility.java:86)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.phone91new.VerificationCodeActivity.showErrorMessage(VerificationCodeActivity.java:244)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.phone91new.VerificationCodeActivity$VerifyCode.onPostExecute(VerificationCodeActivity.java:264)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.phone91new.VerificationCodeActivity$VerifyCode.onPostExecute(VerificationCodeActivity.java:1)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.AsyncTask.finish(AsyncTask.java:631)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.AsyncTask.access$600(AsyncTask.java:177)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.Handler.dispatchMessage(Handler.java:99)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.os.Looper.loop(Looper.java:155)
10-07 17:44:04.430: E/AndroidRuntime(22640): at android.app.ActivityThread.main(ActivityThread.java:5520)
10-07 17:44:04.430: E/AndroidRuntime(22640): at java.lang.reflect.Method.invokeNative(Native Method)
10-07 17:44:04.430: E/AndroidRuntime(22640): at java.lang.reflect.Method.invoke(Method.java:511)
10-07 17:44:04.430: E/AndroidRuntime(22640): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
首先在activity类中的
onCreate
方法中编写超级构造函数
super.onCreate(arg0);
setContentView(R.layout.verification_code_layout);
init();
希望它能有所帮助,在xml
<LinearLayout
android:id="@+id/vc__em_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:visibility="gone" >
<include layout="@layout/error_message_layout" />
</LinearLayout>
首先在activity类中的
onCreate
方法中编写超级构造函数
super.onCreate(arg0);
setContentView(R.layout.verification_code_layout);
init();
希望它能有所帮助,在xml
<LinearLayout
android:id="@+id/vc__em_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:visibility="gone" >
<include layout="@layout/error_message_layout" />
</LinearLayout>
首先在activity类中的
onCreate
方法中编写超级构造函数
super.onCreate(arg0);
setContentView(R.layout.verification_code_layout);
init();
希望它能有所帮助,在xml
<LinearLayout
android:id="@+id/vc__em_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:visibility="gone" >
<include layout="@layout/error_message_layout" />
</LinearLayout>
首先在activity类中的
onCreate
方法中编写超级构造函数
super.onCreate(arg0);
setContentView(R.layout.verification_code_layout);
init();
希望它能有所帮助,在xml
<LinearLayout
android:id="@+id/vc__em_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_top"
android:visibility="gone" >
<include layout="@layout/error_message_layout" />
</LinearLayout>
在java super中用于调用父类构造函数,因此首先需要通过
super.onCreate(Bundle_object);
另一件事是onCreate()是初始化生命周期组件,所以您需要使用
super and this
在JavaSuper中,作为构造函数的第一行的两个关键字都用于调用父类构造函数,所以首先需要通过
super.onCreate(Bundle_object);
另一件事是onCreate()是初始化生命周期组件,所以您需要使用
super and this
在JavaSuper中,作为构造函数的第一行的两个关键字都用于调用父类构造函数,所以首先需要通过
super.onCreate(Bundle_object);
另一件事是onCreate()是初始化生命周期组件,所以您需要使用
super and this
在JavaSuper中,作为构造函数的第一行的两个关键字都用于调用父类构造函数,所以首先需要通过
super.onCreate(Bundle_object);
另一件事是onCreate()是初始化生命周期组件,所以您需要使用
super and this
作为构造函数第一行的两个关键字当使用
标记包含布局时,在包含元素中指定的任何属性都会覆盖包含布局的根元素的属性
就你而言
<include
android:id="@+id/vc__em_layout"
使用
标记包含版面时,在包含元素中指定的任何属性都会覆盖包含版面根元素的属性
就你而言
<include
android:id="@+id/vc__em_layout"
使用
标记包含版面时,在包含元素中指定的任何属性都会覆盖包含版面根元素的属性
就你而言
<include
android:id="@+id/vc__em_layout"
使用
标记包含版面时,在包含元素中指定的任何属性都会覆盖包含版面根元素的属性
就你而言
<include
android:id="@+id/vc__em_layout"
你不认为这是错的吗<代码>设置内容视图(R.layout.verification\u code\u layout);init();super.onCreate(arg0)代码>需要交换它们VerificationDeactivity的第244行是什么?@X'Factor hi,已经更改了,但仍然存在相同的错误coming@Bansal_Sneha错误在这里CommonUtility.expand(错误\u布局)代码>。所以需要展示这个方法。@X'Factor已经更新了这个问题。你不认为这是错误的吗<代码>设置内容视图(R.layout.verification\u code\u layout);init();super.onCreate(arg0)代码>需要交换它们VerificationDeactivity的第244行是什么?@X'Factor hi,已经更改了,但仍然存在相同的错误coming@Bansal_Sneha错误在这里CommonUtility.expand(错误\u布局)代码>。所以需要展示这个方法。@X'Factor已经更新了这个问题。你不认为这是错误的吗<代码>设置内容视图(R.layout.verification\u code\u layout);init();super.onCreate(arg0)代码>需要交换它们VerificationDeactivity的第244行是什么?@X'Factor hi,已经更改了,但仍然存在相同的错误coming@Bansal_Sneha错误在这里CommonUtility.expand(错误\u布局)代码>。所以需要展示这个方法。@X'Factor已经更新了这个问题。你不认为这是错误的吗<代码>设置内容视图(R.layout.verification\u code\u layout);init();super.onCreate(arg0)代码>需要交换它们VerificationDeactivity的第244行是什么?@X'Factor hi,已经更改了,但仍然存在相同的错误coming@Bansal_Sneha错误在这里CommonUtility.expand(错误\u布局)代码>。所以需要显示该方法。@X'Factor已经更新了问题