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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:03:14+00:00 2026-06-07T07:03:14+00:00

I’ve searched and searched and for whatever reason I just can’t seem to get

  • 0

I’ve searched and searched and for whatever reason I just can’t seem to get it working.

What I’m doing currently is that I have a config class in which I, based on selected items on spinners, want to create x amount of TextViews which I want to set their text as well. So I cant just have these TextViews created in the .xml file, I have to create them in runtime, since I won’t know until then, how many I need.
These TextViews must be added to the widget so that they are shown when the widget is created upon pushing the configuration class’ add widget button. I’d like to add the textviews to my Widgets vertical linearlayout that’s contained within a horizontal linearlayout within a relativelayout.

So far I’ve been able to create the TextViews and set the proper text, but whatever I seem to try, I just can’t figure out how to add them to the widget so they’re actually shown. I’ve tried inflating the widgets layout, getting the id’s and adding them, tried to fool around with RemoteViews since I realized this is a widget and that’s prolly how its supposed to be done. Nothing seems to make them want to be added, not even when I just try to create 1 TextView from code. I just can’t get it to display itself and the setText I’ve given it.

I’m working in android 2.2 btw, and this is my first android app / widget, so please don’t be too brutal, since I’m prolly making a stupid mistake somewhere…

If you need code examples in order to help me better, lemme know, and ill try to add it later. Right now I’m asking for help on a computer that doesn’t have access to the code 🙂

Thank you so much for taking the time to read this! Hope someone can tell me what I have to do in order to get this done. Or whether its even possible :S
/Chris

edit:

This is one of the things ive tried to get it to work, but i guess this doesnt work since im working with a widget, and i ought to use a remoteview and somehow do it through that? From things ive read, it seems like remote views only works with xml generated codes. If thats truly the case, how would i then go about creating, and adding textviews to my widget? :S

//the context c is defined as this, elsewhere:
c = WidgetConfig.this;

public void createPopulateTable(RemoteViews rv){

LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.widget, null);

LinearLayout vll1 = (LinearLayout)layout.findViewById(R.id.wVertLinearL1);

// Create a TextView for the left column
TextView wLabelTv = new TextView(c);
wLabelTv.setId(200);
wLabelTv.setTextColor(Color.BLACK);
wLabelTv.setLayoutParams(new LayoutParams(
    LayoutParams.WRAP_CONTENT,
    LayoutParams.WRAP_CONTENT));
wLabelTv.setText("No Classes Today");
vll1.addView(wLabelTv);
}
  • 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-07T07:03:15+00:00Added an answer on June 7, 2026 at 7:03 am

    I ended up dropping the idea of dynamically creating the amount of TextViews i needed, and instead created a basic layout of sorts, in xml, on which i could (through iterations) set the text and formatting i wanted, and simply add the entire xml file over and over again 🙂

    Each row i needed, was always gonna contain a textview and 3 imageviews. I made that skeleton in the new xml file. And in the code i set them to what i wanted, and added the row to the main layout. I did this for each row i needed.

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

Sidebar

Related Questions

I am doing a simple coin flipping experiment for class that involves flipping a
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.