18
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android用のライブラリを作る

Last updated at Posted at 2014-10-24

そういえばやったことなかったので。

Library Projectを作る

まずいつもと同じように
eclipse->File->New->Project...にてAndroid Application Project
でプロジェクト作成開始。

アイコンもアクティビティもいらないのでCreate custom launcher iconCreate activityのチェックを外す。

Mark this project as a libraryにチェックを入れる。

Screen_Shot_2014-10-25_at_01_08_25.png

Finish

できたProjectのProperties->Androidを見てみるとis Libraryにチェックがついている。

Screen_Shot_2014-10-25_at_01_15_57.png

Libraryの中身開発

適当にクラスを追加する

Sample.java
package com.jollyjoester.samplelibrary.sample;

import android.util.Log;

public class Sample {
	
	public static void sampleMethod(){
	
		Log.d("LibrarySample", "Log from Library");

	}
}

他のプロジェクトから使う

他のAndroid Application ProjectのProperties->AndroidのLibraryにて
上で作ったライブラリをAddする。

Screen_Shot_2014-10-25_at_01_24_21.png

下記みたいな感じで使える

import com.jollyjoester.samplelibrary.sample

	// ・・・

	Sample.sampleMethod();

	// ・・・

以上

18
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?