I have created two class one is LoginSignupActivity.java and another is ProfileActivity.java
LoginSignUpActivity.java---
public class LoginSignupActivity extends AppCompatActivity {
** static string id; **
public void getUserDetailsFromFB() {
GraphRequest request = GraphRequest.newMeRequest(
AccessToken.getCurrentAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(final JSONObject object, GraphResponse response) {
try{
** id=response.getJSONObject().getString("id");**
}
catch (JSONException e) {
//If anything goes wrong
Log.e("my",e.toString());
}
})
}
}
}
ProfileActivity.java ---
public class ProfileActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
ImageView imageView = (ImageView) findViewById(R.id.dp);
if(imageView!=null){
** String fbid = (new LoginSignupActivity).getUserDetailsFromFB().id; **
if(fbid!=null){
Glide.with(this).load("http://graph.facebook.com/1615242245409408/picture?type=large").into(imageView);
//Glide.with(this).load("http://graph.facebook.com/" + "1675239799409652" + "/picture?type=large").into(imageView);
Log.d("mayank", LoginSignupActivity.id);
}
else{
Log.d("mayank","null facebook id");
}
}
else {
Log.d("mayank","null image view");
}
}
}
When I access id inside ProfileActivity.java it shows null value. I want to access that value that is obtained inside LoginSignupActivity.java.
Please help. Thanks