package com.pinecone.technology.mcommerce.learning.android.chapter03;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class DetailFragment extends Fragment {
public static final String CURRENT_TIME = "TIME";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_rssitem_detail,
container, false);
return view;
}
@Override
public void onStart() {
super.onStart();
// During startup, check if there are arguments passed to the fragment.
// onStart is a good place to do this because the layout has already
// been
// applied to the fragment at this point so we can safely call the
// method
// below that sets the article text.
Bundle args = getArguments();
if (args != null) {
// Set article based on argument passed in
setText(args.getString(CURRENT_TIME));
}
}
public void setText(String item) {
TextView view = (TextView) getView().findViewById(R.id.detailsText);
view.setText(item);
}
}