Android - 2.1


Extension ID

com.castsoftware.android

What’s new?

See Release Notes.

Description

This extension provides support for Android technologies. This extension works together with the com.castsoftware.jeeexternal link and the com.castsoftware.kotlinexternal link extension. If your JEE or Kotlin application source code uses Android technologies you should install this extension.

Features

AndroidManifest file

This file will be analyzed to understand whether the application is indeed an Android application. Some objects (exposed service/activity/receiver) are created under the manifest to represent exposed services. Then links are created from these services to the methods which are listeners of these services.

Android Event handling support from XML file

  • onClickListener()
  • onLongClickListener()
  • onFocusChangeListener()
  • onKeyListener()
  • onTouchListener()
  • onCreateContextMenu()

Android Event handling support from setEventListenner and addEventListener in widgets

The lambda function can be used to define the event handler. Sample:

Button.setOnClickListenner(
    new View.OncLickListentHandler{...}),
    with lamda function: Button.setOnClickListenner( (v)  {}
    )

Android Type XML support

  • Widget Layout
  • AndroidManifest file

WebServices support

Support for third-party WebServices is provided:

  • httpClient library with namespace cz.msebera.android.httpclient.
  • httpClient library with namespace org.apache.http.client.HttpClient.
  • httpUrlConnection from java.net.URL and java.net.HttpURLConnection.
  • Create webservice via AsyncTask class of Android.
  • Transaction between client and server on fullstack project.
  • Transaction between event handler widget and http method call.
  • Android Volley Http library (https://github.com/google/volleyexternal link) (Java support).

Persistence support

Support for third-party Database access is provided:

End to End transactions

  • End to End transactions are resolved:
    • Entry point: layout ui xml file, exposed services
    • End point: web service, persisting data, intent resource calls

Supported Android versions

Version Supported
4.4 - 15.0

Technology support

Technology Supported
Java
Kotlin

Supported libraries

android.database.sqlite (since 2.1.11-funcrel)

import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DbHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "Score_Table";

    public Cursor getInformation(SQLiteDatabase db){
        cursor = db.query(SCORE_TABLE_NAME,projections,null,null,null,null,orderBy,limit); // the nulls have to do with where clause info
        db.insert(SCORE_TABLE_NAME, null , contentValues);
    }
}

img.png

androidx.room (since 2.1.11-funcrel)

package com.example.android.roomwordssample;

import androidx.room.Entity;

@Entity(tableName = "word_table")
public class Word {

    @PrimaryKey
    @NonNull
    @ColumnInfo(name = "word")
    private String mWord;

    public Word(@NonNull String word) {
        this.mWord = word;
    }

    @NonNull
    public String getWord() {
        return this.mWord;
    }
}
package com.example.android.roomwordssample;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

@Dao
public interface WordDao {
    @Query("SELECT * FROM word_table ORDER BY word ASC")
    LiveData<List<Word>> getAlphabetizedWords();

    @Insert(onConflict = OnConflictStrategy.IGNORE)
    void insert(Word word);
}

img.png

img.png

android.app.Application and com.ad4screen.sdk.A4SApplication for java and kotlin

“onCreate” and “onApplicationCreate” methods are now called from the android application object.

Function Point, Quality and Sizing support

  • Function Points (transactions): A green tick indicates that OMG Function Point counting and Transaction Risk Index are supported.
  • Quality and Sizing: A green tick indicates that CAST can measure size and that a minimum set of Quality Rules exist.
Function Points (transactions) Quality and Sizing

Compatibility

Core release Operating System Supported
8.4.x Microsoft Windows / Linux
8.3.x Microsoft Windows

Dependencies with other extensions

Some CAST extensions require the presence of other CAST extensions in order to function correctly. The Android extension requires that the following other CAST extensions are also installed:

Download and installation instructions

The extension will be automatically installed by CAST Imaging Console.

Source code discovery

The Android extension does not contain any discoverers or extractors, therefore, no “Android” specific projects will be detected. Your Android source code should be part of a larger Java/JEE related project which you are also analyzing, and as such, JEE Analysis Units and/or Kotlin Analysis Units will be created automatically - simply ensure that the Analysis Units will be created automatically - simply ensure that the path to your Android source code is included in these JEE/Kotlin Analysis Units:

What results can you expect?

Android application

Transactions

Web services linker

Function points

Objects

Icon Description
Android EditText, Android TextView
Android Button, CheckBox, Item
Android EventHandler
Android Get Resource Service
Android Put Resource Service
Android Post Resource Service
Android Delete Resource Service
Android Shared preferences, Android internal storage, Android external storage
Android Application
Android UI XML File
Android exposed service, Android exposed activity
Android exposed receiver
Android intent resource
Android Room Entity
Android Room Entity Operation
Android SQL Query

Structural Rules

The following structural rules are provided:

Known limitations

  • CAST recommends using the most recent stable release of CAST Imaging Core with the extension for best results.
  • Some links won’t be resolved because of missing jar file.
  • There are some limitations for transactions with Lamda Expressions.
  • Web Service URI name isn’t stable for more complex situations.