Get Screen Size Pixels per Inch Android example
The exact physical pixels per inch of the screen
Get size of pixel
Get DPI
Get count of pixels per inch
Get size of pixel
Get DPI
Get count of pixels per inch
float mXDpi;
float mYDpi;
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
mXDpi = metrics.xdpi; // The exact physical pixels per inch of the screen in the X dimension.
mYDpi = metrics.ydpi;
float mMetersToPixelsX = mXDpi / 0.0254f; // 1 inch == 0.0254 metre
float mMetersToPixelsY = mYDpi / 0.0254f;
396LW NO topic_id
AD
Další témata ....(Topics)
Date difference in millisecond between two date, GregorianCalendar, Calendar, after(), befor(), getTimeInMillis().
public class HoriziontalScrollActivity extends Activity {
TextView txtV;
Context cntx;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtV = (TextView)findViewById(R.id.idLabel);
cntx = this;
StringBuilder strBuild = new StringBuilder();
Calendar firstDate = new GregorianCalendar(2011, Calendar.DECEMBER, 31);
Calendar secondDate = new GregorianCalendar(2012, Calendar.JANUARY, 1);
Boolean bDetermine = firstDate.after(secondDate); // false
strBuild.append("Is firsDate after secondDate? " + bDetermine + "
");
bDetermine = firstDate.before(secondDate); // true
strBuild.append("Is firsDate before secondDate? " + bDetermine + "
");
long differenceInMillisecond = 0L;
differenceInMillisecond = secondDate.getTimeInMillis()-firstDate.getTimeInMillis();
// second == 1000 millisecond
long second = differenceInMillisecond / 1000L;
strBuild.append("Difference between two dates is: " + second + "
");
txtV.setText(strBuild);
}
}
HTC Desire HD cena od 7 000 KCZ Kč (únor.2012)
HTC Desire HD je chytrý telefon běžící na operačním systému Android.
HTC Desire HD je (22.února2012) druhým nejpoužívanějším chytrým telefonem u programu Sky Map viz tabulka.
Smartphone má hliníkový unibody design, vybaven je Androidem 2.2 (Froyo) a HTC Sense displayem. Na zadní straně jsou dvě plastové krytky, jedna obsahuje baterii, druhá SIM kartu a paměťovou kartu microSDHC. Telefon je vybaven 4,3 palcovým WVGA LCD TFT dotykovým displayem, 8 megapixelovým fotoaparátem (lze nahrávat 720p video), podpora pro HSPA / W-CDMA a quad-band GSM / GPRS / EDGE.
Telefon je vybaven 1 GHz CPU Scorpion MSM8255 procesorem. Tato druhá generace Snapdragon procesoru má nízkou spotřebu energie.
HTC HD má 768 MB RAM a 1,5 GB interní paměti flash. K dispozici je také slot pro microSDHC / XC kartu s kapacitou až 32 GB dat.
HTC Desire HD photo pic image
Zdroj obrázku: wikipedia
HTC Desire HD je chytrý telefon běžící na operačním systému Android.
HTC Desire HD je (22.února2012) druhým nejpoužívanějším chytrým telefonem u programu Sky Map viz tabulka.
Smartphone má hliníkový unibody design, vybaven je Androidem 2.2 (Froyo) a HTC Sense displayem. Na zadní straně jsou dvě plastové krytky, jedna obsahuje baterii, druhá SIM kartu a paměťovou kartu microSDHC. Telefon je vybaven 4,3 palcovým WVGA LCD TFT dotykovým displayem, 8 megapixelovým fotoaparátem (lze nahrávat 720p video), podpora pro HSPA / W-CDMA a quad-band GSM / GPRS / EDGE.
Telefon je vybaven 1 GHz CPU Scorpion MSM8255 procesorem. Tato druhá generace Snapdragon procesoru má nízkou spotřebu energie.
HTC HD má 768 MB RAM a 1,5 GB interní paměti flash. K dispozici je také slot pro microSDHC / XC kartu s kapacitou až 32 GB dat.
HTC Desire HD photo pic image
Zdroj obrázku: wikipedia
The source attachment does not contain the source for the file TextWatcher.class.
You can change the source attachment by clicking Change Attached Source below:
You have to add JDK src.zip path to dialog as on image below.
[caption id="attachment_1091" align="alignleft" width="282" caption="class file editor source not found Eclipse warning"][/caption]
Or go to Project > Properties > Java Build Path > Libraries
Expand JRE System Library. Expand rt.jar.
Select Source attachment and double click or Edit.
Type path the source code file (External File…) and press OK.
[caption id="attachment_1094" align="alignleft" width="300" caption="Java project build path"][/caption]
[caption id="attachment_1105" align="alignleft" width="300" caption="Java JRE deifiniton path in Eclipse"][/caption]
Now if mouse move about keywords String or F3 on keywords and press button in yellow field will opened String.class
You can change the source attachment by clicking Change Attached Source below:
You have to add JDK src.zip path to dialog as on image below.
[caption id="attachment_1091" align="alignleft" width="282" caption="class file editor source not found Eclipse warning"][/caption]
Or go to Project > Properties > Java Build Path > Libraries
Expand JRE System Library. Expand rt.jar.
Select Source attachment and double click or Edit.
Type path the source code file (External File…) and press OK.
[caption id="attachment_1094" align="alignleft" width="300" caption="Java project build path"][/caption]
Or type path in Java JRE definition
[caption id="attachment_1105" align="alignleft" width="300" caption="Java JRE deifiniton path in Eclipse"][/caption]
How open String.class or others keywords definition with Eclipse.
Now if mouse move about keywords String or F3 on keywords and press button in yellow field will opened String.class
if , else if, else statement with string as a switch statement in Java example source code.
MainClass.java
MainClass.java
public class MainClass {
public static void main(String[] arg) {
String[] arrayOfString = {"nothing", "Hello", "people"
, "bye-bye", "hello", "world!", "end" };
for (int i = 0; i < arrayOfString.length; i++) {
if (arrayOfString[i].equals("Hello"))
System.out.println(arrayOfString[i]);
else if (arrayOfString[i].equals("people"))
System.out.println(arrayOfString[i]);
else if (arrayOfString[i].equals("hello"))
System.out.println(arrayOfString[i]);
else if (arrayOfString[i].equals("world!"))
System.out.println(arrayOfString[i]);
else // default
System.out.println("Default");
}
}
}
/*
Default
Hello
people
Default
hello
world!
Default
*/
Try this solutions:
1.) Save xml file
2.) Close tab with xml file
3.) Reopen xml file
1.) Open from menu Window->Android SDK Manager
2.) Select available updates (Tools, SDK etc.)
3.) Install updates
1.) Open from menu Help->Check for Updates
2.) Install available plugins what You need
3.) Restart Eclipse
1.) Save xml file
2.) Close tab with xml file
3.) Reopen xml file
1.) Open from menu Window->Android SDK Manager
2.) Select available updates (Tools, SDK etc.)
3.) Install updates
1.) Open from menu Help->Check for Updates
2.) Install available plugins what You need
3.) Restart Eclipse
Editace: 2013-12-09 13:06:15
Počet článků v kategorii: 396
Url:get-screen-pixels-android-example