« first day (1715 days earlier)      last day (1760 days later) » 

2:00 PM
\o/ Neighbour is here :D
How are you doing?
 
:) :) doing good.. heat wave at ur place too, geis? :)
 
Oh yeah...
 
bottle of water next to you there? :)
 
So, a JavaBean is just a class with getters/setters?
 
@Ramona Yup ^^
Almost empty, but I only got 30 minutes left ^^
 
2:05 PM
:)
good for you :)
 
How long do you have to stay?
 
yup , meaning like same to setter/getter..
JavaBeans are classes that encapsulate many objects into a single object (the bean)
 
user8063991
@Krrish Remember to read the rules before you break them ;) Woof woof!
 
Oh, so a Bean is a single object? @Krrish
 
im working at home :) luckily. im not made to work for somebody as an employee :) @geisterfurz007
 
2:13 PM
Meh :D
 
@CrashBandicoot its collection of objects
 
I see
Thanks @Krrish
 
what's use of lamda expression ??
 
o/
 
\o
 
user8063991
2:17 PM
\o
 
o/
 
@Krrish Compressing a ton of code into () ->
What for example could be
new Runnable() {
@Override
public void run() {
//something
}
}
Instead of that you can write () -> { //something };
 
What benefits does that have? @geisterfurz007
 
correct , now got it..
means it used for code optimization
 
Shorter
 
2:20 PM
I see
Is that a new feature of JDK 8?
 
It is
You can use a lambda whenever there is an anonymous class you need to create that has to implement an Interface and this Interface only has one method @Krrish
 
But, can't shorter code be done on previous JDKs?
 
does lamda expression effects at runtime ?
 
I am unsure, but I am certain that a lambda will not create an additional class file on compilation
I cannot tell you more about it though :/
But I am sure a lot of articales (including answers on stackoverflow) can :)
 
I don't understand that bit of code you pasted @geisterfurz007
 
2:22 PM
@geisterfurz007 ok
 
In what way is it shorter?
 
new Runnable() {
@Override
public void run() {
//something
}
}
vs.
() -> {//something);
The latter should appear shorter to the average human eye :D
 
xD
Yeah, but wouldn't the brackets have code before it?
How would the compiler know what the brackets are?
 
@CrashBandicoot Yes they would
Runnable r = () -> {//something};
 
() -> { //something }

is this correct format of lamda exression ..for each block of code ?
 
2:27 PM
@Krrish Unsure what you mean...
Gotta go though to catch a train, sorry
 
So in the lambda expression, there's no @Override bit
@geisterfurz007 Bye!
@Krrish So, with the lambda expression, there wouldn't be the "public void run()" bit?
 
@CrashBandicoot ok, good
 
bye
 
Is that right?
@Kaushik Bye!
 
what will be future language of android kotlin/java ??
 
2:37 PM
none
 
@ColdFire :)
 
@CrashBandicoot correct. As it is clear for the compiler which type to use (either because there is only one argument accepted (Thread case), you are assigning it to a variable (like Runnable r) or because you are casting the lambda if multiple Interfaces can be possible) it also knows, which method the lambda is supposed to represent
 
user8232051
hi everyone
 
@AKASHDEEPKATIYAR Hi!
 
Because as mentioned earlier, the Interfaces one can represent with a lambda may only have one method
 
user8232051
2:44 PM
what's up software developer @CrashBandicoot
 
xD
I'm good thanks! And you?
@geisterfurz007 Thanks so much!
 
user8232051
I am good too :)
 
Not for that ^^
 
user8232051
you work with server technology or database ?@CrashBandicoot
 
I'm a student, but I use both tbh
What's meant by Server Tech btw?
Do you mean Java?
 
user8232051
2:47 PM
yeah, kind of
 
user8232051
I am a student too
 
user8232051
I got my previous semester results today,lol
 
What did you get?
 
user8232051
you mean , grade ??
 
Yeah
Were you happy with your result?
 
user8232051
2:49 PM
well, I was expecting more marks but its okay
 
user8232051
knowledge and intelligence matters more
 
Are your grades like 1st, second, etc?
 
user8232051
I believe
 
That's so true
But to an extent, you need the grade to do well
However:
 
user8232051
no, they don't give grades here actually, they give marks or numbers
 
2:50 PM
If you're good at what you do, you can earn well
 
user8232051
yes of course
 
user8232051
btw what are you studying
 
Surely you can improve for your next semester
 
user8232051
I hope so
 
It's Computer Science
 
user8232051
2:51 PM
ohh cool, same here :)
 
Java doesn't seem to stay in my head
 
user8232051
lol
 
user8232051
what about sql ?
 
I enjoy doing it, but I find it difficult
Yeah, I do SQL too
 
user8232051
me too
 
2:51 PM
Much easier imo
But they're incomparable
 
user8232051
yeah
 
user8232051
sql is more concerned with databases and queries I guess
 
How do you find Java?
Yeah, true
 
user8232051
same like you, difficult
 
user8232051
2:53 PM
lol
 
I'm very sure you're better than me. People in this chat would agree
 
lol
 
user8232051
no one would agree, i am just a newbie
 
I understand the material, but fail when it comes to the application building
 
user8232051
ohh
 
2:54 PM
It's always the application that gets to me xD
 
user8232051
why dont you refer to some tutorials on the internet
 
I have done
 
user8232051
and ?
 
I can obviously do the basics of an application
But the complex stuff I can't get my head around
 
user8232051
ohh
 
user8232051
2:55 PM
you will learn eventually
 
user8232051
just have to keep trying
 
You can create applications?
 
user8232051
no, i am creating my first one actually
 
user8232051
I am created many basic ones too like you
 
user8232051
but now I am trying to build some thing
 
2:56 PM
Have you done anything along the lines of an Airport Simulation?
 
user8232051
like something original
 
user8232051
no , I havent, sorry
 
@LunarWatcher lol
@DroidDev :-[
 
Hmm okay
 
@BatCat sure, what is it?...
 
2:57 PM
What's the most complex app you've created?
@berserk Are they in this chat? I can't see them or their recent messages
 
user8232051
a meme generator and a simple file manager
 
user8232051
btw gotta go now @CrashBandicoot
 
Adios @AKASHDEEPKATIYAR
Enjoy your day!
 
@CrashBandicoot who?
 
LunarWatcher and DroidDev
 
3:20 PM
@berserk this is no laughing matter
My laziness is nothing to laugh about - ask hans. He has hundreds of pings from chew in his inbox
 
@LunarWatcher were you away for a bit?
 
yeah @CrashBandicoot
making a game, I close the chat tab some times
 
Ohh
I thought you blocked me or something
 
ah
Apparently, you can write .1 instead of 0.1 with floats and doubles (applies to all numbers, 0.1 is an example)
 
3:44 PM
Bye guys!
 
Hi Lunar :) Can you tell me if this is the correct way of adding Fragments in MainActivity?
fragmentList = new ArrayList<>();
fragmentList.add(new Fragment1());
fragmentList.add(new Fragment2());
fragmentList.add(new Fragment3());
fragmentList.add(new Fragment4());
fragmentList.add(new Fragment5());
(I need to use planty of Fragments)
@LunarWatcher
 
If the contents of each fragment is the same (view-wise) it is better to create a constructor to take in the data to display in the different views
if the fragments are different, and you have a lot of fragments, that is the best way
if you have a few, adding them outside an arraylist is the best way to go about it
 
the layout is the same for all but each has different text and images in it.
so in this case my above way would be the best solution?
 
4:06 PM
but the same views?
You could make it much easier for you in dev to pass in the data, pass the text and image. That way you only need one fragment
And you can have multiple instances
 
RelativeLayout for all.
 
psudo-code:
MasterFragment frag = new MasterFragment("Content", Bitmap, other data);
MasterFragment frag2 = new MasterFragment("Content of second", bitmapofsecond, other data);
one fragment with different data
then add those to the list
 
imgur.com/a/j1Zbx they all look like this (just different data)
 
you need to learn to write one object with multiple usages, if you have to write 100 fragments for 100 different texts/image, you will write a lot of boilerplate code (code you don't need). You can have one fragment and have 100 instances of that (there are 100 instances either way)
example of that:
in a game, there are enemies. There are 10 different enemies with different properties of the same type (position, strength, weapon power, weapon type, etc)
Instead of writing 10 different classes, one class can be written with the ability to handle the different properties
you write roughly 10 times less code in that case
 
so the class for this is e.g. ENEMIES and positions/strength/weapon..and the rest are variables in this class?
 
4:15 PM
yeah, all initialized in the constructor
you can do that with the fragments as well, as long as they have the same views (imageview, textview, radiogroup) you can have one for that
and as many instances as you need (you need 100 instances for 100 objects, the difference is whether or not there are 100 isntances of 100 different classes for 100 objects or 100 instances of 1 class for 100 objects)
 
so in this case imgur.com/a/j1Zbx this above code with 'add.' is ok?
and what abt xmls, Lunar? I have to clean this mess imgur.com/a/u8HUa with xmls right?
create only one xml file for all?
 
ugh that is a lot of fragments
yes, one for all
 
user8232051
hey @LunarWatcher can you tell me how to get a Imagebutton from where I inflated it ?? It seems findviewbyId for that Imagebutton is returning null. Here is the code
 
user8232051
1
Q: How to inflate another xml on clicking a button

AliI have one Activity in that there are no Buttons but I have coded it in such a way that another Activity comes, now in this second Activity there are three Buttons, on which when I click all inflating different respective activities. In this second Activity there I have added one more Button, on...

 
you add a constructor taking in the image, text and the three answers. You can use a class with these if you want to @Ramona
@AKASHDEEPKATIYAR assuming the ImageButton is inside the layout you need to check the findViewById on the inflated layout:
ImageButton ib = (ImageButton) layout.findViewById(...)
layout is the view inflated (taken from the supplied code)
 
user8232051
4:25 PM
ImageButton is in different layout than that of adapter@LunarWatcher
 
There is very little code in the question you linked, so I have to ask: what adapter?
 
thanks Lunar. so there will be ONE image/text/answer as a parameter in this constractor,right? And how to pass so many images/texts/answers to these parameters?
 
user8232051
ArrayAdapter , its the first few lines of the java file @LunarWatcher
 
@Ramona not one for all the answers, there are three, aren't there? You also want to supply an ID to which answer is correct
 
yes.
 
4:29 PM
so you create a constructor (arguments cheat list: String content, Bitmap image, List<String> answers, int correctAnswer)
the answers is a list so you can have as many answers as you want (you may need to inflate more radiobuttons if you have more than 3 answers)
 
user8232051
I have edited the code, java file starts with oncreate method, arrayadapter starts at 7th line @LunarWatcher
 
@AKASHDEEPKATIYAR I have not been supplied with any code for an ArrayAdapter. The question linked contains the inflation process, but there is no arrayadapter there
There is too much missing code at the moment for any kind of answer that isn't a guess
 
user8232051
oops I am so sorry @LunarWatcher
 
user8232051
I pasted wrong link
 
user8232051
0
Q: pause button not clickable in music player

AKASHDEEP KATIYARI am a newbie in android development.In my music player app, whenever I click the play/pause button to pause the song , nothing happens. It seems like the imagebutton is not clickable because nothing happens on touching it. I am not able to pause the song playing. I have tried all possible soluti...

 
user8232051
4:32 PM
reallys orry for that
 
'takk' Lunar :)
 
user8232051
sorry
 
@Ramona ;)
 
;)
 
@AKASHDEEPKATIYAR it's fine. Checking it
 
user8232051
4:32 PM
thanks
 
@AKASHDEEPKATIYAR could I see a screenshot of the app when it is run?
 
user8232051
yes
 
user8232051
wait a sec
 
o/
 
\o
 
user8063991
4:37 PM
\o
 
user8063991
o/
 
/o\
got loud here :)
 
better loud than frozen
 
the frozen throne
 
4:40 PM
shall we dance too ? :)
 
no, not a fan of dancing
once Hell freezes over, sure why not (not to be confused with Hell in Norway)
 
as normal. all guys don't like it. hmm.
 
(in public)
 
really?
shame or what?
 
user8232051
 
user8232051
4:43 PM
 
@Ramona don't like it
 
user8232051
first one is the listview activity@LunarWatcher
 
user8232051
second one is the activity where song is played
 
user8232051
and the buttons are present
 
user8232051
for controlling playback
 
4:47 PM
that was complex code, had to read it to figure out what does what
 
user8232051
umm sorry for that@LunarWatcher
 
It's not a problem
and the button returns null? @AKASHDEEPKATIYAR
(findViewById on the button)
 
user8232051
yes actually the button is not clickable, when I asked it on SO, someone answered that maybe its null
 
user8232051
@LunarWatcher
 
user8232051
I don't get anything in logcat but when I use breakpoints and debug
 
4:50 PM
add this after you use findViewById: Log.e("DEBUG", btnPlay1); if there is an error, add .toString() after btnPlay1 (so it becomes btnPlay1.toString()
AFter that, open logcat and search for the DEBUG tag (after launching the app)
 
need to increase reps to 50 to be able to comment, anybody can help? :)
 
user8232051
I get this on debugging for now @LunarWatcher
 
user8232051
 
user8232051
okay I will try that now @LunarWatcher
 
only wise comments, I promise ;)
 
4:51 PM
You should in theory see one line (or two, but one reported line) saying either null or some complex text with hex values and stuff
if it says null, it is bad. otherwise it is good. Paste the line here once you get it
 
Lunar is try-catch' loop good to use in this case? i heard that it should be avoided as much as possible. you can always use e.g. for - else loop. what you think?
 
Try catch is must in some cases
 
user8232051
@LunarWatcher console shows nothing, only "connected to the target VM" stuff
 
Is the Android Monitor (logcat) open?
@Ramona for - else loops doesn't exist. Try-catch isn't a loop
 
user8232051
yes logcat shows this
 
user8232051
4:56 PM
com.example.dell_1.myapp3 E/DEBUG: android.widget.ImageButton{fb12397 VFED..C.. ......I. 0,0-0,0 #7f0d0079 app:id/btnPlay1}
 
if-else, try-catch, for, while, do-while
 
user8232051
@LunarWatcher
 
@AKASHDEEPKATIYAR that is good
this means the view isn't null
that isn't the problem
 
user8232051
ohh okay
 
Yes, Lunar. got mixed up a bit.
@jagapathi need to increase my rep to 50, will you help? :)
 
user8232051
4:57 PM
then why the button is not clickable@LunarWatcher
 
You can delete that log tag now. Create a new tag inside the onClickListener
 
user8232051
I am confused
 
make it print "yes" or something
 
user8232051
okay
 
then you click the button
If it doesn't print "yes" (or whatever you print) it doesn't reach that
this is very brute-force debug, when breakpoints doesn't help
same style though, Log.e with DEBUG as the tag
content is "yes"
 
user8232051
5:00 PM
okay doing that
 
Is it printing "yes"?
 
user8232051
it is giving an error
 
What is the error?
 
user8232051
says btnPlay1 needs to be declared final
 
oh, right
ok, workaround
never mind that
remove btnPlay1
replace it with yes when isnide onClick
You don't need to print out the button, all you need is "yes" or any text
 
user8232051
5:06 PM
what if I declare it final >
 
user8232051
?
 
You can print out the button from the onTouchListener
But in this case, there is no need to do that
 
user8232051
okay
 
user8232051
okay so its not printing anything
 
user8232051
@LunarWatcher
 
5:10 PM
And you are pressing the button?
 
user8232051
yes
 
user8232051
many times
 
Is it only problem with pause
??
 
user8232051
I haven't written code for other buttons yet
 
user8232051
this was the first one
 
5:12 PM
Ok but at least it should play song right?
 
hold on
 
user8232051
yes song is being played
 
use View.OnClickListener instead
 
Imagebutton.onclick
 
going to eat dinner, back in 20 minutes
 
5:12 PM
I seen this
 
user8232051
I have tried that
 
user8232051
okay
 
user8232051
will try again
 
@LunarWatcher yo u seen it
 
user8232051
seen what ??
 
5:14 PM
Use view.onclicklistener
Let me show you
 
user8232051
used that just now
 
user8232051
not working
 
user8232051
okay
 
U can see new Imagebutton.Onclicklistener
 
user8232051
yes
 
5:16 PM
I think it should be view.onclicklistener
 
user8232051
okay
 
user8232051
lets try that
 
U already started the player and button click listener is not working
Well that was the problem
 
user8232051
its not working still
 
user8232051
@jagapathi
 
user8232051
5:19 PM
public void abc(){
ImageButton btnPlay1 = (ImageButton) findViewById(R.id.btnPlay1);
btnPlay1.setOnClickListener(
new View.OnClickListener(){
public void onClick(View v){
if (mMediaPlayer.isPlaying()) {
mMediaPlayer.pause();
} else {
mMediaPlayer.start();
}

}
});
 
Show the changes
 
user8232051
I pasted the code
 
Check if it reached the code with debug
 
user8232051
okay
 
user8232051
wait a sec
 
user8232051
5:21 PM
same as before it stops at that adapter line of code
 
user8232051
 
Press the play button in debug menu
Below
So it execute line by line
 
user8232051
play or resume ?
 
I don't know what it named (some green resume button )
 
user8232051
I pressed it, what now ?
 
5:26 PM
Oh no do u know how to debug?
 
user8232051
I am sorry but I am really naive in this
 
Ok let me explain
Run your app in debug mode
Wait for debugger to come up
Open your app and go to the problem activity
Red points u marked are breakpoints
Code execution will stop there
 
user8232051
do I have to click "debug sample" or "attach debugger" ?
 
And you can press resume button in debug menu to continue to next line
 
user8232051
i did run the app then clicked "attach debugger"
 
user8232051
5:33 PM
opened app
 
user8232051
but app isn't responding
 
Huh I am tired
 
back
@AKASHDEEPKATIYAR maybe it is caught at a breapoint
try manually setting it to clickable (in java code use .setClickable(true)) @AKASHDEEPKATIYAR
//shutdown
 
user8063991
Shutting down. See you later.
 
user8232051
5:52 PM
done that
 
user8232051
not working still@LunarWatcher
 
user8232051
can you guess why its not clickable so that I can work from there
 
I have no clue
when it is set to clickable, it should be clickable
 
user8232051
umm okay
 
is the onclicklistener set to View.OnClickListener
 
user8232051
5:56 PM
yes
 
user8232051
public void abc(){
ImageButton btnPlay1 = (ImageButton) findViewById(R.id.btnPlay1);
btnPlay1.setClickable(true);
btnPlay1.setOnClickListener(
new View.OnClickListener(){
public void onClick(View v){
if (mMediaPlayer.isPlaying()) {
mMediaPlayer.pause();
} else {
mMediaPlayer.start();
}

}
});
}
 
user8232051
do you think it has something to do with adapter
 

« first day (1715 days earlier)      last day (1760 days later) »