After trying many different way to express the following program, I wasn't able to get pass a value from an activity to another. It seems that the bundle keeps being null for some reason. I don't think it could be a permission problem.
MainActivity :
public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public void ButtonRAWclick(View view)
    {
        Intent intent = new Intent(MainActivity.this
                , RestClient.class);
        intent.putExtra("type", "RAW_TYPE");
        startActivity(intent);
    }
    public void ButtonHTTPclick(View view)
    {
        Intent intent = new Intent(MainActivity.this
                , RestClient.class);
        intent.putExtra("type", "HTTP_TYPE");
        startActivity(intent);
    }
    public void ButtonJSONclick(View view)
    {
        Intent intent = new Intent(MainActivity.this
                , RestClient.class);
        intent.putExtra("type", "JSON_TYPE");
        startActivity(intent);
    }
}
RestClient :
public class RestClient extends AppCompatActivity implements SensorListener {
    RawHttpSensor rhs1;
    TextSensor rhs2;
    TextView temperature;
    String output;
    String type;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rest_client);
        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            type = bundle.getString("type");
        }
        if (type == "RAW_TYPE") {
            rhs1 = new RawHttpSensor();
            temperature = (TextView) findViewById(R.id.temperature);
            rhs1.registerListener(this);
            rhs1.getTemperature();
        }
        if (type == "HTTP_TYPE")
        {
            rhs2 = new TextSensor();
            temperature = (TextView) findViewById(R.id.temperature);
            rhs2.registerListener(this);
            rhs2.getTemperature();
        }
        if (type == "JSON_TYPE")
        {
           ...
        }
      ...
    }
Can someone help me spot the bug ?
 
    