₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,979 members, 8,424,390 topics. Date: Thursday, 11 June 2026 at 07:18 AM

Toggle theme

Blacksta's Posts

Nairaland ForumBlacksta's ProfileBlacksta's Posts

1 2 3 4 5 6 7 8 ... 54 55 56 57 58 59 60 61 62 (of 334 pages)

ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 9:45pm On Jun 06, 2011
Making some adjustment to the main.xml - Our Twitter App is taking shape



<?xml version="1.0" encoding="utf-8"?>

<!-- Main Layout of Status Activity -->

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

<!-- Title TextView -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:gravity="center"
android:textSize="30sp" android:layout_margin="10dp"
android:text="@string/titleStatus"/>

<!-- Status EditText -->
<EditText android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_weight="1"
android:hint="@string/hintText" android:id="@+id/editText"
android:gravity="top|center_horizontal"></EditText>

<!-- Update Button -->
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/buttonUpdate"
android:textSize="20sp" android:id="@+id/buttonUpdate"></Button>

</LinearLayout>

ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 8:52pm On Jun 06, 2011
By default eclipse created a file called main.xml - ( it is under res/layout folder)

Our twitter like App we have the following

1 a title at the top of the screen

2. a big text area to type our 140 characters

3. a button to click update status

4 a layout to contain all the widgets
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 8:16pm On Jun 06, 2011
Tip  - 1

Android organizes its UI elements into Layout and views. eg buttons, labels or textbox is a view  while LAYOUTS organise views. for example grouping together a button and label.

Layouts

1. LinearLayout
2.TableLayout
3FrameLayout
4 Releative and absolute layouts


Moving on - To create our twitter like Application   - open up eclipse IDE

cLICK file  - New - Project - Android  - you should see the below

once you have entered the necessary - click finish

PoliticsRe: Fg Wasted N675bn On Ajaokuta In 30 Years – Probe Panel by blacksta(m): 1:53pm On Jun 05, 2011
@styles

Please move away from conspiracy theories - Are you aware that their steel companies in South Africa - According to ideology No steel companies will be allowed to prosper in Africa. The Nigerian problem is simply down to Greed and Mismanagement - simple as abc
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 9:48am On Jun 05, 2011
The best way to learn is by Example -   We going to build a NL twitter-Like application.

first task " the Status Update screen" The task involves building an ACTIVITY , networking and Multithreading and debugging.

2 ways to create an inteface.

1. Declarative User interface -

Using XML to declare what the UI will look like similar to HTML

2. Programmatic User Interface

Using java code to develop UI - very similar to Java AWT or Java Swing

for the sake of our app creation - the two ways will be used.
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 9:34am On Jun 05, 2011
Broadcast Receivers This reciever is simpy dormant code that get activated once an event to which it is subscribed happes

Example

SMS arrives or A Call comes in

Application Context refers to the application environment and the process within which all components are running.

In short Activities, Services, Content Providers and broadcast receivers together make up an application
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 9:14am On Jun 05, 2011
More of Android Building Blocks


Intents   These are messages sent among the major blocks - e,g  they trigger an activity to start up or tell a service to start or stop.  Intents are asynchronous. 

Example

1. Launch Gmail app - select mail

2 with mail displayed  - you click on the http link

3 http link launches web browser

4  Within browser  - you click on youtube link which launches Youtupe App



Services

Services run in the background and dont have any UI and can perfom same actions as activities .

Example

Listening to music in the background while main activity o screen is browsing the web

Content Providers

are interfaces for sharing data between application.

Example

All your media ( pictures , music, ringtones ) are stored in a central location - is made available to apps  rather than  music player app having it own database. it simply taps into the central location.
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 9:01am On Jun 05, 2011
Main Building Blocks of Android

Thesse are components that you can use as an application developer to build android apps

Your design process (top down approach ) Screens  ---   Features  and the interactions btw them

ACTIVITies

An activity is usually a single screen that users sees on the device at one time.

Activity Life Cycle

activities may involve creating a linux process, allocating memory, setting up the whole screen and mamy more.  To effectivitely manager all these process  the activity life is managed by the Activity Manger.

Activity Manager is responsible for creating, destroying and managing activites

PoliticsRe: GEJ To Visit OBAMA At The White House On 8th June 2011 by blacksta(m): 8:08am On Jun 05, 2011
thread ruined by Musiwa - na wa oooo - i am very sure Seun is tired of this chap shocked
PoliticsRe: GEJ Achievement Tracker - 2010 - Till 2015 by blacksta(op): 10:57am On Jun 04, 2011
karl max:
Jonathan Issues Marching Order to Cement Producers                                       - May 17 2011                                               
                                         
   
       cement now 1700 per bag from 2400 and still going down


Signed freedom of information bill

I wonder why the op who is a hater has not updated his post!!!
Lies - We still bought cement last week for N2300 In Lagos
PoliticsRe: GEJ Achievement Tracker - 2010 - Till 2015 by blacksta(op): 10:48am On Jun 04, 2011
karl max:
Jonathan Issues Marching Order to Cement Producers                                       - May 17 2011                                               
                                         
   
       cement now 1700 per bag from 2400 and still going down


Signed freedom of information bill

I wonder why the op who is a hater has not updated his post!!!
lol - I am not hater - I am watching and confirming events - Another update due on Monday 7th
PoliticsRe: Bankole Sheds Tears, Regrets Being Speaker by blacksta(m): 6:36am On Jun 04, 2011
Upon all the money stolen . I guess a thief is forever a thief - The guy dey even steal parliament computers
PoliticsRe: Bankole Sheds Tears, Regrets Being Speaker by blacksta(m): 6:32am On Jun 04, 2011
zstranger:
Nevertheless, still the best speaker we've ever had, and maybe the best we will ever have.


Long live Bankole!
Are u sure -
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 3:40pm On Jun 03, 2011
zeeleso:
Now we r talking.
Quick question ,how do i test it on my physical android device?
http://developer.android.com/guide/developing/device.html
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 3:35pm On Jun 03, 2011
Can you spot the Nairaland App

ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 3:06pm On Jun 03, 2011
Run the Emulator on pc- it mimics the actual device  - for example HTC desire.

to use the emulator  - we have to create an Android Virtual device . via Eclipse


1. Start the tool called Android SDK and AVD Manger

2. window pops open  - select New

Name - myAndroidPhone

target -  Android 2.2 API level 8


3. click on Create AVD

4. Select the newly created emulator and select  START


With Emulator running  -  run the HelloWorld java application

ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 2:41pm On Jun 03, 2011
-  

The above process should automatically generate a number of files

1. MANIFEST FILE

This file glues everything together  - it is this file that explain what the application consisit of , what all the its main building block and persmissions it reques


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="nl.com"
     android:versionCode="1"
     android:versionName="1.0">
   <uses-sdk android:minSdkVersion="8" />

   <application android:icon="@drawable/icon" android:label="@string/app_name">
       <activity android:name=".nl"
                 android:label="@string/app_name">
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>

   </application>
</manifest>



2. LAYOUT XML Code -  The layout file specifies the layout of your screen


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   >
<TextView  
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:text="@string/hello"
   />
</LinearLayout>


3. STRINGS --  This is another file that contains all the text that our application uses - for example  buttons, labels, default text


<?xml version="1.0" encoding="utf-8"?>
<resources>
   <string name="hello">Hello World, Welcome to Nairaland Android Tutorial!</string>
   <string name="app_name">Hello World - NairaLand Tutorial</string>
</resources>

4. R FILE  - this file is join btw the java world and Android world of resources  ( Never Never modify)

/* AUTO-GENERATED FILE.  DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found.  It
* should not be modified by hand.
*/

package nl.com;

public final class R {
   public static final class attr {
   }
   public static final class drawable {
       public static final int icon=0x7f020000;
   }
   public static final class layout {
       public static final int main=0x7f030000;
   }
   public static final class string {
       public static final int app_name=0x7f040001;
       public static final int hello=0x7f040000;
   }
}



5. Java Source Code -  this one drive everything  - this code get converted to a DALVIK executable and runs the application

package nl.com;

import android.app.Activity;
import android.os.Bundle;

public class nl extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
   }
}
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 2:14pm On Jun 03, 2011
Fayimora:
Just want to state this again, You must be at least an INTERMEDIATE(understand fully the OOP concepts) in Java and you MUST also have a general understanding on XML. PLease don't even bother partaking in this tuts if you don't have these qualities I just mentioned. Am not trying to be rude or bossy but the face is the purpose here should be android development and not java or xml. So in essence asking things like what is an object or how to you write a loop(Java) or what is an attribute, a child element(XML) would not be part of this. It is assumed that you already know these.

The person teaching you (Blacksta) is oing a good job. As far as am concerned he has even done too much. I would only be following up to make sure the pace is kept. Sometimes because you are good at something you forget that you are teaching beginners and skip somethings. I would just follow up such issues.

I wish y'all happy learning!!!
Thank you sir - Your inputs have been have also been very valuable




Lesson 3.0 - Write my first HelloWorld

to make sure your environment is correctly set up

try out the following

1. Start Eclipse - Choose file - New -Android Project

Project Name - HelloWorld

in the build target - select the Android device (emulator) - I chose " Android 2.2"

Application name - HelloWorld!!!

Package Name- NL.com

Activity - Optional

Mini SDK version - Is the minimum version of Android as represented by APi Level - I am Using " 8"

and click finish
Christianity EtcRe: Exclusive Pictures Of Bishop David Oyedepo In His 4.2 Billion Naira Private Jet. by blacksta(m): 11:49am On Jun 03, 2011
What about Nigerian pilots - why oyinbo's talk about killing the local economy - abi MOG dey fear

anyway no proof that the first two pictures are linked to the last one
TravelRe: How Good Is Arik Airline? by blacksta(m): 9:22am On Jun 03, 2011
sconsults:
Wetin bros,which nija airline de use airbus a380. grin grin grin cool
lol - sorry meant the Airbus A340-542 aircraft
PoliticsRe: Nigeria’s Privatisation Delusion by blacksta(op): 9:17am On Jun 03, 2011
I am guess it is a know fact - No matter how they try - The Nigerian government cannot run business.
PoliticsNigeria’s Privatisation Delusion by blacksta(op): 9:15am On Jun 03, 2011
IT is the height of insanity to do the same thing over and over and expect a different result; right? That’s true only if you’re not in Nigeria. VANGUARD newspaper of Friday, May 27th, 2011, carried a report that the FGN through, the Attorney General, has asked the IG Police, to arrest the Anosike brothers, Fidelis and Noel, “over their alleged roles in the illegal purchase of The Daily Times of Nigeria assets, estimated at N3billion”.

Furthermore, the brothers, according to the charge against them in the Lagos High Court, made “false representation to the Bureau of Public Enterprises, BPE, that they had means to acquire majority shares of Daily Times of Nigeria, but instead of raising the said money, they were said to have mortgaged the assets of the newspaper conglomerate and also sold some of the property to realise the acquisition of the said shares”.

So devoid of legalese, the assets of the company were stripped and in the madness of the “religion” of privatising the public space in Nigeria, a national institution like Daily Times was destroyed and lost forever.

The privatisation delusion
It is very interesting that the story of the Anosikes and their mal-treatment of Daily Times broke almost at the same time as the confession by Vice President, Namadi Sambo that 80 percent of government companies privatised have failed. I have never supported the privatisation of national assets, because the delusion that the private sector works better than the public space is just that, a delusion; at least in Nigeria.

Privatisation has fostered the worst manifestation of crony capitalism, when choice national assets were sold to cronies of the ruling elite, as we have seen from the mid-1980s, but most especially under the regime of the old despot, Olusegun Obasanjo. Privatisation has been a ‘religion’ of sorts, here since the mid-1980s and its failure ought to have given the Nigerian state the pause. But adherence to the diktats of the Washington Consensus became the ruling orthodoxy in Nigerian bourgeois circles, since Babangida introduced SAP in the mid-80s; followed by the deepened adherence to the policies under Obasanjo.

Between 2002 and 2005, I worked as Editor of DAILY TRUST newspaper. We followed with interest two of the programmes of privatisation of the Obasanjo regime: those of the Ajaokuta Steel Company and NITEL. Ajaokuta, as planned, was to be bedrock of Nigeria’s industrial take off. Billions of dollars went into its construction, including a programme of training of Nigerian engineers and technicians around the world, but especially in the former Soviet Union and India.

The imperialist institutions of the IMF and World Bank were opposed to a Nigerian steel industry, arguing that it would not be economical. But the underlining effort was to defend the steel exports of Western countries. While Nigeria did not run the complex as best as it should and one should criticise that; it was nevertheless a gigantic undertaking that we were beginning to master. The steel complex was envisaged to become the largest employer of labour in Nigeria; while its location in Northern Nigeria made it particularly dear to our people.

Well, Obasanjo was determined to sell off Nigeria, no matter what! He chose to sell Ajaokuta using a certain SOLGAS company, headed by a 36 year old Seun Oyefeso. They did not possess the requisite expertise and were locked in perpetual battles with the iron and steel workers union. Not surprisingly, the group began to strip assets of Ajaokuta steel company. It became such a scandal that then SGF, Ekaette issued a query to the group.

I[b]t became clear that Nigeria’s industrial vision was deliberately being blinded forever. An unrepentant Obasanjo sacked the SOLGAS guys and then moved to an Indian group. The nut and bolt of our story is that Ajaokuta’s original patriotic effort as a state-led project for national industrialisation was aborted, while adherence to Washington Consensus-inspired privatisation has stripped assets; led to de-industrialisation and has not given Nigeria the capitalist development they have always touted.[/b]

The NITEL scam
The second is the painful scamming of NITEL! Just before Obasanjo’s assumption of power in 1999, a ‘terribly corrupt’ NITEL at least, paid dividend in billions of naira to the Nigerian government. But Obasanjo was beholden to the ‘demons’ of Washington and the simplistic mantra that everything must be privatised. The first group that came calling was IIL (London) Ltd.; they could not purchase the company. Then Nasir El-Rufai brought in PENTASCOPE from the Netherlands.

The controversial body was said to have its HQ in an abandoned church. Amazingly, PENTASCOPE was given a carte blanche to spend the monies of NITEL, and they cleared its offshore foreign currency savings. A company that was actually a national strategic institution has not recovered from PENTASCOPE; or from TRANSCORP and other efforts to sell BY FORCE! In the meantime, Nigeria became a country where telephone landlines disappeared from homes and offices, just as the assets of NITEL that have not been stolen, have continued to rot, as our empty-headed ruling elite cling to the litanies of the church of privatisation, as their route to the heaven of capitalist development!

Writing about the near-religious fervor for neoliberal capitalism, Tariq Ali, the Pakistani/British writer, said in the book Pirates of the Carribean:Axis of Hope (2008), “The new faith is, as we know, an old one. Capitalism has existed for five hundred years….WC (Washington Consensus) supporters became semi-religious in their devotions. What they supported became immutable and infallible; all problems would cease once the entire world had been properly converted. All heresies needed to be expelled from it so that it became self-consistent.

Any challenge to this view was to be ruled out of court. And yet if one looks deeply into the minds of the new converts all that can be seen is an empty space with borrowed furniture”. This is an apt description of the Nigerian variety of this near-religious madness. During Obasanjo’s years, reactionary elements running the nation’s economic life, from Charles Soludo, Oby Ezekwesili through to Nasir El-Rufai huffed and puffed as disciples of the Washington orthodoxy; but Nigeria has been the worst for it.

More of the same
The crisis of the past few years exploded the myth of Francis Fukuyama’s “End of History”. Neoliberal capitalism was exposed as a monumental fraud, especially in Latin America. But in a classical neo-colony like Nigeria, run by the worst specimens of unthinking political elite, they regularly promise us MORE OF THE SAME, even when it does not work.

Official statistics speak of 44million unemployed young people and these are under the age of 30. The state will not create jobs hoping the parasitic bourgeoisie will; this survives on an economics of import waivers and buccaneering. It is delusion sans frontieres! The Nigerian privatisation process is the worst form of pseudo-religious delusion afflicting the elite. The much-touted economic turnaround has not worked and is not likely to. Does anyone recognise insanity when he/she sees it?

http://www.vanguardngr.com/2011/06/nigerias-privatisation-delusion/
PoliticsRe: Jumbo Pay: Incoming Lawmakers To Earn N338.6 Billion ($2.5 Billion) by blacksta(m): 4:39am On Jun 03, 2011
I Laugh

You better chop your own when you get there . It is all part of the fresh Air 2011 initiative .

If na me be Rep and Senator . I go collect am gladly and at the same time do my Job. grin
TravelRe: How Good Is Arik Airline? by blacksta(m): 4:07am On Jun 03, 2011
Flew them twice in 2010 on their international route - I must confess everything went fine. The Lagos to London Plane is the A380 a new plane , very spacious , food and in flight entertainment was ok , cant complain really. Maybe it is a case of Hit and Miss.
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 4:58pm On Jun 02, 2011
Fayimora:
I'd prefer you restart your system.Dalvik sometimes doesn't initialize until the system is restarted,  Its optional tho. If restarting eclipse works fine then no need restarting the system
Like you have been reading my mind  - that Dalvik almost drove me crazy this afternoon  but finally sorted out  grin


Lesson 3.0 - Fun Part start tomorrow - or later after i chop Eba -
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 2:48pm On Jun 02, 2011
zeeleso:
Lovely thread, but, ermm lets get moving. Where are the actual codes? we want more lessons.
LOL - nA WA ooo - Everybody wants to see code - This is not fast track course to Android Development - it is a Marathon

if u see code what next? grin
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 2:45pm On Jun 02, 2011
grin
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 1:17pm On Jun 02, 2011
Installing Android SDK

The android software development (sdk) is all we need to develop applications for android. it comes with tools as well as platforn to run and see it all work.

Download here  -  http://developer.android.com/sdk/index.html  

Steps

1. Download the sdk and unzip to location a location  ( c:\Andrioid)
2. setup a path to the tools
3. Install Eclipse  - http://eclispe.org  ( i recommend Eclipse IDE for Java Developers)


Setting Up Android Development Tools

You also need to set up Android Tools for Eclipse. The instructions are:


1. Start Eclipse, then select Help→Install New Software (see Figure 3-1).
2. In the Available Software dialog, click Add.
3. In the Add Site dialog that appears, enter a name for the remote site (for example,
“Android Plugin”) in the “Name” field.
4. In the “Location” field, enter this URL: https://dl-ssl.google.com/android/
eclipse/.
5. Click OK.
6. Back in the Available Software view, you should now see “Developer Tools” added
to the list. Select the checkbox next to Developer Tools, which will automatically
select the nested tools Android DDMS and Android Development Tools. Click
Next.
7. In the resulting Install Details dialog, the Android DDMS and Android Development
Tools features are listed. Click Next to read and accept the license agreement
and install any dependencies, then click Finish.
8. Restart Eclipse.

http://developer.android.com/sdk/eclipse-adt.html
PoliticsRe: Acn Will Not Turn Down Ministerial Offer From Gej by blacksta(m): 12:23pm On Jun 02, 2011
Why do people like flogging a dead horse.

After meeting yesterday with GEJ- The spokes person for ACN cant remember his name clearly stated to the press that ACN was not interested in any ministerial positions - It is was on TV yesterday. Even Tinubu confirmed it himself. So i cant understand who writes these articles
TravelRe: Epassport Drama - Uk Embassy by blacksta(op): 12:14pm On Jun 02, 2011
;d
ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 12:11pm On Jun 02, 2011
Andriod and Java.

In java you write your source code and compile it into a java code using the java complier. In android things are different , you still write the java source file and compile it to java byte code using the same java compliter but at that point , you recompile it once again using the dalvik complier to Dalvik byte code. It is dalvik byte code that is then executed on the dalvik VM

ProgrammingRe: Beginners - Learn Android Programming by blacksta(op): 12:03pm On Jun 02, 2011
Lesson 2.0

Android OS is like a cake consisting of various layers. Each layer has it own characteristics.

Android is built on top of linux. Linux is great because of it portability , security and features


Application Framework - rich environment that provides numeorus services to help you the developer get the job done. You will also find numerous java libraries built for android. You will also find many services that allows your application to tap into the phone's Senors , WIFI , GPS and so on

1 2 3 4 5 6 7 8 ... 54 55 56 57 58 59 60 61 62 (of 334 pages)