Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

Number convert int to string Java Android example code


Convert number int to string Android Java example source code.

int n = 0;

try {
    n = Integer.parseInt("21"));
} catch(NumberFormatException e) {
   System.out.println("Could not parse " + e);
// int to string
String s = String.valueOf(24);

397LW NO topic_id


Další témata ....(Topics)


Sqlite create database and table with BAT file for Android | sqlite-create-database-and-table-with-bat-file

Sqlite3 create database and table with load.bat file and fill data to table example.

  1. Create folder for your project: my_sqlite_project

  2. Open folder and create file load.bat and paste to load.bat this text and save to project folder:

    sqlite3 my_database.s3db < load_text.sql

  3. Create load_text.sql file and paste this text and save to project folder:

    CREATE TABLE [android_metadata] (
    [locale] TEXT

    CREATE TABLE [my_table] (
    [_id] int NULL,
    [word] VARCHAR(255) NULL,
    [description] VARCHAR(255) NULL

    .separator ";"
    .import text_file.txt my_table

  4. Create text_file.txt and paste this text and save it as UTF-8:

    1;word1;my first word
    2;word2; my second word

  5. Download sqlite3.exe and put to project folder.

  6. Run BAT file load.bat and read text instruction from console

  7. If database created you can open and edit this with sqlite database explorer

  8. Copy database to Asses Android project folder

  9. If you want using this database in Android application on device, you have to copy this database to folder on device /data/data/com.MyPackage/databases/


Start Open New Activity Android Code | start-open-new-activity-android-code

      Intent i = new Intent(this, MyNextClass.class);


Unable to resolve id for attribute id Graphical layout editor Eclipse error | unable-to-resolve-id-for-attribute-id-graphical-layout-editor-eclipse-error

Problem: erroneous entry of id

<RadioButton android:id="idRadio"
                android:text="My radio button"/>

Solution: @+id/

<RadioButton android:id="@+id/idRadio"
                android:text="My radio button"/>

Class File Editor - Source not found - Change Attached Source - Eclipse | class-file-editor-source-not-found-change-attached-source-eclipse

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]

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
Java Eclipse intellisense


EditText text changed java Android | edittext-text-changed

Google Android example source code - is text changed in EditText ?

EditText hEditText;

// TextChanged in onCreate
hEditText = (EditText)findViewById(R.id.idEditText);
hEditText.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable str) {

public void beforeTextChanged(CharSequence s, int start, int count,
int after) {

public void onTextChanged(CharSequence sq, int start, int before,
int count) {

Editace: 2013-12-09 10:54:53
Počet článků v kategorii: 397

11 Share