Data Form context And layout problems

2 posts, 0 answers
  1. Gokhan
    Gokhan avatar
    2 posts
    Member since:
    Nov 2013

    Posted 18 Feb Link to this post

    Hi,

    We are building a sample based on your documentation..

    We are getting red on

    1-context   (new RadDataForm(context);)

    2- layout    (layout.addView(form);)

    Project is extending an Activity. And using inside tab

    What may cause these problems. Thanks

    Here is the code..

     

    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.app.Activity;

    import com.telerik.widget.dataform.visualization.RadDataForm;

    public class MalzemeAlimi extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {

           super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_malzeme_alimi);
    RadDataForm form = new RadDataForm(context);
    form.setEntity(new OurClass());

    layout.addView(form);

        
       }


    }

  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 19 Feb Link to this post

    Hi Gokhan,

    Thank you for writing.
    The context should be an instance of the Context class. Since Activity inherits from Context you can simply create your data form like so: new RadDataForm(this);

    Regards,
    Victor
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top