Developing an Android App: MyTwitter Part 1

Posted on Feb 1, 2010 (4 years ago). Seen 33,165 times. 12 comments. Permalink Feed
Member since Dec 23, 2009
Location: Oakland
Stream Posts: 0
Tagged as: Android Tutorial

This is a sample android app that works with a twitter account and allows the user to post twitter account updates. The app will also automatically connect to twitter.com every once in a while to check for new friend statuses, and notify us of us.

The goal of this application is to illustrate all the major pieces of Android application development by implementing them in an actual app.

Project Overview
This is basically all the bits and pieces that we'll build as part of this project.


The application will encompass various android interfaces to make this happen.

Basic functions include the java file MyTwitter.java and auto generated basic AndroidManifest.xml files is the only file that has been changed.

Images files were dropped into the drawable folder- please refer to the source code for content.


MyTwitter.java
Code:

package com.example;

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

public class MyTwitter extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}

AndroidManifest.xml at this stage only references the drawable files that have been dropped in the res/drawable folder. The notable change is the MyTwitter app icon on the desktop on the phone, it references to the new icon - twitter_icon


AndroidManifest.xml
Code:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0" package="com.example">
<application android:icon="@drawable/twitter_icon" android:label="@string/app_name">
<activity android:name=".MyTwitter"
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>
<uses-sdk android:minSdkVersion="3" />

</manifest>

Source
http://thenewcircle.com/static/tutorials/MyTwitter-Part1.zip
http://thenewcircle.com/static/tutorials/twitter_icon.zip

Comments

Posted on Feb 2, 2010
Photo DIA Mamadou
TCHAP
Member since Jan 27, 2010
I think that you've forgot something
This is just a sample hello worldd code !!!
Mamadou
Posted on Feb 2, 2010
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
Like the name suggests, this is just Part 1 of 5-part example to building a simple Twitter app for Android. Stay tuned for more...
Posted on Feb 2, 2010
Photo DIA Mamadou
TCHAP
Member since Jan 27, 2010
ooh yea,
sorry

Merci
Posted on Feb 8, 2010
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
I just posted the graph of the entire app. I hope this helps explain the development we're undertaking and how pieces fit together.
Posted on Feb 10, 2010
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
Another diagram of this project, courtesy of Robin John, participant in Android Bootcamp:
http://thenewcircle.com/static/tutorials/MyTwitterArchDesign.pdf
Posted on Sep 24, 2010
Photo Leo Filus
Particular
Member since Sep 24, 2010
Maybe you can help-me about twitter, I think that API was changed and the methods of twitter are no longer working the same form. I just want to login with username and password and send
some message. Could you help me with this in the new API?

Thank's
Posted on Sep 24, 2010
Photo Marko Gargenta
@MarkoGargenta
Member since Jan 19, 2007
Location: San Francisco
So, Twitter.com no longer accepts basic authentication (username/password). For purposes of this tutorial, it is not strictly important to use Twitter.com, so we have moved to another Twitter-like service called Identi.ca. Identi.ca implements the exact same API, so your code will work the same. All you have to do is add one line change, as outlined here:

Code:

twitter = new Twitter(username, password);
twitter.setAPIRootUrl("http://identi.ca/api");


And everything else should work the same.
Posted on Sep 24, 2010
Photo Leo Filus
Particular
Member since Sep 24, 2010
Thank's again!

But the application I really need to develop integration of Twitter. I had facebook and works differently, and this new Twitter API works like facebook. So I'm trying to adapt!

greetings!
Posted on May 17, 2011
Photo Marcio Valenzuela
Santiapps
Member since May 16, 2011
I'd like to know how to modify this app for the new twitter login oauth.
Posted on Feb 10, 2013
Photo Manju Krishna
Programmer
mPortal
Member since Dec 13, 2012
But Marko How do you Post Updates to ideti.ca site .Using a jTwitter Api give and error as "You must validate your Email Address before you Post updated" in the Log cat.
Posted on Aug 7, 2013
Photo Shramik Kumar
VentureHire
Member since Aug 7, 2013
Location: Bangalore
Thanks for sharing Marko.
But I have one doubt that how we can use Twitter login for any app. i.e Before running any app it will ask for Twitter login.

Is it possible. I am able to do with Facebook but not with Twitter.

Shramik
VentureHire
Posted on Aug 31, 2013
Photo Shramik Kumar
VentureHire
Member since Aug 7, 2013
Location: Bangalore
hi