// 그래픽 ClientWidth = this.getWidth(); ClientHeight = this.getHeight(); // 일반 // 화면 해상도 private int mClientWidth; private int mClientHeight; // 핸드폰의 해상도 구하기 mClientWidth = this.getWindowManager().getDefaultDisplay().getWidth(); mClientHeight = this.getWindowManager().getDefaultDisplay().getHeight(); Log.e("mClientWidth : ", "" + mClientWidth); Log.e("mClientWidth : ", "" + mClientHeight);
// 서비스가 실행중인 체크하는 함수 private boolean getServiceTaskName() { boolean checked = false; ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); List info; info = am.getRunningServices(30); for(Iterator iterator = info.iterator(); iterator.hasNext();) { RunningServiceInfo runningTaskInfo = (RunningServiceInfo) iterator.next(); if (runningTaskInfo.service.getClassName().equ..
// 리스트 롱 클릭 mPhoneList.setOnItemLongClickListener(new OnItemLongClickListener() { PhoneItem item = new PhoneItem(); @Override public boolean onItemLongClick(AdapterView parent, View view,int position, long id) { item = m_arPhoneList.get(position); new AlertDialog.Builder(PhoneList.this) .setTitle("연락처 편집") //.setIcon(R.drawable.memo) .setItems(new String[] {"수정", "삭제"}, new DialogInterface.OnCli..
// xml
// Manifest // BootStartReceiver.java // 핸드폰 처음 부팅시 서비스를 가동하기 위한 클래스 public class BootStartReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { // 마감 데이터 도착 알림 서비스 가동 Intent serviceIntent = new Intent(); serviceIntent.setAction("pkg.os.MagamAlramService"); context.startService(serviceIntent); } }
// 특정 클래스에서 알람 등록 AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent amIntent; PendingIntent sender; amIntent = new Intent(CloseMain.this, AlarmReceiver.class); sender = PendingIntent.getBroadcast(CloseMain.this, 0, amIntent, 0); am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), 60000, sender); // 1분에 한번씩 호출하게 하였다. Log.e("Alarm Sta..
// Logo.java protected void onNewIntent(Intent intent) { super.onNewIntent(intent); boolean isKill = intent.getBooleanExtra("KILL_ACT", false); if(isKill) close(); } private void close() { finish(); int nSDKVersion = Integer.parseInt(Build.VERSION.SDK); if(nSDKVersion < 8) //2.1이하 { ActivityManager actMng = (ActivityManager)getSystemService(ACTIVITY_SERVICE); actMng.restartPackage(getPackageName..
// res밑에 anim폴더를 만들고 거기에 alpha.xml파일을 생성 한다. // Manifest 액티비티 추가시 // Logo.java public class Logo extends Activity { LinearLayout mLinear; Animation mAni = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.logo); mLinear = (LinearLayout)findViewById(R.id.linearLogo); mAni ..
package pkg.Exec; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class ExecActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); findViewById(R.id.BtnExec).setOnClickListener(mClick); } Button.On..
void sendSMS(String phoneNumber, String message) { // PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, OneQuizActivity.class), 0); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, null, null); }
- Total
- Today
- Yesterday