How call method from second activitty and return value
<p>I have two activity, first on activity "LoginActivity",and second activity "student_ activity". 
Please till me how call method "call" from second activity and return value bool to first activity for know user if id and password correct or not correct.
First activity get id and password from "edittext" then send id and password to method in second activity for sure from data from server.</p>

<p>code first activity is :</p>

<pre><code>    public class LoginActivity extends Activity{
        EditText EdtId;
        EditText EdtPassword;
        Button btn1;
        SharedPreferences prefs;
          @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.login);
                 prefs = this.getSharedPreferences(this.getApplicationContext().getPackageName(), Context.MODE_PRIVATE);
                EdtId=(EditText)findViewById(R.id.IdStudent);
                EdtPassword=(EditText)findViewById(R.id.PasswordStudent);
                 btn1=(Button)findViewById(R.id.btnLogin);

                 btn1.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        createLoginSession(Integer.parseInt(EdtId.getText().toString()),EdtPassword.getText().toString());
//here call second activity for sure from data 
                         Intent intent = new Intent(LoginActivity.this,tofi.android.Student_Activity.class);
                            startActivity(intent);      
                            finish();
                        startActivity(new Intent(LoginActivity.this,com.jcxavier.widget.test.BadgeButtonTestActivity.class));
                    }
                });   
            }
    //this method store data in SharedPreferences for get this data in second activity 
         public void createLoginSession(int id, String password){
             SharedPreferences.Editor editor = prefs.edit();
             editor.putInt("id", id);
             editor.putString("password", password);
             editor.commit();
            }
    }
</code></pre>

<p>code second activity is:</p>

<pre><code>   public class Student_Activity {
SharedPreferences prefs = this.getSharedPreferences(this.getApplicationContext().getPackageName(), Context.MODE_PRIVATE);
     public void onCreate(Bundle icicle) {
                super.onCreate(icicle);
                setContentView(R.layout.program_student);
                NewsLoader call = new NewsLoader();
    call.execute(this, true);       
            }
               private Context context;
            private boolean pullFromServer = false;
            class NewsLoader extends AsyncTask&lt;Object, Void, List&lt;student&gt;&gt; {
                private Context context;
                private boolean pullFromServer = false;

                protected List&lt;student&gt; doInBackground(Object... params) {
                    context = (Context) params[0];
                    pullFromServer = (Boolean) params[1];
                    dataSource.open();
                    if (pullFromServer) {
    //get attribute from SharedPreferences  
                        int id = prefs.getInt("id", 24);
                        String password = prefs.getString("password","wce");
    // studentHandler class for sure password content method call for send to server and //return value if correct or not correct and return value type bool.
                        bool s;
                        s = StudentHandler.getInstance().call(context,id,password);
        } 
        }
     }
</code></pre>
