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.

fragment Binary XML file line Must specify unique android:id, android:tag, or have a parent with an id for



FrameLayou, fragment have to unique id android:id="@+id/your_id_unique"

<FrameLayout xmlns:android="//schemas.android.com/apk/res/android"
    xmlns:tools="//schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <fragment
        android:id="@+id/your_id_unique"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="cz.okhelp.notepad.AddNoteFragment"
        tools:layout="@layout/add_note" />

</FrameLayout>

397LW NO topic_id



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


361

Not visible layout changes on testing device | not-visible-layout-changes-on-testing-device


Delete - unistal app from testing device - emulator and try again RUN - DEBUGG your app.
49

Emulator window was out of view and was recentred - Android emulator warning | emulator-window-was-out-of-view-and-was-recentred-android-emulator-warning


Emulator window was out of view and was recentred
Emulator] WARNING: Data partition already in use. Changes will not persist!
Emulator] WARNING: SD Card image already in use: C:\Documents and Settings\user_name\.android\avd\hvga21_up1_7.avd/sdcard.img
Emulator] WARNING: Cache partition already in use. Changes will not persist!

Basic step
Try restart Eclipse if using from menu File->Restart

Other solutions

Solution 1: try restart ADB server
//android.okhelp.cz/how-quickly-restart-adb-exe-adb-server-android-emulator-example/


Solution 2:

Delete Run Configuration


//android.okhelp.cz/android-emulator-wont-run-application-started-from-eclipse/





Solution 3:
Try delete:

c:\Documents and Settings\user_name\.android\avd\my_avd.avd\cache.img
c:\Documents and Settings\user_name\.android\avd\my_avd.avd\userdata-qemu.img



Try solution 4:
Eclipse menu select Window->Preferences->Android

Windows 32

FROM: C:\Program Files\Android\android-sdk
TO: C:\PROGRA~1\Android\android-sdk

Windows 64

FROM: C:\Program Files (x86)\Android\android-sdk
TO: C:\PROGRA~2\Android\android-sdk
247

Create About Dialog Android Example | create-about-dialog-android-example


Wiktionary - SDK samples Android

    protected void showAbout() {
        // Inflate the about message contents
        View messageView = getLayoutInflater().inflate(R.layout.about, null, false);

        // When linking text, force to always use default color. This works
        // around a pressed color state bug.
        TextView textView = (TextView) messageView.findViewById(R.id.about_credits);
        int defaultColor = textView.getTextColors().getDefaultColor();
        textView.setTextColor(defaultColor);

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setIcon(R.drawable.app_icon);
        builder.setTitle(R.string.app_name);
        builder.setView(messageView);
        builder.create();
        builder.show();
    }

about dialog android example

about.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project
          //www.apache.org/licenses/LICENSE-2.0
-->

<LinearLayout xmlns:android="//schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="20dip">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="16sp"
        android:text="@string/app_descrip"
        android:textColor="?android:attr/textColorPrimaryInverse" />

    <TextView
        android:id="@+id/about_credits"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="20dip"
        android:textSize="16sp"
        android:text="@string/app_credits"
        android:autoLink="web"
        android:textColor="?android:attr/textColorPrimaryInverse" />

</LinearLayout>

250

Resize ImageView Image in View Android Example | resize-imageview-image-in-view-android-example


How to resize an image in ImageView Android source code.
Resize imageview layout and image will resize too:

	public void resizeImageView(int width, int height) {
		final ImageView picture1 = (ImageView)findViewById(R.id.imageView1);
		LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(width, height);
		picture1.setLayoutParams(layoutParams);
	}

369

View getId is null Android | view-getid-is-null-android


If you create a button or view programmatically with OnClickListener you can set a tag key before button in parent layout is added.
And get correct button by this tag getTag() instead getId() in OnClickListener etc.

Button button = new Button(getApplicationContext());
int idOfButton = button.getId(); // return -1

button.setTag("my_button");
String sTag = (String) button.getTag(); // return "my_button"



Editace Jana Žákovská : 2016-02-19 21:27:08
Počet článků v kategorii: 397
Url:fragment-binary-xml-file-line-must-specify-unique-androidid-androidtag-or-have-a-parent-with-an-id-for
Share
Share
Tweet