Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8686217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:47:24+00:00 2026-06-12T22:47:24+00:00

I want to create a multiple contact picker. Initially i am just trying to

  • 0

I want to create a multiple contact picker. Initially i am just trying to test if it works or not by providing static values. I thought of implementing a CustomAdapter for performing the task but i am getting java.lang.NullPointerException and according to log cat its at line no. 41 which is paramView = mInflater.inflate(R.layout.custcontactview, null);

Can anyone tell me what thing i am not doing correctly?

NOTE: If anyone knows a good tutorial about creating multiple contact picker pls provide the link.

Log Cat

10-13 19:44:38.115: E/AndroidRuntime(1461): java.lang.NullPointerException
10-13 19:44:38.115: E/AndroidRuntime(1461):     at com.example.multiplecontacts.MyCustomAdapter.getView(MyCustomAdapter.java:41)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.AbsListView.obtainView(AbsListView.java:1430)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.ListView.makeAndAddView(ListView.java:1745)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.ListView.fillDown(ListView.java:670)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.ListView.fillFromTop(ListView.java:727)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.ListView.layoutChildren(ListView.java:1598)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.AbsListView.onLayout(AbsListView.java:1260)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.view.View.layout(View.java:7175)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.view.View.layout(View.java:7175)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.view.View.layout(View.java:7175)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.view.View.layout(View.java:7175)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.view.View.layout(View.java:7175)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1140)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.os.Looper.loop(Looper.java:130)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at android.app.ActivityThread.main(ActivityThread.java:3683)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at java.lang.reflect.Method.invokeNative(Native Method)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at java.lang.reflect.Method.invoke(Method.java:507)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-13 19:44:38.115: E/AndroidRuntime(1461):     at dalvik.system.NativeStart.main(Native Method)

custcontactview.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="5.0px"
android:paddingLeft="5.0px"
android:paddingTop="5.0px" >

<TextView
    android:id="@+id/txtContactName"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="15.0dip"
    android:layout_toLeftOf="@+id/checkBox1"
    android:layout_alignParentLeft="true"
    android:text="Medium Text"
    android:textAppearance="?android:textAppearanceMedium" />

<TextView
    android:id="@+id/txtContactNumber"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/txtContactName"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="15.0dip"
    android:layout_toLeftOf="@+id/checkBox1"
    android:text="Small Text"
    android:textAppearance="?android:textAppearanceSmall" />

<CheckBox
    android:id="@+id/checkBox1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_marginRight="10dp"
    android:clickable="false"
    android:focusable="false"
    android:focusableInTouchMode="false" />

</RelativeLayout>

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >


<ListView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true" />


</RelativeLayout>

MainActivity.java

public class MainActivity extends ListActivity {

ListView mListView;
MyCustomAdapter mAdapter;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mAdapter = new MyCustomAdapter();
    mListView = getListView();
    mAdapter.addItem("Jay", "+919033953469");
    mAdapter.addItem("Jay", "+918469000500");
    mAdapter.addItem("Tapan", "+919033843969");
    mAdapter.addItem("Tapan", "+919408396544");     
    mListView.setAdapter(mAdapter);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}
}

MyCustomAdapter.java

public class MyCustomAdapter extends BaseAdapter {


private LayoutInflater mInflater;
private ArrayList<String> mData = new ArrayList();
private ArrayList<String> mNumber = new ArrayList();

public MyCustomAdapter() {
}

public int getCount() {
    return this.mData.size();
}

public void addItem(String paramString1, String paramString2) {
  this.mData.add(paramString1);
  this.mNumber.add(paramString2);
  notifyDataSetChanged();
}

public Object getItem(int paramInt) {
    return (String) this.mData.get(paramInt);
}

public long getItemId(int paramInt) {
    return paramInt;
}

public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) {
    if(paramView == null) {
        paramView = mInflater.inflate(R.layout.custcontactview, null);
    }
    /*CheckBox cbx = (CheckBox) paramView.findViewById(R.id.checkBox1);
    cbx.setTag(paramInt);
    TextView tvTitle = (TextView) paramView.findViewById(R.id.txtContactName);
    TextView tvTitle1 = (TextView) paramView.findViewById(R.id.txtContactNumber);
    tvTitle.setText(mData.get(paramInt).toString());
    tvTitle1.setText(mNumber.get(paramInt).toString());*/
    return paramView;
}

public static class ViewHolder {
    public CheckBox cb;
    public TextView nameView;
    public TextView numberView;
}

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:47:25+00:00Added an answer on June 12, 2026 at 10:47 pm

    mInflater is NULL

    public MyCustomAdapter(Context context) {
        mInflater = (LayoutInflater) mContext
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the code below. I do not want to create multiple instances of class
I want to create multiple matrices with numpy.zeros((N,M)). But I just realized that this
i just want to create multiple toolbar items in a single row here what
I am trying to use for to create multiple objects from for, just example
i want create multiple search where statement $where_search is a multiple condition from post
I want to create multiple versions of print-friendly pages from a single page. I
I`v come across a need where I want to create multiple list items from
I have an XML file (on the left) and I want to create multiple
hey i want to be able to create multiple shapes and store them perhaps
I want to create a single video file from multiple video files (parts). I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.