• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

app development

thanks so much for willing to help me. the code will follow. this xml file with the modifications I did will not open.
my intent is to have full vertical scroll.
now the code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@String/appbar_scrolling_view_behavior"
tools:context="com.cancunsteve.aboutcancunsteve.MainActivity"
tools:showIn="@layout/activity_main">


<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
android:layout_alignParentStart="true"
android:layout_marginTop="56dp" />
<ImageView android:id="@+id/imageView"
android:layout_column="1"
android:background="@Mipmap/lpussy"
android:contentDescription='android:ContentDescription="@String/desc"'
tools:ignore="HardcodedText"
android:layout_width="200dp"
android:layout_height="230dp" />


<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" We&apos;ve been serving good people with special deals. "
android:id="@+id/text1"
android:layout_alignTop="@+id/imageView"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:background="#ffffff"
android:foreground="#05ffffff"
android:foregroundTint="#03ffffff"
android:textColor="#000000" />



<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText2"
android:text="Cancun, Playa del Carmen"
android:layout_below="@+id/text1"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:text="Holbox, Taxco, Palenque"
android:layout_below="@+id/editText2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton"
android:layout_below="@+id/editText3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@Mipmap/campa"
tools:ignore="ContentDescription"
android:layout_alignBottom="@+id/editText5" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/editText3"
android:text="thewebmaster@cancunsteve.com"
android:layout_below="@+id/editText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/editText"
android:layout_alignEnd="@+id/editText" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone"
android:ems="10"
android:id="@+id/editText4"
android:text=" 011 52 998 8873919"
android:layout_below="@+id/editText3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="42dp"
android:layout_marginStart="32dp" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText5"
android:text="be sure to visit us for up to 55% discounts on your hotel bookings"
android:layout_below="@+id/editText4"
android:layout_toRightOf="@+id/scrollView"
android:layout_toEndOf="@+id/scrollView" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="click buttons multiple times to change state"
android:id="@+id/textView2"
android:layout_below="@+id/imageButton" />

</LinearLayout>
</ScrollView>

</RelativeLayout>
 
Upvote 0
taking out the backshlash did not work but thanks.
the file opens now with this code below, BUT DOES NOT SCROLL
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@String/appbar_scrolling_view_behavior"
tools:context="com.cancunsteve.aboutcancunsteve.MainActivity"
tools:showIn="@layout/activity_main">


<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:eek:rientation="vertical" >

<RelativeLayout
android:id="@+id/scrollView"
android:layout_alignParentStart="true"
android:layout_marginTop="56dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView android:id="@+id/imageView"
android:layout_column="1"
android:background="@Mipmap/lpussy"
android:contentDescription='android:ContentDescription="@String/desc"'
tools:ignore="HardcodedText"
android:layout_width="200dp"
android:layout_height="230dp" />


<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" We&apos;ve been serving good people like you since 1994 with special deals on their travel plans. "
android:id="@+id/text1"
android:layout_alignTop="@+id/imageView"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:background="#ffffff"
android:foreground="#05ffffff"
android:foregroundTint="#03ffffff"
android:textColor="#000000" />



<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText2"
android:text="Cancun, Playa del Carmen, Tulum, Cozumel, Isla Mujeres, Merida, Valladolid, Chichen Itza."
android:layout_below="@+id/text1"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:text="Holbox, Taxco, Palenque, Acapulco, Ixtapa, Guanajuato, Guadalajara, Mexico City, Cabo San Lucas, Puerto Vallarta, Monterrey, Tenacatita, Mascota"
android:layout_below="@+id/editText2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton"
android:layout_below="@+id/editText3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@Mipmap/campa"
tools:ignore="ContentDescription"
android:layout_alignBottom="@+id/editText5" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/editText3"
android:text="thewebmaster@cancunsteve.com"
android:layout_below="@+id/editText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/editText"
android:layout_alignEnd="@+id/editText" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone"
android:ems="10"
android:id="@+id/editText4"
android:text=" 011 52 998 8873919"
android:layout_below="@+id/editText3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="42dp"
android:layout_marginStart="32dp" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText5"
android:text="be sure to visit us at www.cancunsteve.com for up to 65% discounts on your hotel bookings"
android:layout_below="@+id/editText4"
android:layout_toRightOf="@+id/ScrollView"
android:layout_toEndOf="@+id/ScrollView" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="click buttons multiple times to change state"
android:id="@+id/textView2"
android:layout_below="@+id/imageButton" />




</RelativeLayout>
</ScrollView>
 
Upvote 0
in the mainactivity.java file below getting errors when attempting to build app
please help me fix errors.

Code:
public class MainActivity extends AppCompatActivity {
    private Button mButton;
    [USER=1021285]@override[/USER]
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button activityButton = (Button) findViewById(R.id.button_quiz);
        activity@Button.setOnClick(value = new OnClickListener(),
                toolbar = (Toolbar) findViewById(R.id.toolbar), setSupportActionBar = (toolbar), mButton = (Button) findViewById(R.id.button_quiz), mButton =, setOnClickListener = (new OnClickListener() {
            [USER=1021285]@override[/USER]
            public void onClick(View view) {
                //open url using Intent
                String url = "http://www.cancunsteve.com/capecod/mobilepopquiz2.htm";
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));


            }
        }
 
Last edited by a moderator:
Upvote 0
Your code has so many problems, I don't know where to start. Well let's begin with this

Code:
activity@Button

If you can't see why that's a problem, stop coding now, and pick up the first book you find on Java, and start reading. If you're doing cut/paste coding, then try to understand the code you're using. Otherwise you'll have endless problems, and you'll never achieve anything.

So tell me, what do you think that statement at line 9 is trying to do?
 
Upvote 0
the click listener is to know if the button is activated (clicked) this button loads the url in question
not sure why it calls a new click listener though
will follow your advice for posting code
bought an expensive book on android coding but it explains more to open new activity
if all else fails will go that route

However expensive the book you bought, I'll bet it doesn't explain the basics of the Java programming language.
You need to do the foundation work before you can build the house.
 
Upvote 0
have two errors stemming from the manifest when trying to compile.
my mainactivity.java is fine I believe.
the errors are cannot find activity class NewActivity2. cannot find symbol variable activity_main
manifest below:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cancunsteve.aboutcancunsteve"
android:installLocation="preferExternal">

<uses-sdk android:minSdkVersion="19" />


<application
android:allowBackup="true"
android:icon="@Mipmap/appicon"
android:label="@String/app_name"
android:supportsRtl="true"
android:theme="@Style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@String/app_name"
android:theme="@Style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".NewActivity2"
android:label="@String/title_activity_main2"
android:parentActivityName=".MainActivity"
android:theme="@Style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.cancunsteve.aboutcancunsteve.MainActivity" />
</activity>
</application>

</manifest>
 
Upvote 0
believe so here is an excerpt (hope I did it correctly)

Code:
public class MainActivity extends AppCompatActivity {
    Button button;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Get the view from activity_main.xml
        setContentView(R.layout.activity_main);

        // Locate the button in activity_main.xml
        button = (Button) findViewById(R.id.MyButton);

        // Capture button clicks
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View arg0) {

                // Start NewActivity.class
                Intent myIntent = new Intent(MainActivity.this,
                        NewActivity2.class);
                startActivity(myIntent);
            }
        });
    }
 
Upvote 0
in my mainactivity.java I do not have NewActivity2 java class. nor am I sure the correct way to enter it correctly
now I have
Code:
public class MainActivity extends AppCompatActivity {
    Button button;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Get the view from activity_main.xml
        setContentView(R.layout.activity_main);

        // Locate the button in activity_main.xml
        button = (Button) findViewById(R.id.MyButton);

        // Capture button clicks
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View arg0) {

                // Start NewActivity.class
                Intent myIntent = new Intent(MainActivity.this,
                        NewActivity2.class);
                startActivity(myIntent);
            }
        });
    }
should I put public class NewActivity2 extends AppCompatActivity {
Button button;
then all the same code after @override as above? not sure?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones