Android xml layout items are not updating

Course Queries Syllabus Queries 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago


I have a detail fragment where i have a few items, mostly TextView. I also have a CursorLoader, that onLoadFinished is supposed to set all those values in the layout.

For example in this snippet, it prints out that text is being set to the value that I received from ContentProvider

  String dur = this.expected_duration + " " + this.durationUnit;
    Log.v(LOG_TAG, "SETTING DURATION " + dur);
    if(dur != null || !"".equals(dur)) {
        if(durationTextView != null) {
            Log.v(LOG_TAG, "SETTING TEXT VIEW " + dur);
            durationTextView.setText(dur);
        }
    }else{
        Log.v(LOG_TAG, "FAIL SETTING TEXT VIEW " + dur);
    }

enter image description here

I see the result in the log but this result is never getting to the actual TextView.

I know for a fact that its not a problem of visibility or text font. I have the TextView hightlighted in pink and made sure that the mock text displays on the screen. I have a feeling that I may be creating duplicate fragments that lay one on top of another (not sure if its possible). I can perfectly instantiate all the TextViews and extract all the values but cannot put them together on the screen. Please help. In addition if my theory of duplicate fragments is correct please explain how you tracked it down. Thank you.

My Layout file (just in case)


    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.jennyeckstein.udacitycoursepicker.DetailActivityFragment"
    >



    
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/scrollView" >

        
            android:layout_width="match_parent"
            android:layout_height="match_parent">


            
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/course_subtitle"
                    tools:text="How to Make an Android App"/>

                
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:id="@+id/course_layout_detail"
                    android:layout_below="@id/course_subtitle"
                   >

                
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:id="@+id/duration"
                    android:background="@color/pink"
                    android:textSize="16sp"
                    tools:text="333 years"/>
                
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:id="@+id/course_level"
                    tools:text="ADVANCED"/>
            

            
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/begin_course_button"
                android:text="Go to Udacity"
                android:layout_below="@+id/course_layout_detail"/>

            
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id=
                                                
                                                
0 views
0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.