Okhelp.cz

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.

No resource found that matches the given name Eclipse Android xml file


AD MOB

No resource found that matches the given name - error examples.
Exist resource file?
Is code written correctly?

// No resource found that matches the given name (at id with value @id/myButton).
 android:id="@id/myButton" // invalid id notation
 android:id="@+id/myButton" // correct


 // No resource found that matches the given name 
// (at icon with value @drawable/icons).
// exist file icons in res/drawable folder?
<application android:icon="@drawable/icons" 

//No resource found that matches the given name 
//(at theme with value @style/MyThem).
<activity android:name=".Main"
                  android:label="@string/app_name"
                  android:theme="@style/MyThem">

// Exist style MyThem  in styles.xml ?  No only MyTheme
<style name="MyTheme" parent="android:Theme">
        <item name="android:windowTitleSize">50px</item>
</style>



// exist file my_background in folder drawable ?
android:background="@drawable/my_background" // 

// no resource found that matches the given name(at "label" with value "@string/app_name")
// have you the string resource defined in res/values/strings.xml ?
<string name="app_name">"My App"</string>



397LW NO topic_id




AD

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


259

Shuffle Array of String Java Example | shuffle-array-of-string-java-example



       String[] sAr = new String[] {"one","two","three"};
       List<String> wordList = Arrays.asList(sAr);
       Collections.shuffle( wordList);
       String[]myShuffledArray = wordList.toArray(new String[wordList.size()]);


39

How setup color coloring syntax code highlight highlighting in Eclipse editor Android example | how-setup-color-syntax-highlight-in-eclipse-android-example


How setup color coloring highlight highlighting syntax font size and family in Eclipse Java and XML editor Android example
Java editor

  1. Go to Eclipse menu Window -> Preferences

  2. Doubleclick on Java

  3. Double click on Editor

  4. Select Java, Javadocs or Comments and setup color and font

  5. Font size and family change from Window->Preferences-> General->Appearance->Colors and Fonts


  6. Press OK for saving changes


xml editor
xml editor double click in Preferences dialog on xml -> Editor -> Syntax coloring
[caption id="attachment_627" align="alignleft" width="297" caption="Eclipse editor syntax color settings"]eclipse-color-syntax-highlight-settings[/caption]
27

Get Context Java Android example | get-context-java-android-example


getContext() getApplicationContext() method Java Android example source






Context myContext_1 = ThisClassName.this; // to open a Dialog
Context myContext_2 = getContext();
Context myContext_3 = this.getContext();
Context myContext_4 = this;
Context myContext_5 = this.getApplicationContext ();


OnClickListener getImageBtnOnClick = new OnClickListener() {
public void onClick(View view) {
Context context = view.getContext();

}
};
// Toast
Toast.makeText(getApplicationContext(), "Context == getApplicationContext "
, Toast.LENGTH_SHORT).show();



// store Context in public class
public class MyActivity extends Activity {
public static Context myCnt = null;
...
protected void onCreate(Bundle icicle) {
...
myCnt = this;
MyStorage.setContext(myCnt);
// or
// MyStorage.setContext(this);

// cntxFromStorage == this
Context cntxFromStorage = MyStorage.getContext();
...
};
};

public class MyStorage
{
private static Context cntStorageContext = null;


public static Context getContext() {
return cntStorageContext;
}

public static void setContext(Context context) {
MyStorage.cntStorageContext = context;
}


};

class DataBaseHelper extends SQLiteOpenHelper {
// get MyActivity context
Context cnt = MyStorage.getContext();

}



25

Copy sqlite database from apk package to device folder Android example | copy-sqlite-database-from-apk-to-device-folder-android-example


Put your sglite database to Android Eclipse project folder named Assets.
On device will copy database file to application folder as this example:



 public void createDatabase(Context myContext) throws IOException {
    String sPackName = myContext.getPackageName();
    InputStream assetsDB = myContext.getAssets().open("myDatabase");
    OutputStream dbOut = new FileOutputStream("/data/data/"+sPackName+"/database");
 
    byte[] buffer = new byte[1024];
    int length;
    while ((length = assetsDB.read(buffer))>0){
      dbOut.write(buffer, 0, length);
    }
 
    dbOut.flush();
    dbOut.close();
    assetsDB.close();
}


266

Change icon set Android developers example | change-icon-set-android-developers


How to quickly change all icon set in .apk project with Eclipse:

Right click on project in folder tree
Select New - Ohter

eclipse-icon-set-create-android-project

In open wizard dialog select Android Icon Set
eclipse-icon-set-create-android-project

Set Icon set name:
eclipse-icon-set-create-android-project

Open some large icon for your project for example 512x512 px and wizard will make all set of icons from one largest icon:
eclipse-icon-set-create-android-project

Wizard will create all set of icons from this one largest icon.
Click on finish button:
eclipse-icon-set-create-android-project


Editace: 2014-02-15 20:47:37
Počet článků v kategorii: 397
Url:no-resource-found-that-matches-the-given-name-eclipse-android-xml-file

AD
11 Share
Share
Tweet