Genymotion not workin after windows 10 update

**First update to latest version of Virtual box

Then—

Go to :=>
Control Panel\Network and Internet\Network and Sharing Center\Change adapter setting

  1. Select Ethernet(VirtualBox Host-Only Ethernet …..)
  2. Right click on VirtualBox Host only adapter that created
  3. Choose properties
  4. Check “VirtualBox NDIS6 Bridged Networking driver”
  5. Press Ok
  6. Right click on Ethernet  and Disable it
  7. Right click on Ethernet  and Enable it
    *** Here we go to use Genymotion***

Image

Not able to write on Sdcard in emulator

Getting error when trying to push file on sdcard in emulator or not able to write file on sdcard in emulator

Failed to push selection: Read-only file system

——————

C:\Documents and Settings\<adminstrator>\.android\avd

OR

C:\Documents and Settings\Pankaj\.android\avd

==>

take 'properties' of your avd folder (there is a folder for each of the avd’s)

uncheck 'Read only' -> OK 

 

Not able to find any xml layout in activity on setContentView

When trying to get xml layout in activity  on setContentView(R.layout.    )  ==not able to find the layout

=> Reason and solution

1) the layout might some error so instead of repairing it delete and again create it and clean project. ( Specially if you are not getting particular layout)

2) when we are accessing layout to set in Activity and not able to find any layout then its an issue of selection for proper package            ==>  setContentView(R.) = after pressing  r.  when we select layout then select it carefully because it shows                                        default  1) layout-android.R  and  2)layout-your package name.R    so always select layout with your package

 layout ====  2)layout-your package name.R     then you can see all layout

=== setContentView(R.layout.xml_layout) 

 

java.lang.IndexOutOfBoundsException: Invalid index .., size is .. when setting value to arraylist spinner at position

java.lang.IndexOutOfBoundsException: Invalid index  .., size is  ..

when setting value to arraylist spinner at position

 Error In Log==>

06-27 14:46:01.821: E/AndroidRuntime(20824): FATAL EXCEPTION: main
06-27 14:46:01.821: E/AndroidRuntime(20824): java.lang.IndexOutOfBoundsException: Invalid index 6, size is 4
06-27 14:46:01.821: E/AndroidRuntime(20824): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
06-27 14:46:01.821: E/AndroidRuntime(20824): at java.util.ArrayList.get(ArrayList.java:304)
06-27 14:46:01.821: E/AndroidRuntime(20824): at android.widget.ArrayAdapter.getItem(ArrayAdapter.java:337)
06-27 14:46:01.821: E/AndroidRuntime(20824): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:390)
 
Solution:=>  
String name=”Pankaj”;
 Check value in arraylist using => arrayList.indexOf()
and take out the position of value from arraylist.=>
int pos= arrayList.indexOf(name);
 Set Position in Spinner :=>
 spinner.setSelection(pos);
 -------------------------------------------------
int pos= arrayList.indexOf(name);
spinner.setSelection(pos);

 

Scrollabale listview in both direction with header using Horizontal scrollview

In this code i have used two linear layout in Horizontal Scrollview.=>[

first Outerlinear layout(orientation:vertical)  contain==>[ inner linear layout(orientation:horizontal) which includes textview’s which work as header and scroll with listview.] that listview is in outer layout after closing inner layout.]

 

<HorizontalScrollView
            android:layout_width=”wrap_content”
            android:layout_height=”wrap_content”
             android:layout_alignParentLeft = “true”
        android:layout_alignParentRight = “true”>

            <LinearLayout
                android:layout_width=”match_parent”
                android:layout_height=”wrap_content”
                 android:orientation=”vertical” >
        <LinearLayout
        android:layout_width=”match_parent”
        android:layout_height=”wrap_content”
            android:orientation=”horizontal”   >
                <TextView
                    android:id=”@+id/textView7″
                    android:layout_width=”85dp”
                    android:layout_height=”wrap_content”
                    android:layout_marginLeft=”5dp”
                    android:text=”Deal_NO”
                    android:textAppearance=”?android:attr/textAppearanceLarge” />

                <TextView
                    android:id=”@+id/textView8″
                    android:layout_width=”190dp”
                    android:layout_height=”wrap_content”
                    android:layout_marginLeft=”15dp”
                    android:text=”Buyer_Party_Name”
                    android:textAppearance=”?android:attr/textAppearanceLarge” />

                <TextView
                    android:id=”@+id/textView9″
                    android:layout_width=”190dp”
                    android:layout_height=”wrap_content”
                    android:layout_marginLeft=”15dp”
                    android:text=”Seller_Party_Name”
                    android:textAppearance=”?android:attr/textAppearanceLarge” />

                <TextView
                    android:id=”@+id/textView09″
                    android:layout_width=”130dp”
                    android:layout_height=”wrap_content”
                    android:layout_marginLeft=”11dp”
                    android:text=”Item_Name”
                    android:textAppearance=”?android:attr/textAppearanceLarge” />

                <TextView
                    android:id=”@+id/textView10″
                    android:layout_width=”135dp”
                    android:layout_height=”wrap_content”
                    android:layout_marginLeft=”8dp”
                    android:text=”Deal_Amount”
                    android:textAppearance=”?android:attr/textAppearanceLarge” />

                <TextView
                    android:id=”@+id/textView12″
                    android:layout_width=”125dp”
                    android:layout_height=”wrap_content”
                    android:layout_marginLeft=”5dp”
                    android:text=”Deal_Date”
                    android:textAppearance=”?android:attr/textAppearanceLarge” />

                <TextView
                    android:id=”@+id/textView014″
                    android:layout_width=”135dp”
                    android:layout_height=”wrap_content”
                    android:layout_marginLeft=”10dp”
                    android:text=”Loading_Date”
                    android:textAppearance=”?android:attr/textAppearanceLarge” />

                <TextView
                    android:id=”@+id/textView14″
                    android:layout_width=”160dp”
                    android:layout_height=”wrap_content”
                    android:layout_marginLeft=”10dp”
                    android:text=”Unloading_Date”
                    android:textAppearance=”?android:attr/textAppearanceLarge” />
            </LinearLayout>
            
       

        <View
            android:layout_width=”fill_parent”
            android:layout_height=”3dp”
            android:layout_marginBottom=”5dp”
            android:layout_marginTop=”5dp”
            android:background=”@android:color/black” />

        <ListView
            android:id=”@+id/OviewListView1″
            android:layout_width=”fill_parent”
            android:layout_height=”200dp” >
        </ListView>
        </LinearLayout>
         </HorizontalScrollView>

set component at top and bottom of layout

<LinearLayout
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:orientation=”vertical” >
<LinearLayout
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:orientation=”vertical”
android:layout_weight=”1″>
<Button
android:id=”@+id/button1″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”Button”
/>
</LinearLayout>
<Button
android:id=”@+id/button2″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”Button”
android:layout_weight=”0″/>

</LinearLayout>

===========

use      android:layout_weight=”” to fix the component on layout for each screen size.