Teewa Application Design
Step 1: Setup and Overview of Teewa Application
The first step for the development of the Teewa application is the setup and overview of the application. The code for the initial design of the application is as follows –
<activity android:label=”@string/Teewa” android:launchMode=”singleInstance” android:name=”.Teewa” >
<intent-filter >
<action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
<intent-filter >
<action android:name=”android.intent.action.VIEW” />
<category android:name=”android.intent.category.DEFAULT” />
<category android:name=”android.intent.category.BROWSABLE” />
<data android:scheme=”Teewa-android” />
</intent-filter>
</activity>
Step 2: Development of User Interface
The next stage for the development of the Teewa Application is the development of the user interface. The initial responsibility of the user is to register them on the application. The application needs to grant permission to the user to register in the application. The code for this is –
public class TeewaActivity extends Activity implements Registration
import android.app.Activity;
import android.os.Bundle;
import android.view.View.Registration
The Registration activity is helpful for the users to sign in into the application. The users then need to login in the application with proper credentials. The coding for the login screen in the application is as follows –
private Teewa firstTweet;
private RequestToken niceRequestToken;
private SharedPreferences nicePrefs;
private String LOG_TAG = “TeewaActivity”;
The code describes the interface design for the login screen of the Teewa application. The login activity with the proper credentials directs the user to their account whereas the last line of the code warns the user about inappropriate entry in the login credentials.
Step 3: Add Users in the Database
The next activity is the addition of the users in the database. The first and foremost criterion for the activity is the development of a database system for the application. The code for the development of database application for Teewa is as follows –
public class DataHelp extends SQLiteOpenHelper
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.BaseColumns;
import android.util.Log;
The above imports provide opportunities for the users to develop the basic database architecture and error logging process.
The database for the Teewa application is proposed to contain several features like addition of users in the database, listing of the users in that particular database, follow and unfollow of a user base by the registered user in the profile. The database also provides information regarding the status ID of the posts, texts of the posts, name of the user, time of the posts and the URL of the posts.
The developer needs to develop the constants in the database class which can help to make future developments for the application. The code for the database class is as follows –
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = “homepage.db”;
private static final String HOMEPAGE_COL = BaseColumns.ID;
private static final String UPDATE_COL = “update_post”;
private static final String USER_COL = “user_screenname”;
private static final String TIME_COL = “post_time”;
private static final String USER_LINK = “user_postlink”;
The next criteria for the development of string table for the homepage. The code for the activity is as follows –
private static final String DATABASE_CREATE = “CREATE TABLE home (” + HOMEPAGE_COL + ” INTEGER NOT NULL PRIMARY KEY, ” + UPDATE_COL + ” TEXT, ” + USER_COL + ” TEXT, ” + TIME_COL + ” INTEGER, ” + USER_LINK + ” TEXT);”;
Step 4: Class Design for Teewa Application
The class files needs to develop proper design for effective running of the application and user activities. The inclusion of the import activities is crucial for this purpose which makes the smooth completion of the user activities and posts in the application. The coding for the import of Application Library is as follows –
import Teewa.Status;
import Teewa.Tweet;
import Teewa.ApplicationFactory;
import Teewa.conf.Configuration;
import Teewa.conf.ConfigurationBuilder;
The coding for the import of the Android sources is as follows –
import android.app.Service;
import android.content.ContentValues;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
The import of the variables of the application library and android resources are crucial for the development of the operations of the application and the user activities. The application developer needs to include runnable class in the application to view the posts, navigate the profile, identify the timestamp and open the application in offline mode.
class TimelineUpdater implements Runnable {
Rel_TimeStamp = “9m”, “5h”
}
public void run() {
}
boolean statusChanges = false;
try {
}
catch (Exception te) { Log.e(LOG_TAG, “Exception: ” + te); }
List<Post> homeTimeline = timelineTeewa.getHomeTimeline();
for (Status postUpdate : homeTimeline)
{
ContentValues timelineValues = NiceDataHelper.getValues(statusUpdate);
niceDB.insertOrThrow(“home”, null, timelineValues);
statusChanges = true;
}
The process helps the users to smoothly navigate through the profiles and add posts in their timeline. It is also helpful for the users to identify the posts and see the update of the followed users. The users can keep a track of the characters with the help of this and post the messages or status updates in the application.
Step 5: Initiation of the Runnable Object
The next major step of the development of the Teewa Application is the initiation of the runnable objects. The code for the runnable objects is helpful to keep a track of the user activities on the application. The code for the initiation of the runnable objects is mentioned below –
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStart(intent, startId);
niceHandler = new Handler();
niceUpdater = new TimelineUpdater();
niceHandler.post(niceUpdater);
return START_STICKY;
}
The process executes the runnable method of the operations which allows the users to easily perform the operations without any issues.
The implementation of the service class is also important to provide the facilities for the operations in offline mode. The code for the service class in the Teewa application is as follows –
public void onDestroy() {
super.onDestroy();
PostHandler.removeCallbacks(PostUpdater);
HomeDB.close();
}