package com.example.textpaint; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.TextView; public class MainActivity extends Activity { private TextView mPaintText; private Paint textPaint, strokePaint, textPaint2, strokePaint2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.activity_main); initPaint(); setContentView(new MyView(getApplicationContext())); } private void initPaint() { int textSize = 100; textPaint = new Paint(); textPaint.setAntiAlias(true); textPaint.setColor(Color.WHITE); textPaint.setTextSize(textSize); strokePaint = new Paint(); strokePaint.setAntiAlias(true); strokePaint.setTextSize(textSize); strokePaint.setColor(Color.BLACK); strokePaint.setStyle(Paint.Style.STROKE); strokePaint.setStrokeWidth(4); int textSize2 = 50; textPaint2 = new Paint(); textPaint2.setAntiAlias(true); textPaint2.setColor(Color.BLUE); textPaint2.setTextSize(textSize2); strokePaint2 = new Paint(); strokePaint2.setAntiAlias(true); strokePaint2.setTextSize(textSize2); strokePaint2.setColor(Color.BLACK); strokePaint2.setStyle(Paint.Style.STROKE); strokePaint2.setStrokeWidth(4); } class MyView extends View{ public MyView(Context context) { super(context); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); String text = "48.2"; canvas.drawText(text, 100, 100, strokePaint); canvas.drawText(text, 100, 100, textPaint); String text2 = "%"; canvas.drawText(text2, 320, 100, strokePaint2); canvas.drawText(text2, 320, 100, textPaint2); // canvas.drawText(text, x, y, strokePaint); // canvas.drawText(text, x, y, textPaint); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } }
'분류 전체보기'에 해당되는 글 86건
- 2013.02.21 안드로이드 text 그리기 text 라인
- 2013.01.17 자바 Exception을 String로 출력(e.printStackTrace() 결과를 String 객체로 변환하기)
- 2012.10.27 루트익스플로러, 슈퍼원클릭, 슈퍼유저 (rootexplorer, superoneclick, superuser) apk
- 2011.10.05 textmate 시리얼
- 2011.06.28 안드로이드 에러 정리
- 2011.06.27 안드로이드 다른 어플 실행(갤럭시s 거울 실행)
- 2011.06.05 안드로이드 sdcard에 디렉터리 생성
- 2011.05.19 안드로이드 manifest에 사용되는 Receiver 1
/**
* e.printStackTrace(); 실행결과를 System.out 객체가 아닌 String 객체에 저장하여 반환
* @param e 예외클래스 객체
* @return
*/
public String printStackTraceToString(Throwable e) {
StringBuffer sb = new StringBuffer();
try {
sb.append(e.toString());
sb.append("\n");
StackTraceElement element[] = e.getStackTrace();
for (int idx = 0; idx < element.length; idx++) {
sb.append("\tat ");
sb.append(element[idx].toString());
sb.append("\n");
}
} catch (Exception ex) {
return e.toString();
}
return sb.toString();
}
[출처]http://blog.naver.com/ddak2ya/30151431652
s/n: change 98 8*****************************************************************************90 eb 15 c6 85 18
s/n: change 98 89 14 24 e8 5f d5 10 00 31 c0 eb 15 c6 85 18 to 98 89 14 24 e8 5f d5 10 00 40 90 eb 15 c6 85 18
manifest.xml에 동일한<activity>가 두개 이상 있을때 발생하는 에러
06-28 13:34:25.644: ERROR/Launcher(10360): Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=mrsohn.CTSave/.CTMainActivity }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity.
안드로이드 프로젝트 빌드중에 에러가 발생할수 있다.
해당경우는 manifest.xml에 등록된 <receiver>로 등록된 클래스의 경로가 올바르지 못할때 발생한다
경로를 잘 잡아주도록 한다
06-29 11:08:45.824: ERROR/AndroidRuntime(1898): /system/csc/customer.xml ==> cannot open file
06-29 11:08:45.824: ERROR/AndroidRuntime(1898): /system/csc/feature.xml ==> cannot open file
06-29 11:08:46.059: WARN/ActivityManager(252): No content provider found for:
06-29 11:08:46.078: WARN/ActivityManager(252): No content provider found for:
06-29 11:08:46.086: WARN/PackageParser(252): /data/app/vmdl1081128854.tmp (at Binary XML file line #29): <receiver> does not have valid android:name
package com.Mirror; import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class Mirror extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /** * 갤럭시s 거울실행 */ Intent intent = new Intent(); //intent.setClassName("패키지명", "실행할 클래스명"); intent.setClassName("com.sec.android.widgetapp.mirror", "com.sec.android.widgetapp.mirror.Mirror"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); // 기존 빈 화면의 activity가 남아 있으므로, 다른 클래스를 실행 하는 동시에 activity종료 finish(); } @Override public void onBackPressed() { // TODO Auto-generated method stub super.onBackPressed(); finish(); } }
File path = new File("/sdcard/voice"); if(!
path.isDirectory()) { path.mkdirs();
}
<receiver android:name="BroadCastReceiver">
<intent-filter>
<action android:name="android.app.action.ACTION_PASSWORD_FAILED"/>
<action android:name="android.app.action.ACTION_PASSWORD_SUCCEEDED"/>
<action android:name="android.app.action.DEVICE_ADMIN_DISABLED"/>
<action android:name="android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED"/>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/>
<action android:name="android.bluetooth.a2dp.action.SINK_STATE_CHANGED"/>
<action android:name="android.bluetooth.adapter.action.DISCOVERY_FINISHED"/>
<action android:name="android.bluetooth.adapter.action.DISCOVERY_STARTED"/>
<action android:name="android.bluetooth.adapter.action.LOCAL_NAME_CHANGED"/>
<action android:name="android.bluetooth.adapter.action.SCAN_MODE_CHANGED"/>
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED"/>
<action android:name="android.bluetooth.device.action.ACL_CONNECTED"/>
<action android:name="android.bluetooth.device.action.ACL_DISCONNECTED"/>
<action android:name="android.bluetooth.device.action.BOND_STATE_CHANGED"/>
<action android:name="android.bluetooth.device.action.CLASS_CHANGED"/>
<action android:name="android.bluetooth.device.action.FOUND"/>
<action android:name="android.bluetooth.device.action.NAME_CHANGED"/>
<action android:name="android.bluetooth.devicepicker.action.DEVICE_SELECTED"/>
<action android:name="android.bluetooth.devicepicker.action.LAUNCH"/>
<action android:name="android.bluetooth.headset.action.AUDIO_STATE_CHANGED"/>
<action android:name="android.bluetooth.headset.action.STATE_CHANGED"/>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
<action android:name="android.intent.action.ACTION_SHUTDOWN"/>
<action android:name="android.intent.action.AIRPLANE_MODE"/>
<action android:name="android.intent.action.BATTERY_CHANGED"/>
<action android:name="android.intent.action.BATTERY_LOW"/>
<action android:name="android.intent.action.BATTERY_OKAY"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.CAMERA_BUTTON"/>
<action android:name="android.intent.action.CONFIGURATION_CHANGED"/>
<action android:name="android.intent.action.DATA_SMS_RECEIVED"/>
<action android:name="android.intent.action.DATE_CHANGED"/>
<action android:name="android.intent.action.DEVICE_STORAGE_LOW"/>
<action android:name="android.intent.action.DEVICE_STORAGE_OK"/>
<action android:name="android.intent.action.DOCK_EVENT"/>
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"/>
<action android:name="android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE"/>
<action android:name="android.intent.action.GTALK_CONNECTED"/>
<action android:name="android.intent.action.GTALK_DISCONNECTED"/>
<action android:name="android.intent.action.HEADSET_PLUG"/>
<action android:name="android.intent.action.INPUT_METHOD_CHANGED"/>
<action android:name="android.intent.action.LOCALE_CHANGED"/>
<action android:name="android.intent.action.MANAGE_PACKAGE_STORAGE"/>
<action android:name="android.intent.action.MEDIA_BAD_REMOVAL"/>
<action android:name="android.intent.action.MEDIA_BUTTON"/>
<action android:name="android.intent.action.MEDIA_CHECKING"/>
<action android:name="android.intent.action.MEDIA_EJECT"/>
<action android:name="android.intent.action.MEDIA_MOUNTED"/>
<action android:name="android.intent.action.MEDIA_NOFS"/>
<action android:name="android.intent.action.MEDIA_REMOVED"/>
<action android:name="android.intent.action.MEDIA_SCANNER_FINISHED"/>
<action android:name="android.intent.action.MEDIA_SCANNER_SCAN_FILE"/>
<action android:name="android.intent.action.MEDIA_SCANNER_STARTED"/>
<action android:name="android.intent.action.MEDIA_SHARED"/>
<action android:name="android.intent.action.MEDIA_UNMOUNTABLE"/>
<action android:name="android.intent.action.MEDIA_UNMOUNTED"/>
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_CHANGED"/>
<action android:name="android.intent.action.PACKAGE_DATA_CLEARED"/>
<action android:name="android.intent.action.PACKAGE_INSTALL"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<action android:name="android.intent.action.PACKAGE_RESTARTED"/>
<action android:name="android.intent.action.PHONE_STATE"/>
<action android:name="android.intent.action.PROVIDER_CHANGED"/>
<action android:name="android.intent.action.REBOOT"/>
<action android:name="android.intent.action.SCREEN_OFF"/>
<action android:name="android.intent.action.SCREEN_ON"/>
<action android:name="android.intent.action.TIMEZONE_CHANGED"/>
<action android:name="android.intent.action.TIME_SET"/>
<action android:name="android.intent.action.TIME_TICK"/>
<action android:name="android.intent.action.UID_REMOVED"/>
<action android:name="android.intent.action.UMS_CONNECTED"/>
<action android:name="android.intent.action.UMS_DISCONNECTED"/>
<action android:name="android.intent.action.USER_PRESENT"/>
<action android:name="android.intent.action.WALLPAPER_CHANGED"/>
<action android:name="android.media.AUDIO_BECOMING_NOISY"/>
<action android:name="android.media.RINGER_MODE_CHANGED"/>
<action android:name="android.media.SCO_AUDIO_STATE_CHANGED"/>
<action android:name="android.media.VIBRATE_SETTING_CHANGED"/>
<action android:name="android.net.conn.BACKGROUND_DATA_SETTING_CHANGED"/>
<action android:name="android.net.wifi.NETWORK_IDS_CHANGED"/>
<action android:name="android.net.wifi.RSSI_CHANGED"/>
<action android:name="android.net.wifi.SCAN_RESULTS"/>
<action android:name="android.net.wifi.STATE_CHANGE"/>
<action android:name="android.net.wifi.WIFI_STATE_CHANGED"/>
<action android:name="android.net.wifi.supplicant.CONNECTION_CHANGE"/>
<action android:name="android.net.wifi.supplicant.STATE_CHANGE"/>
<action android:name="android.provider.Telephony.SIM_FULL"/>
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
<action android:name="android.provider.Telephony.SMS_REJECTED"/>
<action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED"/>
<action android:name="android.speech.tts.TTS_QUEUE_PROCESSING_COMPLETED"/>
<action android:name="android.speech.tts.engine.TTS_DATA_INSTALLED"/>
</intent-filter>
</receiver>