john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

strings localization eclipse project

Eclipse -> Project Explorer -> hi-andriod -> res -> values -> main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

</LinearLayout>


Eclipse -> Project Explorer -> hi-andriod -> res -> values -> strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="hello">Hello World, HiAndroidActivity!</string>
    <string name="app_name">HiAndroid</string>

</resources>

// Use the xml based

package net.kittyandbear.hiandroid;

import android.app.Activity;
import android.os.Bundle;

public class HiAndroidActivity extends Activity 
{
    @Override
    public void onCreate( Bundle savedInstanceState ) 
    {
        super.onCreate( savedInstanceState );
        setContentView( R.layout.main );
    }
}

If you make a mistake in the strings.xml then strings.out.xml gets created with an error

<string name="app_name">WrongNameHiAndroid</string>

Use the Eclipse Project explorer to delete the errored strings.xml.out

  • « Ldaps slapd ubuntu 11
  • arrays multi array nat sort example »

Published

Dec 18, 2011

Category

android

~102 words

Tags

  • android 9
  • eclipse 22
  • java 252
  • localization 1
  • project 4
  • strings 6