« first day (2322 days earlier)      last day (2618 days later) » 

10:16 PM
The proper word is carton
I can't believe live kittens was unpinned in this room
 
is there a cheat sheet of CSS -> android terms around?
 
no, they aren't really translatable
 
like display block is essentially android:layout_width="match_parent"
may be
@DaveS is the app you are working on private
 
android:layout_width="match_parent" <=> width: 100%
 
only the simple self explanatory things have a css counterpart
 
10:22 PM
yes forget the width:100%
 
yeah all my app code is for clients, I don't usually own the code I work on. I can share simple stuff like layout xml as an example but I can't share my apps
 
wouldn't there also be position absolute and relative in android?
 
RelativeLayout
there's not really a good way to do absolute positioning, nor should you want to
 
that's disappointing
 
:D
on the contrary, when you only have a few positionning pattern
it's easier to do UI stuffs
(of course you won't need all the CSS flexibility on a small screen)
 
10:24 PM
you can achieve it using layout margins in a FrameLayout but you're usually better off using LinerLayouts, RelativeLayouts etc and it adjusts for the screen sizes
absolute positioning rarely looks good on all screen sizes and ratios and if you want something, say pinned to the top right, you can still do that easy enough.
 
canvas is essentially absolute positioning is it not?
 
yes but it's for drawing
like game applications
 
there is the CoordinatorLayout, I have only used it once but it allows positioning depending on Anchor views
 
and the size may adjust to different view windows
 
@VeaceslavGaidarji - your personal website is very nice
 
10:34 PM
why doesn't this work for an onclick attribute
        android.view.View x = findViewById(R.id.mainLayout);
        x.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AlertDialog.Builder builder1 = new AlertDialog.Builder(getApplicationContext());
                builder1.setMessage("Write your message here.");
                builder1.setCancelable(true);

                builder1.setPositiveButton(
                        "Yes",
                        new DialogInterface.OnClickListener() {
 
when you use an onclick attribute you don't register your listener like this
 
then how would I?
 
you create a public method on your activity taking a View as argument eg: public submitAction (View view)
 
couldn't that also work?
 
and you put in it whatever logic you want
if you register the listener like you did
there is no reason for you to declare an onclick attriubte on your XML
it's one or the other
 
10:38 PM
The point is you don't try to use both of them at the same time I think
 
why doesn't it work as is then?
 
because underline declaring onClick on your xml and creating a method on your activity (that's just FYI), Android internally attach an OnClickListener (like you did) and resolves your click logic (using Java reflect)
 
I don't understand this statement
> because underline declaring onClick on your xml and creating a method on your activity
 
when you declare onClick, Android looks for an implementation function in your Activity and tries to evoke that instead
multiple onClick listeners breaks shit
so you need to set it up in only one way
 
aaaahhh that makes sense
 
10:42 PM
I really need to work on my English :)
Also:
> new AlertDialog.Builder(getApplicationContext());
should be
new AlertDialog.Builder(MyActivity.this);
 
@MehdiB. why?
its red also
 
You want to use the context closest to what you are doing to properly inherit view hierarchy, styles and other important attributes
you may need to make context accessible to the onClick listener because it doesn't have access to "this"
so you can make a member variable: private Context myContext; myContext = this; in onCreate()
 
the member variable or "YourActivityName.this" should work as well
 
why can't i put the following into onCreate
        AlertDialog.Builder builder1 = new AlertDialog.Builder(getApplicationContext());
        builder1.setMessage("Write your message here.");
        builder1.setCancelable(true);

        builder1.setPositiveButton(
                "Yes",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });

        builder1.setNegativeButton(
                "No",
I'm trying to get some feedback to make sure everything is updating properly
 
displaying UI elements isn't something to do there because the activity is not done being created
try onResume
 
10:51 PM
> onResume() does not override implement a method from a supertype
 
add @Override
 
i did
 
protected void
 
> @Override protected void onResume(Bundle s){
 
no Bundle
@Override protected void onResume(){
 
10:54 PM
genuis!
 
it freezes when I try to open the app now
 
and rely on the autocomplete of your Android studio to get the method names correct
 
forget to call super my bad
 
try not to paste repeated code blocks, or even any code blocks
link a gist instead
 
10:56 PM
okay
 
wow I forgot how to do it
 
so adding the following causes the app to freeze without its okay
 
replace getApplicationContext with this
there may be a problem using the Application and not the Activity to present the dialog
 
with the word this
 
yes
 
11:00 PM
genius!!!
can you add sub parts to a TextView?
or do you have to change to a Layout?
 
there is limited support for adding drawables to TextView but typically you want to add things within a layout
 
LinearLayout needs its own attribute
 
and set the namespace xmlns:android="http://schemas.android.com/apk/res/android"
to the root layout
and remove it from the TextView
 
so I added your attributes from your example
but it freezes
 
11:06 PM
I would suggest you to leverage android studio code generation as much as you can
 
@MehdiB. meaning do what?
 
2- remove xmlns:android="http://schemas.android.com/apk/res/android" from the TextView
meaning when you create a layout, choose the type of layout that you want to be the root of your file
such as LinearLayout or Relative
 
5
Q: Add multiple custom views to layout programmatically

user3304086If I for example have empty layout like this: layout1.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > </LinearLayout> And some other Layout like th...

 
still removing xmlns resultss in freeze
 
it will generate you some code and you'll put your own views inside (and customize it if needed such as background etc..)
 
11:08 PM
question contains the xml example
 
still freezes with new xml :(
 
if it "freezes" it'll probably crash, or has already crashed - it's more helpful to paste a gist with the stack trace in it - Android Studio has a console that dumps the output of your crashes and general logging, much like your webdevtools would - it'll be coloured bright red and say things like "IllegalStateException" or whatever
"it freezes" isn't descriptive enough for anyone here to even begin to help you.
 
what is wrong with gist?
 
@William please use pastebin for code
 
A small tip, moving from web dev to native mobile, I'd recommend not trying to draw parallels between CSS and the view system, or JavaScript and Java. If you try and do JS stuff in Java, you'll end up in absolute callback hell
 
11:15 PM
@jlindenbaum I am beginning to determine this
although I still love callbacks
 
gist is fine, i'm just saying "it freezes" doesn't help us debug things for you - we need stack traces, which you can find in Android Studio's console, which you can then paste into a gist in here
 
Can I access the console if I am on my phone?
pushing the app to my phone I mean
 
when you run your app (into your phone) and keep your phone plugged
 
yeah if your phone has usb debugging on (it does if you're pushing the app to it).
 
it will keep writing on the Android Studio Console
 
11:19 PM
in android studio hit CMD+4 (if you're on a mac), or in the bottom left click the "run" tab, and it'll have console output.
 
I think I need to access the child of the child
in the java code
 
you're instantiating your array adapter with a layout that isn't a textview
 
yes because I get the child elements
 
you'll have to write a custom adapter that can inflate and render list items that are more complex than just a textview
 
@jlindenbaum what does inflate mean
> Instantiates a layout XML file into its corresponding View objects
ahh well that makes sense
 
11:26 PM
if you're gonna ask me, and then google, you don't have to post the answer here :P
ezzylearning.com/tutorial/… - try something like this.
it's old, but the mayor concepts still stand...
that'll show you a simple implementation of a custom array adapter, that can handle more than just a textview, and also introduces you to the viewholder pattern. adjust the tutorial for your needs accordingly
 
interesting thank you
 
@CarlAnderson You sound like me, but ahead of everyone's time :D
 
realisation just hit me: code I wrote is running on millions of phones
this is insane
 
Cool :D
 
11:43 PM
what code Ahmad?
here I was feeling cool with my ~25k monthly active users
 
Wunderlist had 5M DAU, Outlook had 30M DAU :)
@DaveS you have 25k people who bought the grill?
woah that's impressive though since that's a lot bigger impact than just downloading the app
 
more than that probably, not all grills are WiFi
I have 25k devices that opened the app in the last 30 days
 
sweeet :D
do you actually own one of the grills?
 
yeah
 
how much does one cost?
 
11:48 PM
I have one of those, it's the cheapest one but I also have an apartment so it works on my patio with a fan to blow the smoke away
 
ohh they are sold at walmart?
 
sort of, its a distribution from a third party
 
that's one funky looking grill
 
gotcha
the website doesn't open
 
11:51 PM
they typically sell them in local bbq dealers
try it now
 
 
ah, oh well
 
did you block me m8
 
there are dealers in germany
so you could probably find one
 
i'm hungry now
 
11:54 PM
I forget, do you eat meat/dairy?
 
lol of course I do
:D
Uber Sues Leather Jacket Vendor For Discrimination, Claims Bulk Discount For Men Was Denied To Women Despite Being Over 3% As Large
 
😍
 

« first day (2322 days earlier)      last day (2618 days later) »