Different content in the tabs [closed] - java

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I'm using this android studio project, but I didn't know how to change content there.For example, I want to have a text "Hello World" in the first tab, the text "Goodbye..." in the second tab and so on... Can you help me?

Did you try anything? There is a sample folder where you can find an example. In the first file I opened, which is MainActivity.java, there is a class called MyPagerAdapter, with the following line:
private final String[] TITLES = { "Categories", "Home", "Top Paid", "Top Free", "Top Grossing", "Top New Paid", "Top New Free", "Trending" };
Seems to me you can change that to
private final String[] TITLES = {"Hello world", "Goodbye..."};
If that doesn't work you do have a valid question, but in this case you should have checked the sample first. Literraly took me less than a minute to find.

Related

java.have a problem with the creation of a selective feild [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 days ago.
Improve this question
i'm new in java.
I want to add a selection field with sublist.
Is it possible ??
I have use a combobox.
I tried to find other feild.
JComboBox branddoor_ch=new JComboBox(); this is the feild
branddoor_ch.setModel(new DefaultComboBoxModel(new String[] {"Turkish Inox Door","Turkish EPOXY Door", "Wittur", "Frmator E120", "Xizi Doors"}));
I want when i click on "Turkish Inox Door" a other subliste apearse.

trying to use Float.parseFloat() in android but my IDE not recognizing parseFloat [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 9 months ago.
Improve this question
Im trying to set rating in rating bar while the API service returns a sting for rating field. couldn't find any way to use it directly in xml using databinding so I tried binding adapter and surprisingly the parseFloat in Float.parseFloat() is not recognizing by my IDE. I have tried this piece of code in other part of project like fragments but nothing happens.
Thanks for any idea and suggestion.
Kotlin doesn't have Float.parseFloat() method.
To convert string to float use toFloatOrNull(), this will convert string to float
var string = "5"
var floatNumber = string.toFloatOrNull()
Log.e(TAG, " string.toFloatOrNull() $floatNumber")
You can set this float value in rating bar

Why does my Android string display in all caps in my app? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I want to display Vo for initial velocity, and it displays fine in MOST places, but on all of my circle buttons, it displays in all caps, so it looks like "VO" instead of "Vo".
Is there a way to fix this? Is it a weird button interaction?
Thanks!
Buttons are all-caps by default since Android 5.0. If you want to disable this, you may have to specify android:textAllCaps="false" on your Buttons.

setIcon with switch [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have a little question.
I have made a java switch in Netbeans. The switch is attached to a label in my Gui. Whenever i click the Label, i want it to be able to change the image it has.
private void LoopLblMouseReleased(java.awt.event.MouseEvent evt) {
switch(looped)
{
case 0:
looped = 1;
LoopLbl.setIcon("path to image");
break;
case 1:
looped = 0;
break;
};
This the code i have for the switch untill now, but it gives an error when i fill in the path to the image. Can someone help me with this?
but it gives an error when i fill in the path to the image.
LoopLbl.setIcon("path to image");
Did you read the API? The setIcon() takes an Icon as a parameter, not a String.
If you want to know how to use Icons, read the section from the Swing tutorial on How to Use Icons for working examples.
I suggest you keep the tutorial link handy for learning the basics of Swing.

Android: How to add TextView Dynamically? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm building a surveying app. On the creation of survey activity, I am having trouble how to implement the number of options to a particular survey?
For example let's say I want to ask:
What is your favourite Programming language?
1. C++
2. Java
3. C#
4. Python
5. I hate programming!!
Then in the next survey, I want to ask a Yes or No question:
Do you like ice cream?
1. Yes
2. No
See, options vary depending on the survey question; therefore, I am thinking of first asking the user how many options they would like to have then show them. However, I am unsure of going about doing so.
Can anyone please help me? I'll greatly appreciate it.
You can add TextView dynamically with this code
TextView textView = new TextView(<context intance here>);
textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
textView.setText("Sample Text");
Then add created TextView instance to your view container:
viewContainer.addView(textView);
You can change your view's layouting by its LayoutParams.
if you have radio buttons to chose from your answers you can try to only show as many radio buttons as many answers you have with a if clause

Categories