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 8210933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:15:09+00:00 2026-06-07T10:15:09+00:00

I am trying to do something that should be simple, my main layout is

  • 0

I am trying to do something that should be simple, my main layout is like this

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

    <fragment
        android:name="io.raindance.kalimat.grid.GridFragment"
        android:id="@+id/gridControlInMainView" 
        android:layout_width="match_parent"
        android:layout_height="match_parent" />        

</LinearLayout>

There’s no Java code in the main activity; now the GridFragment’s code and layout is just like this:

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

</LinearLayout>

Java Code:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Load the layout of the rack tile
    View view = inflater.inflate(R.layout.grid_fragment, null, false);



    // Get the root linear layout to add the rows to it
        LinearLayout root = (LinearLayout) view.findViewById(R.id.gridFragmentMainContainer);

        // Build the rows of the grid
            int rowsId = 21;
        for (int i = 0; i < 15; i++) {
            // Create the linear layout that represents a row in the grid
            LinearLayout row = new LinearLayout(this.getActivity());
            row.setId(rowsId++);
            row.setOrientation(LinearLayout.HORIZONTAL);

            row.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 10, 1.0f));

            // Build the cells of the grid
            for (int j = 0; j < 15; j++) {
                // Create the cell fragment
                CellFragment cellFragment = new CellFragment();
            // Add the cell fragment to the row fragment
                            this.getFragmentManager().beginTransaction().add(row.getId(), cellFragment).commit();
}
        // Add the row to the root element
        root.addView(row);
    }

    return view;
}

The CellFragment layout is simply as mentioned below and there’s no Java code.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/lll1"
    android:layout_weight="1"
    android:layout_width="0dp"
    android:layout_height="match_parent">

</LinearLayout>

When I run the application, I get an exception because of the commit() call, cause the exception is not raised when I remove the commit() call and anyway the rows are being successfully created and added to the hierarchy.

I get the below exception
07-08 03:36:27.414: E/AndroidRuntime(835): java.lang.RuntimeException: Unable to start activity ComponentInfo{io.raindance.kalimat/io.raindance.kalimat.test.KalimatActivity}: java.lang.IllegalArgumentException: No view found for id 0x7f050005 for fragment CellFragment{4103c790 #1 id=0x7f050005}

I have been looking for the reason and the solution of this problem for 2 days now.

  • 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-07T10:15:13+00:00Added an answer on June 7, 2026 at 10:15 am

    The Activity needs to be created (and its state saved) in order for a FragmentTransaction to be performed, otherwise you will get an exception. Try performing your transaction in onActivityCreated instead.

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

Sidebar

Related Questions

I'm trying to do something that should be very simple, but it's causing this
I'm trying to create something that works like this but doesn't have any submenus.
I am trying to setup something that looks like this with the arrow that
I am trying to do something that should be really simple. I want to
I'm trying to do something that I think should be fairly simple but I've
I am trying to do something that should be fairly simple but ISNULL isn't
I am trying to do something that should be really simple but I am
I'm trying to do something that should be real simple but I'm getting errors
I am new to cakephp and I'm trying to accomplish something that should be
I'm trying to do something that would be really simple in any other language

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.