You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1011 B
35 lines
1011 B
package com.example.myapplication.weather;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import com.example.myapplication.R;
|
|
|
|
public class WeatherDetailActivity extends SingleFragmentActivity{
|
|
public static final String EXTRA_WEATHER_ITEM = "com.example.weather.weatherItem";
|
|
|
|
@Override
|
|
protected Fragment createFragment() {
|
|
WeatherItem weatherItem = (WeatherItem)getIntent().getSerializableExtra(EXTRA_WEATHER_ITEM);
|
|
return WeatherDetailFragment.newInstance(weatherItem);
|
|
}
|
|
|
|
@Override
|
|
protected int getLayoutId() {
|
|
return R.layout.activity_detail;
|
|
}
|
|
|
|
@Override
|
|
protected int getFragmentId() {
|
|
return R.id.detail_container;
|
|
}
|
|
|
|
public static Intent newIntent(Context packageContext, WeatherItem weatherItem){
|
|
Intent intent = new Intent(packageContext,WeatherDetailActivity.class);
|
|
intent.putExtra(EXTRA_WEATHER_ITEM,weatherItem);
|
|
return intent;
|
|
}
|
|
}
|