Question: I'm new to this site so hopefully I'm phrasing my question correctly. 

I'm working through some introductory Android programming. What allows me to call the `Toast.makeText` method, but I cannot do the same for the `setGravity` method immediately after? Why can I reference the first non-static method, but not the next? I'm also new to using anonymous inner classes. 

```
mTrueButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Toast.makeText(quizActivity.this, R.string.correct_toast, Toast.LENGTH_SHORT.show();
        Toast.setGravity(0, 0 ,0);
    }
});

```

Answer: 
You have to create Toast class object

```
public void ShowToast(String message){

    Toast t = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);

    OR

    // Toast t = new Toast(getContext());  if custom view require
    t.setDuration(Toast.LENGTH_LONG);
    t.setText(message);

    t.setGravity(Gravity.RIGHT,0,0);
    t.show();

}

```
```
Toast toast = Toast.makeText(getApplicationContext(),
     "text", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();

```

`makeText` return a toast object.