I have a viewpager/sliding tabs. I want to be able to get 4 contacts from the address book that is already on the phone and save them in the app for later use. I have the code to do contact picker with an activity but my contact page is a fragment and I have yet to get it to work.
Any ideas or suggestions would be greatly appreciated!
code for contact fragment
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;
public class MainMenu_Contacts extends Fragment {
View rootView;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.activity_main_menu__contacts, container, false);
TextView text = (TextView) rootView.findViewById(R.id.text_message);
text.setText("Contacts");
return rootView;
}
}
xml for contact
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/text_message"
/>
</LinearLayout>
0 comments:
Post a Comment