How to get a String value in an Object from a List?How do I iterate over the words of a string?How do I read / convert an InputStream into a String in Java?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How to get an enum value from a string value in Java?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string?How to check whether a string contains a substring in JavaScript?How to split a string in JavaHow do I check if a string contains a specific word?How do I convert a String to an int in Java?

Can a business put whatever they want into a contract?

Where is it? - The Google Earth Challenge Ep. 4

Is there a generally agreed upon solution to Bradley's Infinite Regress without appeal to Paraconsistent Logic?

Unpredictability of Stock Market

To which noun is "qui" attached to in "le Baiser d'or du Bois, qui se recueille"?

Why is the return value of the fun function 8 instead of 7?

How does doing something together work?

What does "boys rule, girls drool" mean?

How To Make Earth's Oceans as Brackish as Lyr's

How to draw a Venn diagram for X - (Y intersect Z)?

Is my sink P-trap too low?

Persuading players to be less attached to a pre-session 0 character concept

How would you translate Evangelii Nuntiandi?

Test to know when to use GLM over Linear Regression?

Wrong Schengen Visa exit stamp on my passport, who can I complain to?

Why don't airports use arresting gears to recover energy from landing passenger planes?

Tips for remembering the order of parameters for ln?

Madrid to London w/ Expired 90/180 days stay as US citizen

How to give my students a straightedge instead of a ruler

Asked to Not Use Transactions and to Use A Workaround to Simulate One

how to know this integral finite or infinite

Why is it called a stateful and a stateless firewall?

How would you control supersoldiers in a late iron-age society?

'Overwrote' files, space still occupied, are they lost?



How to get a String value in an Object from a List?


How do I iterate over the words of a string?How do I read / convert an InputStream into a String in Java?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How to get an enum value from a string value in Java?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string?How to check whether a string contains a substring in JavaScript?How to split a string in JavaHow do I check if a string contains a specific word?How do I convert a String to an int in Java?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I want to get a String value from an Object that consists of an ImageView and two TextView in my List by clicking on that specific Object. But the problem is, I cannot get the String that I want.



The toast message should show the value of second TextView but it shows whatever it likes.




xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:orientation="vertical"
android:onClick="chitChat" >

<ImageView
android:id="@+id/photoImageView"
android:layout_width="300dp"
android:layout_height="200dp"
android:adjustViewBounds="true" />

<TextView
android:id="@+id/nameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Name" />

<TextView
android:id="@+id/uidTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />




If you have any other suggestion that helps me to get any Object specific value from clicked Object, I would like to hear that.



Thank you very much in advance.



public void chitChat(View view) 

TextView otherUid = findViewById(R.id.uidTextView);
String othersUid = otherUid.getText().toString();

Toast.makeText(PartyActivity.this, othersUid, Toast.LENGTH_LONG).show();


if (user != null && user.isEmailVerified())
Intent myIntent = new Intent(PartyActivity.this, ChatActivity.class);

myIntent.putExtra("Other Uid", othersUid);

PartyActivity.this.startActivity(myIntent);

else
//...











share|improve this question


























  • "...but it shows whatever it likes." what is that exactly?

    – Nikos Hidalgo
    Mar 28 at 12:54











  • @NikosHidalgo I mean It doesn't show the exact String value that displays in the <b>TextView</b>. Instead, it shows other Object's value in the List.

    – Sam Justman
    Mar 28 at 13:45

















1















I want to get a String value from an Object that consists of an ImageView and two TextView in my List by clicking on that specific Object. But the problem is, I cannot get the String that I want.



The toast message should show the value of second TextView but it shows whatever it likes.




xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:orientation="vertical"
android:onClick="chitChat" >

<ImageView
android:id="@+id/photoImageView"
android:layout_width="300dp"
android:layout_height="200dp"
android:adjustViewBounds="true" />

<TextView
android:id="@+id/nameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Name" />

<TextView
android:id="@+id/uidTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />




If you have any other suggestion that helps me to get any Object specific value from clicked Object, I would like to hear that.



Thank you very much in advance.



public void chitChat(View view) 

TextView otherUid = findViewById(R.id.uidTextView);
String othersUid = otherUid.getText().toString();

Toast.makeText(PartyActivity.this, othersUid, Toast.LENGTH_LONG).show();


if (user != null && user.isEmailVerified())
Intent myIntent = new Intent(PartyActivity.this, ChatActivity.class);

myIntent.putExtra("Other Uid", othersUid);

PartyActivity.this.startActivity(myIntent);

else
//...











share|improve this question


























  • "...but it shows whatever it likes." what is that exactly?

    – Nikos Hidalgo
    Mar 28 at 12:54











  • @NikosHidalgo I mean It doesn't show the exact String value that displays in the <b>TextView</b>. Instead, it shows other Object's value in the List.

    – Sam Justman
    Mar 28 at 13:45













1












1








1








I want to get a String value from an Object that consists of an ImageView and two TextView in my List by clicking on that specific Object. But the problem is, I cannot get the String that I want.



The toast message should show the value of second TextView but it shows whatever it likes.




xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:orientation="vertical"
android:onClick="chitChat" >

<ImageView
android:id="@+id/photoImageView"
android:layout_width="300dp"
android:layout_height="200dp"
android:adjustViewBounds="true" />

<TextView
android:id="@+id/nameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Name" />

<TextView
android:id="@+id/uidTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />




If you have any other suggestion that helps me to get any Object specific value from clicked Object, I would like to hear that.



Thank you very much in advance.



public void chitChat(View view) 

TextView otherUid = findViewById(R.id.uidTextView);
String othersUid = otherUid.getText().toString();

Toast.makeText(PartyActivity.this, othersUid, Toast.LENGTH_LONG).show();


if (user != null && user.isEmailVerified())
Intent myIntent = new Intent(PartyActivity.this, ChatActivity.class);

myIntent.putExtra("Other Uid", othersUid);

PartyActivity.this.startActivity(myIntent);

else
//...











share|improve this question
















I want to get a String value from an Object that consists of an ImageView and two TextView in my List by clicking on that specific Object. But the problem is, I cannot get the String that I want.



The toast message should show the value of second TextView but it shows whatever it likes.




xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:orientation="vertical"
android:onClick="chitChat" >

<ImageView
android:id="@+id/photoImageView"
android:layout_width="300dp"
android:layout_height="200dp"
android:adjustViewBounds="true" />

<TextView
android:id="@+id/nameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Name" />

<TextView
android:id="@+id/uidTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />




If you have any other suggestion that helps me to get any Object specific value from clicked Object, I would like to hear that.



Thank you very much in advance.



public void chitChat(View view) 

TextView otherUid = findViewById(R.id.uidTextView);
String othersUid = otherUid.getText().toString();

Toast.makeText(PartyActivity.this, othersUid, Toast.LENGTH_LONG).show();


if (user != null && user.isEmailVerified())
Intent myIntent = new Intent(PartyActivity.this, ChatActivity.class);

myIntent.putExtra("Other Uid", othersUid);

PartyActivity.this.startActivity(myIntent);

else
//...








java android string






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 13:03









Sabbir Ahmed

3282 silver badges10 bronze badges




3282 silver badges10 bronze badges










asked Mar 28 at 12:51









Sam JustmanSam Justman

104 bronze badges




104 bronze badges















  • "...but it shows whatever it likes." what is that exactly?

    – Nikos Hidalgo
    Mar 28 at 12:54











  • @NikosHidalgo I mean It doesn't show the exact String value that displays in the <b>TextView</b>. Instead, it shows other Object's value in the List.

    – Sam Justman
    Mar 28 at 13:45

















  • "...but it shows whatever it likes." what is that exactly?

    – Nikos Hidalgo
    Mar 28 at 12:54











  • @NikosHidalgo I mean It doesn't show the exact String value that displays in the <b>TextView</b>. Instead, it shows other Object's value in the List.

    – Sam Justman
    Mar 28 at 13:45
















"...but it shows whatever it likes." what is that exactly?

– Nikos Hidalgo
Mar 28 at 12:54





"...but it shows whatever it likes." what is that exactly?

– Nikos Hidalgo
Mar 28 at 12:54













@NikosHidalgo I mean It doesn't show the exact String value that displays in the <b>TextView</b>. Instead, it shows other Object's value in the List.

– Sam Justman
Mar 28 at 13:45





@NikosHidalgo I mean It doesn't show the exact String value that displays in the <b>TextView</b>. Instead, it shows other Object's value in the List.

– Sam Justman
Mar 28 at 13:45












2 Answers
2






active

oldest

votes


















1
















Replace below line



TextView otherUid = findViewById(R.id.uidTextView);


to:



TextView otherUid = view.findViewById(R.id.uidTextView);


It should work






share|improve this answer

























  • This is it. How simple and important. Thank you very much indeed. It works...

    – Sam Justman
    Mar 28 at 13:54











  • Glad you liked.

    – Saurav Kumar
    Mar 28 at 14:13


















0
















...
Hi Sam,
You need to set the text of the second TextView before getting it.
You can do this adding android:text to the second textview in the xml to have static text (the default value).
To have dynamic text into your second textview just set the text when you are creating the element of the List.
Hope this help.



Cheers






share|improve this answer

























  • Thanks for the answer but of course I set a value in it. I just didn't show that part of the code. It's my bad. Anyways thanks for the response.

    – Sam Justman
    Mar 28 at 13:57











  • You're welcome :)

    – TomD88
    Mar 28 at 14:53













Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55398137%2fhow-to-get-a-string-value-in-an-object-from-a-list%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1
















Replace below line



TextView otherUid = findViewById(R.id.uidTextView);


to:



TextView otherUid = view.findViewById(R.id.uidTextView);


It should work






share|improve this answer

























  • This is it. How simple and important. Thank you very much indeed. It works...

    – Sam Justman
    Mar 28 at 13:54











  • Glad you liked.

    – Saurav Kumar
    Mar 28 at 14:13















1
















Replace below line



TextView otherUid = findViewById(R.id.uidTextView);


to:



TextView otherUid = view.findViewById(R.id.uidTextView);


It should work






share|improve this answer

























  • This is it. How simple and important. Thank you very much indeed. It works...

    – Sam Justman
    Mar 28 at 13:54











  • Glad you liked.

    – Saurav Kumar
    Mar 28 at 14:13













1














1










1









Replace below line



TextView otherUid = findViewById(R.id.uidTextView);


to:



TextView otherUid = view.findViewById(R.id.uidTextView);


It should work






share|improve this answer













Replace below line



TextView otherUid = findViewById(R.id.uidTextView);


to:



TextView otherUid = view.findViewById(R.id.uidTextView);


It should work







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 28 at 13:00









Saurav KumarSaurav Kumar

1347 bronze badges




1347 bronze badges















  • This is it. How simple and important. Thank you very much indeed. It works...

    – Sam Justman
    Mar 28 at 13:54











  • Glad you liked.

    – Saurav Kumar
    Mar 28 at 14:13

















  • This is it. How simple and important. Thank you very much indeed. It works...

    – Sam Justman
    Mar 28 at 13:54











  • Glad you liked.

    – Saurav Kumar
    Mar 28 at 14:13
















This is it. How simple and important. Thank you very much indeed. It works...

– Sam Justman
Mar 28 at 13:54





This is it. How simple and important. Thank you very much indeed. It works...

– Sam Justman
Mar 28 at 13:54













Glad you liked.

– Saurav Kumar
Mar 28 at 14:13





Glad you liked.

– Saurav Kumar
Mar 28 at 14:13













0
















...
Hi Sam,
You need to set the text of the second TextView before getting it.
You can do this adding android:text to the second textview in the xml to have static text (the default value).
To have dynamic text into your second textview just set the text when you are creating the element of the List.
Hope this help.



Cheers






share|improve this answer

























  • Thanks for the answer but of course I set a value in it. I just didn't show that part of the code. It's my bad. Anyways thanks for the response.

    – Sam Justman
    Mar 28 at 13:57











  • You're welcome :)

    – TomD88
    Mar 28 at 14:53















0
















...
Hi Sam,
You need to set the text of the second TextView before getting it.
You can do this adding android:text to the second textview in the xml to have static text (the default value).
To have dynamic text into your second textview just set the text when you are creating the element of the List.
Hope this help.



Cheers






share|improve this answer

























  • Thanks for the answer but of course I set a value in it. I just didn't show that part of the code. It's my bad. Anyways thanks for the response.

    – Sam Justman
    Mar 28 at 13:57











  • You're welcome :)

    – TomD88
    Mar 28 at 14:53













0














0










0









...
Hi Sam,
You need to set the text of the second TextView before getting it.
You can do this adding android:text to the second textview in the xml to have static text (the default value).
To have dynamic text into your second textview just set the text when you are creating the element of the List.
Hope this help.



Cheers






share|improve this answer













...
Hi Sam,
You need to set the text of the second TextView before getting it.
You can do this adding android:text to the second textview in the xml to have static text (the default value).
To have dynamic text into your second textview just set the text when you are creating the element of the List.
Hope this help.



Cheers







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 28 at 13:07









TomD88TomD88

4637 bronze badges




4637 bronze badges















  • Thanks for the answer but of course I set a value in it. I just didn't show that part of the code. It's my bad. Anyways thanks for the response.

    – Sam Justman
    Mar 28 at 13:57











  • You're welcome :)

    – TomD88
    Mar 28 at 14:53

















  • Thanks for the answer but of course I set a value in it. I just didn't show that part of the code. It's my bad. Anyways thanks for the response.

    – Sam Justman
    Mar 28 at 13:57











  • You're welcome :)

    – TomD88
    Mar 28 at 14:53
















Thanks for the answer but of course I set a value in it. I just didn't show that part of the code. It's my bad. Anyways thanks for the response.

– Sam Justman
Mar 28 at 13:57





Thanks for the answer but of course I set a value in it. I just didn't show that part of the code. It's my bad. Anyways thanks for the response.

– Sam Justman
Mar 28 at 13:57













You're welcome :)

– TomD88
Mar 28 at 14:53





You're welcome :)

– TomD88
Mar 28 at 14:53


















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55398137%2fhow-to-get-a-string-value-in-an-object-from-a-list%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript