Being a Dot.Net programmer for several years now. It’s kinda hard downgrading back to good old eclipse and eclipse plugins.
It’s like watching RHPS at home, it’s the same except for all the bells and whistles. And tell ya the truth, You go to watch the show in the cinema because of the bells an whistles. Actually one would argue that without the bells and whistles throwing crap at each other, shouting APs and playing around with water pistols is damn right stupid – but I digress.
I found this site http://developer.android.com/guide/topics/ui/declaring-layout.html pretty useful to understand most of the technobabble about how to setup the vocab and the naming and stuff.
In general, if you want to work WITHIN the framework, you must learn these rules. ELSE? else you’re a regular programmer that fights the framework rather than embracing it and then shouting that M$ is just an evil system that doesn’t allow you to customize….
or in this case I guess it’s be G$$gle’s day in court vs the undisciplined programmers.
It’s kinda hard readjusting to setText vs .Text in properties and all this workaround shit.
too bad google went all NIH on us, and didn’t take a page out of the dot.net handbook.
had the added partial class life would’ve been sooo much simpler. this is like programming in 1995 again using tools designed to fight the good fight rather than tools to just WORK. I’ve half a mind to write my own hack to offer partial classes and point click services to the ADT – but I’m too lazy and underpaid for that. (or as I said before, I have only half a mind).
Back to the framework, and excuse my rants
So the layout file will contain a layout type located in the res/layout directory
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a TextView" />
<Button android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a Button" />
</LinearLayout>
After you've declared your layout, you need to load it.
the default Activity loads a Layout of:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
I love it how the “main” is itallicized and bolded, soo cute donchathink ?
so how do we write the ID ? we write it using
<Button android:id=”@+id/my_Button” />
this will be created in the R.java respectfully.
on the onCreate() method you can reach the Button using
Button myButton = (Button) findViewVyId(R.id.my_Button);
HELLO GOOGLE! WAKE UP
Dot.NET solved this is Dot.Net 2.0!
Specifically in ASP.NET. the xml parser the creates on the fly dot.net code? _Default.aspx class that locates the button and makes the connection ?
Why should I be writing automatic and seziphic code instead of programming my app? This is not something a programmer should be dealing with. this is something you should have written into your designer – oof.
No comments:
Post a Comment