{"id":3552,"date":"2014-03-28T10:36:05","date_gmt":"2014-03-28T10:36:05","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/28\/how-to-use-the-last-layout-in-my-viewpager-that-loads-a-new-contentview-collection-of-common-programming-errors\/"},"modified":"2014-03-28T10:36:05","modified_gmt":"2014-03-28T10:36:05","slug":"how-to-use-the-last-layout-in-my-viewpager-that-loads-a-new-contentview-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/28\/how-to-use-the-last-layout-in-my-viewpager-that-loads-a-new-contentview-collection-of-common-programming-errors\/","title":{"rendered":"How to use the last layout in my viewPager that loads a new contentView-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m trying to create a new content view, when I press on the last imagebutton in my viewpager. The app crashes whenever I try to add any java to the layouts. For example, I tried to make the background black in java and that caused a crash. So, I used XML. Now I&#8217;m doing something very wrong because my imagebutton crashes the app too. I&#8217;m a very new programmer and any help would be appreciated! I think it&#8217;s something to do with intents.<\/p>\n<pre><code>public class Splash extends Activity {\n\n    ImageButton listButton;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        \/\/ TODO Auto-generated method stub\n        super.onCreate(savedInstanceState);\n        requestWindowFeature(Window.FEATURE_NO_TITLE);\n        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,\n                WindowManager.LayoutParams.FLAG_FULLSCREEN);\n        setContentView(R.layout.splash);\n\n        SplashPager adapter = new SplashPager();\n        ViewPager myPager = (ViewPager) findViewById(R.id.splashPager);\n        myPager.setAdapter(adapter);\n        myPager.setCurrentItem(0);\n\n        listButtonListener();\n\n    }\n\n    public void listButtonListener() {\n\n        \/\/ Intent i = new Intent(\"com.example.survtest1.Main\");\n        \/\/ startActivity(i);\n        listButton = (ImageButton) findViewById(R.id.listBtn);\n        listButton.setOnClickListener(new OnClickListener() {\n\n            @Override\n            public void onClick(View arg0) {\n\n                setContentView(R.layout.list_view);\n\n            }\n\n        });\n\n    }\n\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to create a new content view, when I press on the last imagebutton in my viewpager. The app crashes whenever I try to add any java to the layouts. For example, I tried to make the background black in java and that caused a crash. So, I used XML. Now I&#8217;m doing something [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3552","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3552"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3552\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}