How to change cell number in Android?
<p>In my application I have three edit text and I am using shared preference to store those number. I want to fetch the numbers from shared preference and display in edit text and i want to edit the text also. When i run the below code i am getting NullPointerException. Can somebody help me?</p>

<pre><code>     public void onCreate(Bundle savedInstanceState)
     {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.change_cell_number);
        init();
        /*SharedPreferences sharedPref=this.getSharedPreferences("MY_PREF_2",MODE_WORLD_READABLE);
        SharedPreferences.Editor shredPref_Editor=sharedPref.edit();
        shredPref_Editor.putString(MY_ACTIVITY,"changeSMSnumber");
        shredPref_Editor.commit();


        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(ChangeSmsNumber_Activity.this);
        String servername = settings.getString("sharedPreferencesKey", "defaultValue");
        //server.setText(servername);  
        */      



        btnSubmit.setOnClickListener(new OnClickListener() 
        {

            @SuppressWarnings("unused")
            @Override
            public void onClick(View arg0) 
            {
                // TODO Auto-generated method stub
                String numberISD=edtxt_ISD_Code1.getText().toString();


                if(edtxt_ISD_Code1.getText().toString().isEmpty()) 
                {
                    Toast.makeText(getApplicationContext(),"Enter ISD 1st Number * ", Toast.LENGTH_SHORT).show();
                }
                else if(edtxt_Cell_Number1.getText().toString().isEmpty())
                {
                    Toast.makeText(getApplicationContext(),"Enter 1st Number *", Toast.LENGTH_SHORT).show();
                }

                else

                {


                    String strSign1 = edtxt_PlusSign1.getText().toString();
                    String strSign2 = edtxt_PlusSign2.getText().toString();
                    String strSign3 = edtxt_PlusSign3.getText().toString();
                    String strSign4 = edtxt_PlusSign4.getText().toString();
                    String strSign5 = edtxt_PlusSign5.getText().toString();


                    String strIsd1 = edtxt_ISD_Code1.getText().toString();
                    String strIsd2 = edtxt_ISD_Code2.getText().toString();
                    String strIsd3 = edtxt_ISD_Code3.getText().toString();
                    String strIsd4 = edtxt_ISD_Code4.getText().toString();
                    String strIsd5 = edtxt_ISD_Code5.getText().toString();

                    String strNum1 = edtxt_Cell_Number1.getText().toString();
                    String strNum2 = edtxt_Cell_Number2.getText().toString();
                    String strNum3 = edtxt_Cell_Number3.getText().toString();
                    String strNum4 = edtxt_Cell_Number4.getText().toString();
                    String strNum5 = edtxt_Cell_Number5.getText().toString();


                    String final_Num_1 =  strSign1 + strIsd1 + strNum1;
                    String final_Num_2 =  strSign2 + strIsd2 + strNum2;
                    String final_Num_3 =  strSign3 + strIsd3 + strNum3;
                    String final_Num_4 =  strSign4 + strIsd4 + strNum4;
                    String final_Num_5 =  strSign5 + strIsd5 + strNum5;

                    SharedPreferences settings = ChangeSmsNumber_Activity.this.getSharedPreferences("MyPref_CellNumber",0);
                    strGetCellNum = settings.getString("num1", "n/a"); 
                    final_Num_1=strGetCellNum;


                }

            }
        });
    }
</code></pre>

<p>Please guide me.</p>
