how to make the user add and delete in android

Posted by user3678019 on Stack Overflow See other posts from Stack Overflow or by user3678019
Published on 2014-06-09T09:20:47Z Indexed on 2014/06/09 9:24 UTC
Read the original article Hit count: 288

Filed under:

i have 1 activity .. and in this activity i have 2 web view next to each other , i would like to add , ADD and Delete Button that can add one more web view next to the last web view , and the delete wish will delete any of the web view the user choose . and i want to make the user but it in the order he want like webview 1 first then webview 2 second

how can i do this

this is mu main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="test.zezo.test.Main$PlaceholderFragment" >




<HorizontalScrollView
    android:id="@+id/horizontalScrollView2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"


    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal" >

        <WebView
            android:id="@+id/webView1"
            android:layout_width="350dp"
            android:layout_height="match_parent"

            android:layout_alignParentLeft="true" />


        <WebView
            android:id="@+id/webView22"
            android:layout_width="350dp"
            android:layout_height="match_parent"

            android:layout_toRightOf="@+id/webView1"
            android:layout_alignParentLeft="true" />





    </LinearLayout>
</HorizontalScrollView>

and this is a part of my main.java

webView = (WebView) findViewById(R.id.webView1);
    String url = "http://google.com";
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(url);
    webView.setWebChromeClient(new WebChromeClient()); 
    webView.setWebViewClient(new WebViewClient());





    WebView webView22 = (WebView)findViewById(R.id.webView22);
    webView22.getSettings().setJavaScriptEnabled(true);
    webView22.loadUrl("google.com);
    webView22.setWebChromeClient(new WebChromeClient()); 
    webView22.setWebViewClient(new WebViewClient());

so how can i do the ADD and DELETE and re Order Buttons to it and one more thing it should be save so when he reopen the app it will be the same as after he add or delete or re order

© Stack Overflow or respective owner

Related posts about android