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

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>



396LW NO topic_id




AD

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


7

Show keyboard in WebView Android example | webview-keyboard


Show keyboard if WebView input have focus Android apps development example source code.

WebView webview;

//in onCreate

	webview = (WebView) findViewById(R.id.idWebviewPda);
	webview.getSettings().setJavaScriptEnabled(true);
	webview.loadUrl("//android.okhelp.cz");
	
	webview.requestFocus(View.FOCUS_DOWN);
    webview.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                case MotionEvent.ACTION_UP:
                    if (!v.hasFocus()) {
                        v.requestFocus();
                    }
                    break;
            }
            return false;
        }
    });

260

Iterate over each Entry in Map Java Android | iterate-over-each-entry-in-map-java-android


entry put iterate Map HashMap Java Android

Map<String, Integer> map = new HashMap<String, Integer>();
map.put("key27", 27);
for (Map.Entry<String, Integer> entry : map.entrySet())
{
 String str = entry.getKey();
 int n = entry.getValue();
}
168

Android SDK Samples as a Photo Gallery | android-sdk-samples-as-photo-serial


Photo Gallery of Android SDK Samples.
For better understanding of what the source knows there is a gallery of images.
After clicking on the preview displays the actual size and Titlebar
You can read the path to the source file as: Graphics/AnimateDrawables see the project folder
/ApiDemos/src/com/example/android/apis/graphics/AnimateDrawable.java


117

AlertDialog yes no - Alert - Messagebox - Android sample | alertdialog-yes-no-alert-messagebox-android-sample


Dialog Yes No sample code

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit application?")
       .setCancelable(false)
       .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
                MyActivity.this.finish(); //Close  this Activity for example: MyActivity.java
           }
       })
       .setNegativeButton("No", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
                // some code if you want
                dialog.cancel();
           }
       });
AlertDialog alert = builder.create();
alert.show();
222

Disable enable internet connection in Android Emulator | disable-enable-internet-connection-in-android-emulator


If you try function for checking internet connection you can disable internet on the emulator:
Settings - Wireless and networks - Mobile networks - Data enabled (checked - unchecked )


 public boolean isNetworkAvailable() {
        ConnectivityManager cm = (ConnectivityManager) 
          getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = cm.getActiveNetworkInfo();
        if (networkInfo != null && networkInfo.isConnected()) {
            return true;
        }
        return false;
    }