Categories

See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Android xml layout items are not updating

Course Queries Syllabus Queries

Max. 2000 characters
Replies

usr_profile.png

User

( 4 months 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)

<FrameLayout
    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"
    >



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

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


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

                <LinearLayout
                    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"
                   >

                <TextView
                    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"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:id="@+id/course_level"
                    tools:text="ADVANCED"/>
            </LinearLayout>

            <Button
                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"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id=

what's your interest