How to install mount SD card for Eclipse Android Emulator
If you want download some *.apk file from internet and try on your emulator you get error than you have to install SD card. You have to closing Android emulator.
Mount Android emulator SD card instruction
Image how install SD card on Android emulator in Eclipse.
Mount Android emulator SD card instruction
- In Eclipse go in menu Window - Android SDK and Avg Manager
- Select Virtual devices
- Select AVD Name where you need install SD card
- Click on Edit button
- In open dialog go to SD card - Size: and write 500
- Press button Edit AVD
- Run AVD emulator
Image how install SD card on Android emulator in Eclipse.
396LW NO topic_id
AD
Další témata ....(Topics)
Canvas, drawLine(), setStrokeWidth(), Paint, setAntiAlias(boolean), onDraw()
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new SampleView(this));
}
private static class SampleView extends View {
// CONSTRUCTOR
public SampleView(Context context) {
super(context);
setFocusable(true);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.YELLOW);
Paint p = new Paint();
// smooths
p.setAntiAlias(true);
p.setColor(Color.RED);
p.setStrokeWidth(4.5f);
// opacity
p.setAlpha(0x80); //
// drawLine (float startX, float startY, float stopX, float stopY,
// Paint paint)
canvas.drawLine(0, 0, 40, 40, p);
canvas.drawLine(40, 0, 0, 40, p);
}
}
}
package cz.okhelp.surfview;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnTouchListener;
public class MainActivity extends Activity implements OnTouchListener {
OurView v;
Bitmap ball, blob;
float x, y;
Sprite sprite;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_our_view);
v = new OurView(this);
v.setOnTouchListener(this);
ball = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
x = y = 0;
setContentView(v);
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
v.pause();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
v.resume();
}
public class OurView extends SurfaceView implements Runnable {
Thread t = null;
SurfaceHolder holder;
boolean isItOK = false;
public OurView(Context context) {
super(context);
// TODO Auto-generated constructor stub
holder = getHolder();
}
public void run() {
// TODO Auto-generated method stub
while (isItOK == true) {
// perform canvas drawing
if (!holder.getSurface().isValid()) {
continue;
}
// sprite = new Sprite(OurView.this,blob);
Canvas c = holder.lockCanvas();
c.drawARGB(255, 100, 100, 10);
c.drawBitmap(ball, x, y, null);
// onDraw(c);
holder.unlockCanvasAndPost(c);
}
}
protected void onDraw(Canvas canvas) {
// sprite.onDraw(canvas);
}
public void pause() {
isItOK = false;
while (true) {
try {
t.join();
} catch (InterruptedException e) {
// TODO: handle exception
e.printStackTrace();
}
break;
}// end while
}
public void resume() {
isItOK = true;
t = new Thread(this);
t.start();
}
}
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
try {
Thread.sleep(50);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
x = event.getX();
y = event.getY();
break;
case MotionEvent.ACTION_UP:
x = event.getX();
y = event.getY();
break;
case MotionEvent.ACTION_MOVE:
x = event.getX();
y = event.getY();
break;
}// end switch
return true;
}
}
Replace diacritic marks: Á Č Ď É Ě Í Ň Ó Ř Š Ť Ú Ů Ý Ž
á č ď é ě í ň ó ř š ť ú ů ý ž
á č ď é ě í ň ó ř š ť ú ů ý ž
public String replaceDiacritic (String inputStr) {
Map<String, String> replacements = new LinkedHashMap<String,String>() {{
//Velká
put("Á","A");
put("Č","C");
put("Ď","D");
put("É","E");
put("Ě","E");
put("Í","I");
put("Ň","N");
put("Ó","O");
put("Ř","R");
put("Š","S");
put("Ť","T");
put("Ú","U");
put("Ů","U");
put("Ý","Y");
put("Ž","Z");
//Malá "," ");
put("á","a");
put("č","c");
put("ď","d");
put("é","e");
put("ě","e");
put("í","i");
put("ň","n");
put("ó","o");
put("ř","r");
put("š","s");
put("ť","t");
put("ú","u");
put("ů","u");
put("ý","y");
put("ž","z");
}
};
for(Map.Entry<String, String> entry : replacements.entrySet()) {
inputStr = inputStr.replaceAll(entry.getKey(), entry.getValue());
}
return inputStr;
}
int occupy 4 bytes (32 bits) in memory
int in Java example of using Integer and Array of Integer and Iteger to String
int in Java example of using Integer and Array of Integer and Iteger to String
// get max end min values of int in Java example 4 bytes (32 bits) PC architecture
System.out.println(Integer.MAX_VALUE); // 2147483647
System.out.println(Integer.MIN_VALUE); // -2147483648
// members variable
private int mProgress = 10;
//integer to string java
int myInteger = 8;
String myString = Integer.toString(myInteger);
// a final variable can only be initialized once
static final int NUM_PARTICLES = 15;
for (int i = 0; i < NUM_PARTICLES ; i++) {
// do something
}
// int as return value of function
public int getCount() {
return 5;
}
// int as a parametr of function
public float getFloatFromInt(int i) {
float fRet = (float) i;
return fRet;
}
//array of int
int[] anArray; // declares an array of integers
anArray = new int[2]; // allocates memory for 2 integers
anArray[0] = 100; // initialize first element
anArray[1] = 200; // initialize second element
for (int i = 0; i < anArray.length; i++) {
// print out values from anArray
System.out.println("Index: " + i);
System.out.println("Value: " + anArray[i]);
}
Code with error:
If you get error try this code:
java.lang.ClassCastException: android.view.ViewGroup$LayoutParams
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:659)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:311)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
ImageView imgV = (ImageView)findViewById(R.id.myView);
imgV.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
0));
If you get error try this code:
ViewGroup.LayoutParams layoutParams = imgV
.getLayoutParams();
layoutParams.height = 0;
imgV.setLayoutParams(layoutParams);
java.lang.ClassCastException: android.view.ViewGroup$LayoutParams
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:659)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:311)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
Editace: 2014-02-15 20:48:42
Počet článků v kategorii: 396
Url:how-install-sd-card-on-android-eclipse-emulator