1. JonCamilleri's Avatar
    I cannot quite understand why Android Studio complains so much about this code, can you help please as I am still learning?

    [code=java]
    package com.example.android.camera2basic;
    package com.paad.ch02_manual_layout;

    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.LinearLayout;
    import android.widget.TextView;

    public class SecondActivity extends Activity {


    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    LinearLayout.LayoutParams lp;
    lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
    LinearLayout.LayoutParams.FILL_PARENT);

    LinearLayout.LayoutParams textViewLP;
    textViewLP = new LinearLayout.LayoutParams(
    LinearLayout.LayoutParams.FILL_PARENT,
    LinearLayout.LayoutParams.WRAP_CONTENT);

    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.VERTICAL);

    TextView myTextView = new TextView(this);
    myTextView.setText(getString(R.string.hello));

    ll.addView(myTextView, textViewLP);
    this.addContentView(ll, lp);
    }

    }


    [/code]

    Source of reference is Professional Android 4 Application Development ISBN 978-1-118-10227-5, written by Reto Meier, page 38 <link removed>
    02-03-2015 05:29 AM

Similar Threads

  1. Replies: 1
    Last Post: 02-06-2015, 02:07 PM
  2. Question about flashing, figured this would be the forum to ask.
    By Eion in forum Samsung Galaxy S5 Rooting, ROMs & Hacks
    Replies: 2
    Last Post: 02-03-2015, 07:09 PM
  3. Why is my hudl so slow?
    By AC Question in forum Ask a Question
    Replies: 1
    Last Post: 02-03-2015, 04:44 AM
  4. Replies: 1
    Last Post: 02-02-2015, 11:15 PM
  5. Why won't my Nexus 5 (Lollipop) work on AT&T?
    By AC Question in forum Ask a Question
    Replies: 0
    Last Post: 02-02-2015, 11:02 PM
LINK TO POST COPIED TO CLIPBOARD