I made an application where I integrated the tabbed activity. In the tabbed activity I put 3 fragments. Now in the 3rd fragment I put a button and I want when I click on the button it redirects me to a new activity I did. I used an intent as we usually do between activities but it doesn't work. Need help please
use getContext instade of Activity.this. use the below code in your button to redirect from fragment to activity
yourButton.setOnClickListener(view -> {
startActivity(new Intent(getContext(), Your_Activity.class));
});
If the problem is not solved yet, let me know with logcat error.
Related
i tried to open bottomNavitem from fragment with this code on ,it opens bottomnavitem ,on comming back same bottomnavitem it open same fragement while i need to open starting fragment ,using popbackstack removes but it shoes delay bad ui
AppPreference.lastSelectedCoinName = it.replace("/", "")
// findNavController().popBackStack()
(activity as HomeActivity).changeBottomNavItem(2)
Are you using Android Navigation i think it would solve your issue
I am trying to create a popup message in the Backoffice PCM. In particular, from within the editor area of a product. From the editor a user can click on the assortment view or compare view buttons on the side toolbar to change screens (redirect).
I want to give the user a popup to inform them that any changes will be lost.
Any ideas on how to accomplish this?
I have tried to create my own widget and wiring my custom widget to the ootb pcmbackoffice-toolbar but have not been successful.
It's possible to display a simple popup via the ZK framework (the framework used by Backoffice). From the backoffice code you can open a popup like this:
import org.zkoss.zul.Messagebox;
public void someMethod() {
// do some actions...
Messagebox.show("Some Messagetext", "Info", Messagebox.OK, Messagebox.INFO);
}
I want to display winner's name as a second activity when an if condition satisfied in activity one
if(scorep1==50)
{
Intent intent1 = new Intent(MainActivity.this,PlayerOneWin.class);
Mainactivity.this.startActivity(intent1);
}
App crashes when this condition reaches
please answer
Check the Logcat (bottom right in android studio) while the app is running, to know exactly where the app is crashing.
Code looks fine and you don't need to do MainActivity.this.startActivity(intent1); you can just do startActivity(intent1);
Hi everyone I am using eclipse to develop an android app. I have three layouts, namely a main layout and two other layouts linked to the main layout. I have created .xml and .java files for all the pages. My application runs and I can move between my main layout and one of the layouts but when I try to access the other layout the screen just blinks and nothing else happens. I am using bluestacks to test the app. below is the code for the button that is supposed to execute and move between the layouts. Show_Meds.class is the problematic one. What am I doing wrong?
`Button butEnter = (Button)findViewById(R.id.btnEnter);
butEnter.setOnClickListener(new OnClickListener(){
public void onClick(View v){
if ( rEnterMed.isChecked()){
startActivity(new Intent(MainActivity.this, Enter_Meds.class));
}
else if (rShowMed.isChecked()){
startActivity(new Intent (MainActivity.this, Show_Meds.class));
}
}//end of onClick
});`
I do not have an answer for you yet, But please verify these points to find out whats going wrong.
Also, if you are unable to produce favourable results, please post the codes for all your layout.xml files, your manifest files and your Activity.java files.
1- Make sure you have registered your Activities Enter_Meds and Show_Meds to your manifest files.
2- Try replacing the layouts xml file of MainActivity to Enter_Meds and Show_Meds one by one in setContentView. This way, you'll know if the xml view are actually working OK.
3- Inside onClick method, print out the value of v.getId() to verify if the view has been clicked correctly.
I have a single AppBar declared in default.html for use throughout my application.
On some of the pages I need to show the App Bar and in some of the I need to hide the AppBar.
So far, my efforts to find the methods to hide and show the AppBar have met a dead end.
The documentation on MSDN says:
AppBar.hide method :
Hides the app bar on Windows and the secondary command menu on Windows Phone.
So, that method only hides the AppBar for Windows and not for a Windows Phone project.
I have also tried giving display:none as a CSS style, to no effect.
Any help will be appreciated :)
AppBar.Hide hides the secondary command bar on Windows Phone, not the main AppBar. If you want the entire AppBar to go away then this isn't the right property.
The easiest way is to declare the AppBar on pages that you want to show it and to leave it out on pages that you don't want it, but you should be able to hide it by disabling the AppBar on pages that you don't want it on.
I just modified the appbar-commands.js file in the HTML AppBar control sample as follows and the appbar hides and shows as I click the hide and show buttons:
// These functions are used by the scenario to show and hide elements
function doShowItems() {
document.getElementById('commandsAppBar').winControl.disabled = false;
//document.getElementById('commandsAppBar').winControl.showCommands([cmdFavorite, cmdCamera]);
document.getElementById('scenarioShowButtons').disabled = true;
document.getElementById('scenarioHideButtons').disabled = false;
}
function doHideItems() {
document.getElementById('commandsAppBar').winControl.disabled = true;
//document.getElementById('commandsAppBar').winControl.hideCommands([cmdFavorite, cmdCamera]);
document.getElementById('scenarioHideButtons').disabled = true;
document.getElementById('scenarioShowButtons').disabled = false;
}
I also confirmed with the single-page navigation model navigating between two pages. If you aren't seeing the appbar hide and show when disabled and enabled then make sure you are calling the code to disable / enable the appbar. The PageControl's ready function may not be called when returning to a cached page.
You'll have to do it with C#, You can simply just type.. (If your appbar is called ApplicationBar)
ApplicationBar.Visibility = Visibility.Collapsed;
This will instantly hide the AppBar! If you want your HTML Page to perform this action, it will be much complicated.
Cheers
I think you can try below step in your code.
Add a event listener for appbar beforeshow
In code of before show Check a condition with specific page name
Like : if (WinJS.Navigation.location.match("test.html"))
According to you condition you can Disable your appbar.
All the best..!!