How do I make a 'button click action' on one page open the next in Android studio using Navigation Graphical tool?How do I get a button to open another activity?bufferedReader for URL throws IOExceptionGetting an exception when app startsHow do I make shuffle playlist button and repeat button in android studioMultiple buttons in single page navigating each button to different page in android studiosetText on button from another activity androiddalvikvm: Could not find classAdding Social Media Share Logic From Firebase in AndroidOSMDROID - loading .map file downloaded from mapsforgeActivity can still call unbind service method. Is it normal?java.lang.NullPointerException when invoking onLoadFinished()

Can I travel from Germany to England alone as an unaccompanied minor?

How to securely dispose of a smartphone?

Can European countries bypass the EU and make their own individual trade deal with the U.S.?

Could human civilization live 150 years in a nuclear-powered aircraft carrier colony without resorting to mass killing/ cannibalism?

Copy group of files (Filename*) to backup (Filename*.bak)

Are all commands with an optional argument fragile?

Different budgets within roommate group

Sacrifice blocking creature before damage is dealt no longer working (MtG Arena)?

13th chords on guitar

Are gliders susceptible to bird strikes?

Why do I need two parameters in an HTTP parameter pollution attack?

Can a stressful Wish's Strength reduction be cured early by a Greater Restoration spell?

Sharing referee/AE report online to point out a grievous error in refereeing

How do we separate rules of logic from non-logical constraints?

What is "oversubscription" in Networking?

The warming up game

How can I tell what kind of genitals people have without gender?

Why wasn't ASCII designed with a contiguous alphanumeric character order?

Why is Japan trying to have a better relationship with Iran?

What kind of jet plane is this?

Single level file directory

What will happen if I checked in for another room in the same hotel, but not for the booked one?

How do I tell the reader that my character is autistic in Fantasy?

How is this practical and very old scene shot?



How do I make a 'button click action' on one page open the next in Android studio using Navigation Graphical tool?


How do I get a button to open another activity?bufferedReader for URL throws IOExceptionGetting an exception when app startsHow do I make shuffle playlist button and repeat button in android studioMultiple buttons in single page navigating each button to different page in android studiosetText on button from another activity androiddalvikvm: Could not find classAdding Social Media Share Logic From Firebase in AndroidOSMDROID - loading .map file downloaded from mapsforgeActivity can still call unbind service method. Is it normal?java.lang.NullPointerException when invoking onLoadFinished()






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm new to android studio and Java programming. I'm stuck trying to figure out how the graphical navigation Resource feature is used to link pages visually. I've made 2 pages for my app each with unique names (e.g. Page1 & Page2). I've also been able to link the two pages visually by dragging and dropping the round circle in the Graphic Navigation panel and named the action (e.g. action 1).



I followed the solutions offered in this thread How do I get a button to open another activity in Android Studio? but none of them worked for me.



This is my button's code.



public class MainActivity extends AppCompatActivity 
private Button register_button;

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);


register_button = (Button) findViewById(R.id.action_mainActivity_to_registration);
register_button.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
openRegistrationPage();

);




public void openRegistrationPage ()

Intent intent = new Intent(this, registration.class);
startActivity(intent);




I would want the next page to open a=when one button is clicked.










share|improve this question
























  • your code is correct, does it open new activity?

    – Praveen GM
    Mar 25 at 14:22











  • It doesn't. When I run the app on my phone, and click on the button, the app closes.

    – Mango
    Mar 26 at 7:02











  • Can you share the error log

    – Praveen GM
    Mar 26 at 7:28











  • How do I get that on my phone? I couldn't make an emulator on my PC

    – Mango
    Mar 26 at 8:28











  • while you run the app stay connect via adb you can see the error log on Android Studio in Logcat

    – Praveen GM
    Mar 26 at 11:55

















0















I'm new to android studio and Java programming. I'm stuck trying to figure out how the graphical navigation Resource feature is used to link pages visually. I've made 2 pages for my app each with unique names (e.g. Page1 & Page2). I've also been able to link the two pages visually by dragging and dropping the round circle in the Graphic Navigation panel and named the action (e.g. action 1).



I followed the solutions offered in this thread How do I get a button to open another activity in Android Studio? but none of them worked for me.



This is my button's code.



public class MainActivity extends AppCompatActivity 
private Button register_button;

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);


register_button = (Button) findViewById(R.id.action_mainActivity_to_registration);
register_button.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
openRegistrationPage();

);




public void openRegistrationPage ()

Intent intent = new Intent(this, registration.class);
startActivity(intent);




I would want the next page to open a=when one button is clicked.










share|improve this question
























  • your code is correct, does it open new activity?

    – Praveen GM
    Mar 25 at 14:22











  • It doesn't. When I run the app on my phone, and click on the button, the app closes.

    – Mango
    Mar 26 at 7:02











  • Can you share the error log

    – Praveen GM
    Mar 26 at 7:28











  • How do I get that on my phone? I couldn't make an emulator on my PC

    – Mango
    Mar 26 at 8:28











  • while you run the app stay connect via adb you can see the error log on Android Studio in Logcat

    – Praveen GM
    Mar 26 at 11:55













0












0








0








I'm new to android studio and Java programming. I'm stuck trying to figure out how the graphical navigation Resource feature is used to link pages visually. I've made 2 pages for my app each with unique names (e.g. Page1 & Page2). I've also been able to link the two pages visually by dragging and dropping the round circle in the Graphic Navigation panel and named the action (e.g. action 1).



I followed the solutions offered in this thread How do I get a button to open another activity in Android Studio? but none of them worked for me.



This is my button's code.



public class MainActivity extends AppCompatActivity 
private Button register_button;

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);


register_button = (Button) findViewById(R.id.action_mainActivity_to_registration);
register_button.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
openRegistrationPage();

);




public void openRegistrationPage ()

Intent intent = new Intent(this, registration.class);
startActivity(intent);




I would want the next page to open a=when one button is clicked.










share|improve this question
















I'm new to android studio and Java programming. I'm stuck trying to figure out how the graphical navigation Resource feature is used to link pages visually. I've made 2 pages for my app each with unique names (e.g. Page1 & Page2). I've also been able to link the two pages visually by dragging and dropping the round circle in the Graphic Navigation panel and named the action (e.g. action 1).



I followed the solutions offered in this thread How do I get a button to open another activity in Android Studio? but none of them worked for me.



This is my button's code.



public class MainActivity extends AppCompatActivity 
private Button register_button;

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);


register_button = (Button) findViewById(R.id.action_mainActivity_to_registration);
register_button.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
openRegistrationPage();

);




public void openRegistrationPage ()

Intent intent = new Intent(this, registration.class);
startActivity(intent);




I would want the next page to open a=when one button is clicked.







java android button navigation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 15:21









Zoe

15.9k9 gold badges62 silver badges94 bronze badges




15.9k9 gold badges62 silver badges94 bronze badges










asked Mar 25 at 14:14









MangoMango

12 bronze badges




12 bronze badges












  • your code is correct, does it open new activity?

    – Praveen GM
    Mar 25 at 14:22











  • It doesn't. When I run the app on my phone, and click on the button, the app closes.

    – Mango
    Mar 26 at 7:02











  • Can you share the error log

    – Praveen GM
    Mar 26 at 7:28











  • How do I get that on my phone? I couldn't make an emulator on my PC

    – Mango
    Mar 26 at 8:28











  • while you run the app stay connect via adb you can see the error log on Android Studio in Logcat

    – Praveen GM
    Mar 26 at 11:55

















  • your code is correct, does it open new activity?

    – Praveen GM
    Mar 25 at 14:22











  • It doesn't. When I run the app on my phone, and click on the button, the app closes.

    – Mango
    Mar 26 at 7:02











  • Can you share the error log

    – Praveen GM
    Mar 26 at 7:28











  • How do I get that on my phone? I couldn't make an emulator on my PC

    – Mango
    Mar 26 at 8:28











  • while you run the app stay connect via adb you can see the error log on Android Studio in Logcat

    – Praveen GM
    Mar 26 at 11:55
















your code is correct, does it open new activity?

– Praveen GM
Mar 25 at 14:22





your code is correct, does it open new activity?

– Praveen GM
Mar 25 at 14:22













It doesn't. When I run the app on my phone, and click on the button, the app closes.

– Mango
Mar 26 at 7:02





It doesn't. When I run the app on my phone, and click on the button, the app closes.

– Mango
Mar 26 at 7:02













Can you share the error log

– Praveen GM
Mar 26 at 7:28





Can you share the error log

– Praveen GM
Mar 26 at 7:28













How do I get that on my phone? I couldn't make an emulator on my PC

– Mango
Mar 26 at 8:28





How do I get that on my phone? I couldn't make an emulator on my PC

– Mango
Mar 26 at 8:28













while you run the app stay connect via adb you can see the error log on Android Studio in Logcat

– Praveen GM
Mar 26 at 11:55





while you run the app stay connect via adb you can see the error log on Android Studio in Logcat

– Praveen GM
Mar 26 at 11:55












1 Answer
1






active

oldest

votes


















0














Make sure you declare your activities in Manifest file like this



 <activity android:name=".YOUR_ACTIVITY" />


And in you Button action, make the navigation action like this



 Intent intent = new Intent(YOUR_ACTIVITY_1.this, YOUR_ACTIVITY_2.class);
startActivity(intent);





share|improve this answer























  • My Manifest looks like this. I think the declarations were made just as you've suggested automatically. <activity android:name=".registration" /> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

    – Mango
    Mar 26 at 7:06











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55339829%2fhow-do-i-make-a-button-click-action-on-one-page-open-the-next-in-android-studi%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Make sure you declare your activities in Manifest file like this



 <activity android:name=".YOUR_ACTIVITY" />


And in you Button action, make the navigation action like this



 Intent intent = new Intent(YOUR_ACTIVITY_1.this, YOUR_ACTIVITY_2.class);
startActivity(intent);





share|improve this answer























  • My Manifest looks like this. I think the declarations were made just as you've suggested automatically. <activity android:name=".registration" /> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

    – Mango
    Mar 26 at 7:06
















0














Make sure you declare your activities in Manifest file like this



 <activity android:name=".YOUR_ACTIVITY" />


And in you Button action, make the navigation action like this



 Intent intent = new Intent(YOUR_ACTIVITY_1.this, YOUR_ACTIVITY_2.class);
startActivity(intent);





share|improve this answer























  • My Manifest looks like this. I think the declarations were made just as you've suggested automatically. <activity android:name=".registration" /> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

    – Mango
    Mar 26 at 7:06














0












0








0







Make sure you declare your activities in Manifest file like this



 <activity android:name=".YOUR_ACTIVITY" />


And in you Button action, make the navigation action like this



 Intent intent = new Intent(YOUR_ACTIVITY_1.this, YOUR_ACTIVITY_2.class);
startActivity(intent);





share|improve this answer













Make sure you declare your activities in Manifest file like this



 <activity android:name=".YOUR_ACTIVITY" />


And in you Button action, make the navigation action like this



 Intent intent = new Intent(YOUR_ACTIVITY_1.this, YOUR_ACTIVITY_2.class);
startActivity(intent);






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 25 at 14:23









AmineAmine

1,0851 gold badge4 silver badges15 bronze badges




1,0851 gold badge4 silver badges15 bronze badges












  • My Manifest looks like this. I think the declarations were made just as you've suggested automatically. <activity android:name=".registration" /> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

    – Mango
    Mar 26 at 7:06


















  • My Manifest looks like this. I think the declarations were made just as you've suggested automatically. <activity android:name=".registration" /> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

    – Mango
    Mar 26 at 7:06

















My Manifest looks like this. I think the declarations were made just as you've suggested automatically. <activity android:name=".registration" /> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

– Mango
Mar 26 at 7:06






My Manifest looks like this. I think the declarations were made just as you've suggested automatically. <activity android:name=".registration" /> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

– Mango
Mar 26 at 7:06









Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55339829%2fhow-do-i-make-a-button-click-action-on-one-page-open-the-next-in-android-studi%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript