Android

Javaコード:
MediaPlayer player = new MediaPlayer();
try {
player.setDataSource(WebMusic.this, Uri.parse(R ...

Android

Javaコード:
@Override
public void onAttachedToWindow() {
//TODO Auto-generated method stub
this.getWindo ...

Android

Javaコード:
private PackageManager mPackageManager;
mPackageManager = getPackageManager();
Drawable d = mPac ...

Android

TextView下線を付ける:
mTextView.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG|Paint.ANTI_ALIAS_FLAG);

TextView枠線を ...

Android

Javaコード:
public boolean onTouchEvent(MotionEvent event) {
//touchメソッドを実行
super.onTouchEvent(event);
r ...

Android

サンプルコード:
PowerManager mPowerManager = (PowerManager) getSystemService(POWER_SERVICE);
PowerManager.WakeLock m ...

Android

サンプルコード:
DecimalFormat formater = new DecimalFormat(“#0.##”);
System.out.println(formater.format( ...

Android

Javaコード:
public class ServiceReceiver extends BroadcastReceiver {
public void onReceive(Context context, Inte ...

Android

サンプルコード:
if(searchTask.getStatus() == AsyncTask.Status.RUNNING){
searchTask.cancel(true);
}
searchTas ...

Android

PopupWindowを表示:
public void showPopupWindow(){
Context context = PopupWindowCalendar.this;
LayoutInflater ...

Android

Javaコード:
public static Bitmap drawableToBitmap(Drawable drawable) {
Bitmap bitmap = Bitmap.createBitmap(

Android

1.ファイル構成
res
|values
|settings.xml
|values-large
|settings.xml

2.res/values/settings.xml下記記 ...

Android

Javaコード
public boolean onKeyDown(int keyCode, KeyEvent event) {

//戻るキー
if (keyCode == KeyEvent.KEYCODE_ ...

Android

Javaコード:
@SuppressWarnings(“deprecation”)
public static String IPAnalysis(Context context) {

Android

Javaコード

public static String getVersionNumber(Context context) {
String version = null;
//PackageManage ...

Android

Javaコード:
public class ListScrollView extends ScrollView {
private List list = new ArrayList();
private in ...

Android

サンプルコード:
public class Utility {
public static void setListViewHeightBasedOnChildren(ListView listView) {

Android

AndroidでTextViewを動的に切り替える方法まとめ

例1右方向画像の設定方法
Drawable drawable = getResources().getDrawable(R.drawable.hotel ...