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

  • Home
  • SEARCH
  • 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 8499423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:39:46+00:00 2026-06-11T00:39:46+00:00

I am working on android app and am trying to get fragments working but

  • 0

I am working on android app and am trying to get fragments working but I’ve run into a problem.

When the app launches it loads an activity which is supposed to house the two fragments. Fragment1 contains a list of stored logins and fragment 2 will show the details associated with that login.

The list fragment is supposed to retrieve data from the SQLite database and display on the screen and once the item is clicked, it loads the second fragment, but I am having problem getting the first stage working.

In my main activity class I have the following.

public class PasswordListMain extends Activity {

    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.password_management);
    }

}

The password_management XML file contains the following

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <fragment
        android:id="@+id/passwordList"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.BoardiesITSolutions.PasswordManager.PasswordListFrag">
    </fragment>
</LinearLayout>

It just contains the fragment as this is the portrait screen, I thought I’d get this bit working before getting it working side by side.

The PasswordListFrag contains the following

public class PasswordListFrag extends ListFragment{

    Common common; 
    com.BoardiesITSolutions.logic.ManagePasswordList managePasswordList;

    ArrayList<String> savedPassword;
    TextView txtNoRecords;
    ListView myListView;
    ArrayAdapter<Spanned> passwordArrayAdapter;
    AdView adView;

    @Override
    public View onCreateView(LayoutInflater inflator, ViewGroup container, Bundle savedInstanceState)
    {
        View view = inflator.inflate(R.layout.password_list, container, false);

        myListView = getListView();
        common = new Common(getActivity().getApplicationContext());

        //AdView adView = (AdView)findViewById(R.id.adView);
        common.requestAdvert(adView);

        managePasswordList = new ManagePasswordList(getActivity().getApplicationContext());
        //txtNoRecords = (TextView)findViewById(R.id.password_noRecords);
        populateListArray();

        common.showToastMessage("Adapter updated", Toast.LENGTH_LONG);

        //myListView.setOnItemClickListener(mListView);

        return view;
    }

    private void populateListArray()
    {

        ArrayList<Spanned> passwords = managePasswordList.getPasswordList();
        if (passwords != null && passwords.size() > 0)
        {
            passwordArrayAdapter = new ArrayAdapter<Spanned>(getActivity().getApplicationContext(), 
                    android.R.layout.simple_list_item_1, passwords);
            setListAdapter(passwordArrayAdapter);
            passwordArrayAdapter.setNotifyOnChange(true);
            myListView.setTextFilterEnabled(true);
            txtNoRecords.setVisibility(View.GONE);
        }
        else
        {
            txtNoRecords.setVisibility(View.VISIBLE);
        }
    }
}

Below is the XML for the list fragment

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <TextView android:id="@+id/password_noRecords"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:layout_gravity="center"
        android:text="There are currently\nno saved logins"
        android:textSize="20dp"
        android:textStyle="bold|italic"/>
    <ListView 
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+id/adView">
    </ListView>
        <com.google.ads.AdView android:id="@+id/adView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            ads:adUnitId="5555555"
            ads:adSize="BANNER"
            android:layout_alignParentBottom="true">
        </com.google.ads.AdView>
</RelativeLayout>

When the app loads it instantly crashes when it tries to load this screen.

The error is

java.lang.RuntimeException: Unable to start activity ComponentInfo
PasswordListMain: android.view.InflatException: Binary XML file line
#7 Error inflating class fragment

I have no idea what’s causing this or how to fix the problem.

Thanks for any help you can provide.

  • 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-11T00:39:47+00:00Added an answer on June 11, 2026 at 12:39 am

    My best guess for the issue is this line (but admittedly I’m unsure):

    myListView = getListView();
    

    You’re calling it before the fragment has a view – and I don’t think that will work too well. I would recommend doing your initialization work of the views involved in onActivityCreated() instead of in onCreateView() and the other components (like your data store thing and Common) in onCreate()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get in-app billing working on android, but keep getting the following
I am currently working on an Android app and I am trying to get
I have been trying to get this android service working but I can not
(post updated for working code) I've been trying to get my android app to
I'm trying to get my Android AR app working using the Vuforia SDK. What
I'm working on android app and trying to get created_time from facebook JSON .
I'm trying to get AdMob working with my android app and I'm having some
I am trying to parse Json for my android app, but I couldn't get
I am working on an android app, and I am currently trying to create
I'm working on an Android app in which I would like to use multi-touch.

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.