₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,329,708 members, 8,441,862 topics. Date: Thursday, 09 July 2026 at 09:15 AM

Toggle theme

DavidTheGeek's Posts

Nairaland ForumDavidTheGeek's ProfileDavidTheGeek's Posts

1 2 3 4 5 6 7 8 ... 26 27 28 29 30 31 32 33 34 (of 34 pages)

BusinessRe: Read by DavidTheGeek(op): 4:31pm On Jul 16, 2016
Akayshittu:
So how much does the book cost if you want to share? Can you give a brief of the book in terms of no of pages, is the author a Nigerian etc. Thanks
Hope you found the excerpt i've shared insightful. Here's more info about the book... The book is intersting and practical. You'll be inspired right from chapter one cuz stories of real life people who have started businesses on their own is used as examples through out the book. At the end of each chapter some key points are highlighted just in case you missed them while reading. The book has 181 pages and it's not authored by a Nigerian.
BusinessRe: Read by DavidTheGeek(op):
.
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 10:45am On Jul 16, 2016
folks4luv:
so it happens that I was outta mb for some days and now I feel lost. so sad
Hehehe my front row student you're back. Oya read previous posts and get to work. Ask questions if you need help.
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 2:35am On Jul 16, 2016
Toluene15:
Next.. How do we make the "<button" respond?
I've posted that already. Check my previous posts.
Christianity EtcRe: Andrew Ejimadu Arrested In Zambia For Sleeping With A Minor. Photos by DavidTheGeek: 5:18pm On Jul 14, 2016
Most of the people who flocked to the event were sent back home on rumbling stomach's and are still waiting for a miracle to credit their accounts.
cheesy [color=#ff0000]They should check my signature[/color]
CultureRe: Emir Sanusi's Wife, Sadiya's Birthday by DavidTheGeek: 2:49pm On Jul 14, 2016
lexiconkabir:
I hail you spacebookers ooo grin
cheesy
CultureRe: Emir Sanusi's Wife, Sadiya's Birthday by DavidTheGeek: 2:45pm On Jul 14, 2016
"national treasure" grin
PoliticsRe: Reps Sex Scandal Investigation Begins Today by DavidTheGeek:
cheesy This is serious
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 11:46am On Jul 13, 2016
MOVING ON.... BUTTON
We're still working on our app.

Button

A Button is a Push-button which can be pressed, or clicked, by the user to. perform an action.

Attributes
The following are the important attributes related to Button control. You can check Android official documentation for
complete list of attributes.

* android:text - This is the Text to display.
android:text="Click Me"

* android:id - This supplies an identifier name for this view
eg android:id="@+id/button1"

* android:onClick - This is the name of the method in this View's context to invoke when the view is clicked.
eg android:onClick="showToast"

There are 2 ways to respond to a button click.

1. Using the Button onClick attribute
2. Registering an onClick Event listener

Lets use the Option 1 first...
To respond to button clicks using onClick attribute, you need to create a method in your activity (in this case MainActivity.java) and then invoke it in your Button

package com.learning.myfirstapp;

import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class MainActivity extends Activity
{
/** Called when the activity is first created. */
Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/**
setContentView(R.layout.main);
the code means you're telling MainActivity to load (show) res/layout/main.xml

If you have lets say two layouts, main and secondlayout. To load "secondlayout" that code would be
setContentView(R.layout. secondlayout);
**/
}

// Create a method for the Button onClick attribute

public void showToast(View v) {
Toast.makeText(getBaseContext(), "Hey! You clicked me", Toast.LENGTH_LONG).show();
}
public void showToast(View v)

showToast is the name i chose to call the method i created. You can name it anything you like.


In your main.xml, add onClick attribute and invoke the method:

android:onClick="showToast"

**********

Click menu and Run.

Open your app and click the button. A toast message should appear.

PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 10:23am On Jul 13, 2016
Reyginus:
How about this, DavidTheGeek? I borrowed your colour codes.
Not bad. The background color tho huh
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 10:20am On Jul 13, 2016
phensbassey:
here s a screen shot of mine its showing me eror pls tel me what idid wrong
Copy and paste your code here.
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 3:03pm On Jul 12, 2016
Reyginus:
Why?
Read yorex2011 post above.
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 2:36pm On Jul 12, 2016
Reyginus:
No. Let me try it now. I'm not using the second method btw.
Okay. Well the 1st method is quicker when coding. Tho it's not adviceable to use it for big projects.
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 2:29pm On Jul 12, 2016
Reyginus:
Not too bad so far.
Have you added style and increased the text size?
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 2:23pm On Jul 12, 2016
yorex2011:
The second method of creating string. i.e using strings.xml is a better practice as it allows for cleaner coding and easy text replacement whenever you want to replace, it is also good when you want your app in anotherllanguage as you can easily just translate everything in ur strings.xml to the new language while maintaining the names of each string.
Also, by using the 2nd method, you can apply style (bold and italic) at different points of a text.

Example:

<string name="title"><b>This text is a bold text</b> while this other <i>text here is italic</i></string>

Bold - <b>text here</b>
Italic - <i>text here</i>

yorex2011 i see you. Thanks for the contribution
BusinessRe: Read by DavidTheGeek(op):
.
BusinessRe: Read by DavidTheGeek(op): 1:54pm On Jul 12, 2016
chocolateme:
Correct book
cheesy I see you o.
BusinessRead by DavidTheGeek(op):
....Typing
PoliticsRe: Dialogue: MEND Gives FG Two Weeks ultimatum by DavidTheGeek: 9:22am On Jul 10, 2016
They are all fighting for themselves.
***
So you want to learn how to build android apps but you don't have a laptop.... Issorite check my profile and join the thread for tutorials on how to develop apps with your android phone. Hurry, class has started already!
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 10:51pm On Jul 09, 2016
folks4luv:
corrected now. the prob was that I didn't modify d \> and >. guess we need to learn what those symbols mean. .
thanks op. now I can go to bed
Good.

/> is a closing tag.
< is an opening tag.
> i'll call this tag "suspension tag"

For better understanding i'll give examples.
<TextView ....... this means you've started writing codes for textview.

When you open a fridge to take water, you should close it when done abi no be so? That's what /> does. It means you've finished writing the code for TextView.

> is used on a Parent to close and accomodate its children. A viewgroup is a parent, while view objects are its children. Example...

<LinearLayout ...... i'm done writing the codes inside here. Close me>
Add children here.
</LinearLayout>
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 10:33pm On Jul 09, 2016
mikky234:
Sweet! This thread is actually ideal for non-computer students that are interested in computer stuffs
You're welcome to the thread. Are you following us or you're just passing by?
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 10:19pm On Jul 09, 2016
deekseen:
Corrected.
Good.
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 10:13pm On Jul 09, 2016
folks4luv:
dunno what I am doing wrong, see my main XML.
color thing not working.

couldn't add image yet. but on the main XML, the codes didn't change to red color after inputting = sign.
That means you wrote a wrong color code. (Most likely you didn't add # before ff0000)

Write "#ff0000" after ="
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 9:48pm On Jul 09, 2016
fweshskaz:
Thumbs up Bro I really love this but I'll love to get your WhatsApp contact because I'm not able to browse the Internet at all times due to the fact that I only have WhatsApp sub for now.
I'll be glad if I can get your WhatsApp contact. Thanks in anticipation
Sorry bro i'll probably drop my number later.

We are continuing here.
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 9:30pm On Jul 09, 2016
folks4luv:
ehaya. n I just wanted to ask for images cause it's a bit hard figuring this out
I've added the screenshots. You can check them now.
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 9:03pm On Jul 09, 2016
folks4luv:
so on point, am in. when are we starting? but we need to keep the thread going so that others coming after will be a partaker, like I just stumbled on this thread this morning.
ASAP.

This tutorial class, though we just started, has started rubbing off on my time & pocket. So i've decided to conclude the tutorial i started here, take a break, do some planning, (thereby giving space for new interested Nairalanders to join and catch up) & proceed in another way.
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op):
I'm having issues attaching image.... My data is exhausted. I'm using Free Basics.

*******

UPDATED..
Image added
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op):
LETS CONTINUE.... Android - User Interface (UI) Controls

User Interface simply means what you see on the screen.

A View is an object that draws something on the screen that the user can interact with and a ViewGroup is an object that holds other View (and ViewGroup) objects in order to define the layout of the user interface.

Layout(s) are defined in an XML file which offers a human-readable structure for the layout

In the main.xml file that was created on aide, ViewGroup is:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
</LinearLayout>

LinearLayout is a view group that aligns all children (view objects eg TextView) in a single direction, vertically or horizontally.

While View object is:
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="I am a TextView" />

TextView is for showing text.

****************************************

There are a number of View objects provided by Android that allow you to build the user interface for your app.
For example: TextView, EditText, Button, ImageView etc.

In this tutorial, we'll be working with TextView & Button.

***************************************

TextView
This control is used to display text to the user.

Button
A button can be pressed, or clicked, to perform an action.

******************

A view object may have a unique ID assigned to it which will identify the View object uniquely within the View Group.
The syntax for an ID, inside an XML tag is − android:id="@+id/text_id". (Bolded in TextView code above)

LETS GET TO WORK...
In this tutorial, we will buid a simple app that shows a Text and a Button. When the button is clicked, a toast message would show on the screen.

EDIT MAIN.XML.... ADD BUTTON
By defult, there's a TextView already, simply add betton code uder... like this...

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">

<TextView
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<Button
android:id="@+id/click_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me" />

</LinearLayout>

Check image below to see how your main.xml file should look now....

Let's add a background color...
Add this android:background="#ffffff" code to in <LinearLayout........

Also lets add color to our text....

Add this android:textColor="#ff0000" code to in <TextView........

Click menu and select Run.
Install app.

App background should be white. Text should be red and a button should be visible now.

Let me know if you got it right, so i'll continue.

PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 7:17pm On Jul 09, 2016
Mrluv:
bro i think here is better cus we can alway come back here if we forget any part
Whatsapp starred message could be used
PhonesRe: Learn How To Develop Android Apps With Your Android Phone by DavidTheGeek(op): 7:13pm On Jul 09, 2016
folks4luv:
if we will get more and faster updates on WhatsApp, then am in, though here is cool for better referencing but WhatsApp is easier.
Whatsapp would be faster since i can explain step by step with an screenshots.

For referencing you guys could use Whatsapp starred message feature.

1 2 3 4 5 6 7 8 ... 26 27 28 29 30 31 32 33 34 (of 34 pages)