{"id":4384,"date":"2014-03-30T10:19:58","date_gmt":"2014-03-30T10:19:58","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/the-method-oncreatebundle-is-undefined-for-the-object-type-collection-of-common-programming-errors\/"},"modified":"2014-03-30T10:19:58","modified_gmt":"2014-03-30T10:19:58","slug":"the-method-oncreatebundle-is-undefined-for-the-object-type-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/the-method-oncreatebundle-is-undefined-for-the-object-type-collection-of-common-programming-errors\/","title":{"rendered":"The method onCreate(bundle) is undefined for the object type-Collection of common programming errors"},"content":{"rendered":"<p>@StinePike&#8217;s answers fixes your immediate problem. But you also need to read about Intents. These are basically just a way to send messages. It is an implicit action in that it doesn&#8217;t start something but tells something what to do and how to handle certain data. I say this because I believe you are misled in that you have a function called <code>getIntent()<\/code>. This doesn&#8217;t need to be a function in your class but this is how you receive data if this <code>Activity<\/code> is started with an <code>Intent<\/code>.<\/p>\n<p>Say you start an <code>Activity<\/code> like:<\/p>\n<pre><code>Intent intent = new Intent(MyActivity.this, NextActivity.class);  \/\/ MyActivity is the Activity you are currently in and NextActivity is the Activity you are starting\nintent.putExtra(\"people\", \"Fred\");  \/\/ This isn't necessary but a way to pass data. I put \"Fred\" but this could be a String variable or something else\nstartActivity(intent);\n<\/code><\/pre>\n<p>In <code>NextActivity<\/code> you might do:<\/p>\n<pre><code>@Override\npublic void onCreate(Bundle bundle)\n{\n    Intent recIntent = getIntent();  \/\/ this gets the intent information sent from MyActivity\n    String data = recIntent.getStringExtra(\"people\");  \/\/ data now equals  the String Fred\n}\n<\/code><\/pre>\n<p>no need for you to create a function called <code>getIntent()<\/code>, it is a native function. So when you use <code>getIntent()<\/code> it is a good idea to check for <code>null<\/code> in case this <code>Activity<\/code> wasn&#8217;t started with an <code>Intent<\/code>. Maybe it was the launcher <code>Activity<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>@StinePike&#8217;s answers fixes your immediate problem. But you also need to read about Intents. These are basically just a way to send messages. It is an implicit action in that it doesn&#8217;t start something but tells something what to do and how to handle certain data. I say this because I believe you are misled [&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-4384","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4384","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=4384"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4384\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}