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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:53:51+00:00 2026-06-07T03:53:51+00:00

i am having a dynamic text view based on the xml file…..Please help me

  • 0

i am having a dynamic text view based on the xml file…..Please help me for my code……

my codes

MessageViewPage.java

package com.dpn.pack;


public class MessageViewPage extends Activity {

TextView tv1=new TextView(this);
ScrollView sv;
String nickname,body;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.message_view_page);

    Bundle b = getIntent().getExtras();

    nickname= b.getString("nick");
    body=b.getString("body");

    LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = vi.inflate(R.layout.message_view_page, null);

    // fill in any details dynamically here
    TextView textView = (TextView) v.findViewById(R.id.textViewSender);
    textView.setText("Sender : "+nickname);

    // insert into main view
    View insertPoint = findViewById(R.id.textViewSender);
    insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));



}



}

my xml file as follows

message_view_page.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp" 
android:background="@drawable/view">

<TextView
    android:id="@+id/textViewSender"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="18dp"
    android:layout_marginTop="35dp"
    android:textColor="#FFFFFF"
    android:textSize="20dp" />

<TextView
    android:id="@+id/textViewBody"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textViewSender"
    android:layout_below="@+id/textViewSender"
    android:layout_marginLeft="20dp"
    android:layout_marginTop="40dp"
    android:textSize="15dp"
    android:textColor="#F69DD1" />

<Button
    android:id="@+id/buttonReply"
    android:layout_width="100dp"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="45dp"
    android:layout_marginBottom="50dp"
    android:text="Reply" />

<Button
    android:id="@+id/buttonListen"
    android:layout_width="100dp"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_marginRight="45dp"
    android:layout_marginBottom="50dp"
    android:text="LIsten" />

</RelativeLayout>

i am having an error in

insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

Please any one tell me the solution…..

  • 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-07T03:53:52+00:00Added an answer on June 7, 2026 at 3:53 am

    Your insertPoint is null. Because you don’t set the layout before calling findViewById. So it will not find anything.

    You have to call

    setContentView(R.layout.message_view_page);
    

    before.

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

Sidebar

Related Questions

I'm essentially having difficulty pass dynamic variables to a view. I have php functions
I'm having trouble getting ember to render a dynamic child view. It seems that
I'm having a problem using nested partials with dynamic form builder code (from the
I'm trying to load some XML into flash to populate some dynamic text fields.
I have a simple Java program that reads in a text file, splits it
I am having a dynamic text box. I need this text box char count
I am having some trouble provding a Win32 tooltips control with dynamic text in
I want to parse the contents of a dynamic .csv file. However, this code
I'm having this problem where dynamic text in my flash 10 (AS3) game application
I am having issues passing a dynamic parameter to a JavaScript function using innerHTML.

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.