Comments (9)
first you set theme of aboutActivity is ActionBar.
then use this code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
........
// add back arrow to toolbar
if (getSupportActionBar() != null){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
from android-about-page.
I meet the same question too
from android-about-page.
Hi Guys,
Could you share with me the activity
code you used
Thank you
from android-about-page.
how to add back button for this
from android-about-page.
@OverRide
public void onBackPressed() {
Intent inntent = new Intent(Intent.ACTION_MAIN);
startActivity(setIntent);
}
back press button how? please, if we are able to set onClickListener on Aboutpage , that will be helpful. I have this question also,
from android-about-page.
What does this sentence mean: "first you set theme of aboutActivity is ActionBar."? Is it "set the theme of aboutActivity to ActionBar" or is it a typo and it is "set the theme of aboutActivity in ActionBar"?
If it's the latter how do I get the theme of the aboutActivity (all I have is a working AboutPage object
and I don't see a setTheme for it).
I have this same issue - create an AboutPage (in the options menu) - select it, hit back press and the
app exits. So (2) steps: set the theme then put in the override code. I'm going to put the override code
in and try to figure out the theme after. Thanks. I've tried so many things.
from android-about-page.
I can't make any of this code compile in my app where I have a main activity (fragment), or another fragment. The app is a variation of BluetoothChat and I can't get any of this code to compile no matter where I put it:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
........
// add back arrow to toolbar
if (getSupportActionBar() != null){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
I detail the solution I found below.
from android-about-page.
I figured out a good, easy way to go back. This works for my main activity which extends a FragmentActivity, and AboutPage is presented from the options menu (with the dots).
Basically I thought about it in terms of having a view and displaying it in a new activity. That led me to the basic android dev page Start Another Activity
developer.android.com/training/basics/firstapp/starting-activity
I followed the tutorial but had to change the type of the activity generated from New Empty Activity from AppCompatActivity to FragmentActivity or the tutorial file would not compile. Then I put the straight AboutPage code into this new activity.
The main issue is to not just fire up an AboutPage from an activity but to start a new activity with an intent and do it there. Now the about page goes back to the app (does not exit) and when returning from visiting the web page from the about page, it does not crash.
I think there may be many ways of hosting the about page and even though I tried a lot of things that didn't work it is probably my shallow android experience, rather than AboutPage which is great. Here's the code - first the options menu item:
case R.id.so_about: {
// display the page!
displayAboutPage();
return true;
}
/* Called when the user selects About option */
public void displayAboutPage() {
// Do something in response to button
Intent intent = new Intent(this, DisplayAboutPageActivity.class);
startActivity(intent);
}
Then the activity:
public class DisplayAboutPageActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_about_page);
Element adsElement = new Element();
adsElement.setTitle("Advertise with smartOar");
String version = getResources().getString(R.string.app_version);
View aboutPage = new AboutPage(this)
.setDescription("armonitor is smartOar's real-time force curve feedback system utility product, based on Android")
.isRTL(false)
.addItem(new Element().setTitle(version))
.addGroup("Connect with us")
.addEmail("[email protected]")
.addWebsite("http://www.smartoar.com")
.addYoutube("UC1kgLzMza-NP21jiG8keztQ")
.create();
setContentView(aboutPage);
}
}
from android-about-page.
Use TableLayout and then add the About Page as a view into the TableLayout
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null){
getSupportActionBar().setTitle(getString(R.string.about_sapamacash));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}//E# if statement
tableLayout = (TableLayout) findViewById(R.id.aboutLayout);
String phone = "+254722906835";
View aboutPage = new AboutPage(this)
.isRTL(false)
.setDescription(getString(R.string.about_us_text))
.addEmail("[email protected]")
.addItem(getPhoneElement(phone))
.addWebsite("https://sapamacash.com/")
.addFacebook("sapamatech")
.addTwitter("sapamatech")
.addYoutube("UCV-sIbWJ5HpO0qk6Hp7Sjfw")
.addItem(getCopyRightsElement())
.create();
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
aboutPage.setLayoutParams(params);
tableLayout.addView(aboutPage, 1,params);
}
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".ui.activity.AboutActivity"
android:id="@+id/aboutLayout">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"/>
</com.google.android.material.appbar.AppBarLayout>
</TableLayout>
from android-about-page.
Related Issues (20)
- font HOT 2
- Incorrect image color, iconDrawable is dark HOT 1
- Ads Implementation HOT 1
- Facebook Page: Trouble Loading HOT 2
- Google Play Rating HOT 1
- Possible To Change Image Position ?
- How do I changed the background color of the about page? HOT 3
- Add App Gallery and Galaxy Store HOT 2
- Can't Implement Image as Web link HOT 3
- Auto night mode support HOT 2
- toolbar
- Email icon isn't visible in dark mode HOT 7
- About Page android
- Font is not use by typeface
- Impact of jCenter EOL HOT 1
- iOS About Page
- Not able to load external image HOT 2
- Add Phone Element Suggestion
- Strezless
- I would like you to add LinkedIn and whatsapp HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-about-page.