Back to project page inbox-android.
The source code is released under:
MIT License
If you think the Android project inbox-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.inboxapp.androidsdk.sample_application; /*w w w .j a v a2 s . c o m*/ import android.app.Activity; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.app.ListFragment; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import com.inboxapp.androidsdk.R; import com.inboxapp.androidsdk.sample_application.SampleArrayAdapter; import com.inboxapp.androidsdk.sample_application.SampleDetailsActivity; public class SampleMenuActivity extends Activity{ public static final String CATEGORY_TITLE = "CatgoryTitle"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sample); FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); SampleListFragment llf = new SampleListFragment(); ft.replace(R.id.listFragment, llf); ft.commit(); } public static class SampleListFragment extends ListFragment { String[] category_titles; @Override public void onListItemClick(ListView l, View v, int position, long id) { Context outerContext = getActivity(); Log.w("Position", "Position Clicked: " + position); Intent detailsPageIntent = new Intent(outerContext, SampleDetailsActivity.class); detailsPageIntent.putExtra(CATEGORY_TITLE, category_titles[position]); startActivity(detailsPageIntent); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { category_titles = new String[] { getActivity().getResources().getString(R.string.namespaces), getActivity().getResources().getString(R.string.tags), getActivity().getResources().getString(R.string.threads), getActivity().getResources().getString(R.string.messages), getActivity().getResources().getString(R.string.contacts), getActivity().getResources().getString(R.string.files), getActivity().getResources().getString(R.string.drafts), getActivity().getResources().getString(R.string.test)}; SampleArrayAdapter adapter = new SampleArrayAdapter( inflater.getContext(), category_titles, true, null); setListAdapter(adapter); return super.onCreateView(inflater, container, savedInstanceState); } @Override public void onActivityCreated (Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getListView().setDivider(new ColorDrawable(Color.GRAY)); getListView().setDividerHeight(3); } } }