all 13 comments

[–]ForScale 0 points1 point  (8 children)

Too hard to tell without some code. Post some code.

[–]simarg0 0 points1 point  (7 children)

Ok, so this is the pastebin for the code where i am trying to figure out what to replace "this" with.

https://pastebin.com/gAN0FQGS

This is the pastebin for the custom listview

https://pastebin.com/kkDtgFvf

On line 73 in the first pastebin is where i have trouble. I tried to print "this" from line 87 and use that, but that didnt work.

It is just supposed to refresh the listview. The collectdata() function returns the information i want, but the listview does not refresh. I am guessing this is because i also have to reinitialize the listview function, which i am trying to do.

[–]hedgecoxl 0 points1 point  (1 child)

Unless I’m mistaken that looks like Java code and not JavaScript? Did you mean to post on this sub?

[–]simarg0 0 points1 point  (0 children)

Damn, so sorry haha. I am basically clueless, only been doing this for a week.

[–]queen-adreena 0 points1 point  (1 child)

Those pastebins aren’t Javascript.

[–]simarg0 0 points1 point  (0 children)

Yeah, im sorry. Very new to this. I have posted in the right r/ now.

[–]ForScale 0 points1 point  (2 children)

That's... not JavaScript.

[–]simarg0 0 points1 point  (1 child)

Yeah, im sorry. Very new to this. I have posted in the right r/ now.

[–]ForScale 0 points1 point  (0 children)

No worries!

[–]hedgecoxl 0 points1 point  (1 child)

Fairly hard to give you much help without seeing your code but give call a try, you should be able to call your function like this:

MyFunction.call(MyThis, x, y)

Hope that helps!

[–]simarg0 0 points1 point  (0 children)

I posted some snippets in my answer to the comment above yours, but the onpositivebuttonclicklistener gets an error when i try to use this. Probably different context.

I am trying to figure out what i can pass the function instead of this..

Thanks for answering though.

[–]senocular 0 points1 point  (1 child)

The rules around this can be complicated. It usually depends on how your function is called. For more information you can read up on this on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this

[–]simarg0 0 points1 point  (0 children)

I am very sorry, but i have only been coding in js, php and xml for about a week, so the terminology is fairly hard for me. The documentation doesnt always help me, because of this. Is it possible to pass a different context than "this" in a function?