Android Open Source - AndroidModelView Ibu Detail Fragment






From Project

Back to project page AndroidModelView.

License

The source code is released under:

MIT License

If you think the Android project AndroidModelView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.kharcustom.testframework;
//from  w  w  w .  j a  va  2s  . co  m
import java.util.List;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.khar.isframework.DataAccess;
import com.khar.isframework.Model;
import com.khar.isframework.Query;
import com.khar.isframework.SqliteDataAccess;
import com.khar.isframework.models.ibu.Ibu;
import com.kharcustom.testframework.dummy.DummyContent;

/**
 * A fragment representing a single Ibu detail screen. This fragment is either
 * contained in a {@link IbuListActivity} in two-pane mode (on tablets) or a
 * {@link IbuDetailActivity} on handsets.
 */
public class IbuDetailFragment extends Fragment {
  /**
   * The fragment argument representing the item ID that this fragment
   * represents.
   */
  public static final String ARG_ITEM_ID = "item_id";
  View rootView;

  private Ibu mItem;
  private DataAccess dataAccess;

  /**
   * Mandatory empty constructor for the fragment manager to instantiate the
   * fragment (e.g. upon screen orientation changes).
   */
  public IbuDetailFragment() {
  }

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getArguments().containsKey(ARG_ITEM_ID)) {
      // Load the dummy content specified by the fragment
      // arguments. In a real-world scenario, use a Loader
      // to load content from a content provider.
      initView();
    }
  }
  private void initView(){
    String id = getArguments().getString(ARG_ITEM_ID);
    dataAccess = new SqliteDataAccess(getActivity().getApplicationContext());
    Ibu ibu = new Ibu(dataAccess);
    Query q = new Query();
    q.addWhere(" id="+id);
    List<Model> mod = ibu.findAll(q);
    mItem = (Ibu)mod.get(0);
  }
  @Override
  public void onResume() {
    initView();
    if (mItem != null) {
      ((TextView) rootView.findViewById(R.id.ibu_detail))
          .setText((String)mItem.getAttribute("nama"));
      ((TextView) rootView.findViewById(R.id.ibu_ktp))
      .setText((String)mItem.getAttribute("ktp"));
    }
    super.onResume();
  }
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_ibu_detail,
        container, false);

    // Show the dummy content as text in a TextView.
    if (mItem != null) {
      ((TextView) rootView.findViewById(R.id.ibu_detail))
          .setText((String)mItem.getAttribute("nama"));
      ((TextView) rootView.findViewById(R.id.ibu_ktp))
      .setText((String)mItem.getAttribute("ktp"));
    }

    return rootView;
  }
}




Java Source Code List

com.khar.isframework.DataAccess.java
com.khar.isframework.FlexibleModel.java
com.khar.isframework.ModelAdapter.java
com.khar.isframework.ModelListFragment.java
com.khar.isframework.Model.java
com.khar.isframework.MySqliteHelper.java
com.khar.isframework.Query.java
com.khar.isframework.SqliteDataAccess.java
com.khar.isframework.formbuilder.BasicTheme.java
com.khar.isframework.formbuilder.FormBuilder.java
com.khar.isframework.formbuilder.Theme.java
com.khar.isframework.models.ibu.IbuListFragment.java
com.khar.isframework.models.ibu.Ibu.java
com.khar.isframework.models.rs.RSDetailFragment.java
com.khar.isframework.models.rs.RSListFragment.java
com.khar.isframework.models.rs.RumahSakit.java
com.khar.isframework.validator.BasicValidator.java
com.khar.isframework.validator.DateValidator.java
com.khar.isframework.validator.Validator.java
com.kharcustom.testframework.DummyDetailActivity.java
com.kharcustom.testframework.DummyDetailFragment.java
com.kharcustom.testframework.DummyEditForm.java
com.kharcustom.testframework.EmptyDetilFragment.java
com.kharcustom.testframework.FormTester.java
com.kharcustom.testframework.GenericForm.java
com.kharcustom.testframework.IbuDetailActivity.java
com.kharcustom.testframework.IbuDetailFragment.java
com.kharcustom.testframework.IbuListActivity.java
com.kharcustom.testframework.ModuleMenuHandler.java
com.kharcustom.testframework.dummy.DummyContent.java