On android device 4.0.1 I am trying to build application with ActionBar but getting the NullPointException. I have tried the following solutions:
Adding Theme Theme.Holo.Light to the application theme.
In OnCreate of Activity, setting ActionBar feature before setContentView as requestWindowFeature(Window.FEATURE_ACTION_BAR).
Used SherlockActivity and called getSupportActionBar()
But no luck. In all methods, I am getting null ActionBar. Can anyone please point me out what is the issue. I am pasting Activity and AndroidManifest.xml here.
AndroidManifest.xml
<code>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tzoomers.birthdaysdiary"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Holo.Light">
<activity
android:name="com.tzoomers.birthdaysdiary.BirthdaysDiary"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ContentActivity">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".SyncActivity">
</activity>
</application>
</manifest>
</code>
SyncActivity.java
<code>
public class SyncActivity extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
setContentView(R.layout.layout_sync_activity);
ActionBar actionBar = getActionBar();
if(actionBar != null)
{
getActionBar().setDisplayHomeAsUpEnabled(false);
}
else
{
Toast.makeText(this, "Action bar is null", Toast.LENGTH_SHORT).show();
}
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
return super.onOptionsItemSelected(item);
}
}
Please help what can be exact issue instead of pointing urls. I have tried all the solutions. If I am missing something in XML or JAVA files please point that.
Thanks in advance.
I JUST solved this problem myself, with the new updates its a bit tricky and some of the old fixes don't work as well anymore. Try this:
set your MainActivity Java code to extend ActionBarActivity
use getSupportAcionBar(); call to retrieve your action bar
Be sure your (custom) TabListener extends android.support.v7.app.ActionBar.TabListener
you can use FragmentManager to add and remove tab Fragments when tabs are selected and unselected.
Here's some of my code snippets to help illustrate, hope it works for you too :)
public class MainActivity extends ActionBarActivity
{
#Override
protected void onCreate(Bundle savedInstanceState) //Overrode Default Constructor
{
super.onCreate(savedInstanceState);
android.support.v7.app.ActionBar tabsActionBar = getSupportActionBar();
/***following changes ActionBar to a Tabbed ActionBar***/
tabsActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);`
android.support.v7.app.ActionBar.Tab tabArray = tabsActionBar.newTab();to later contain 'inflated' digitalClock (tabbed) UI
tabArray.setText(R.string.tab_one);
/***following sets clockTabListener private class as Listener for
* this object***/
tabArray.setTabListener( new clockTabListener( this, digitalClockFragment.class.getName() ) );//actual call to digitalClockFragment
tabsActionBar.addTab(tabArray);//adds TabArray to Action Bar Tab(s)
/******Second call for setting New Tab to AnalogClockFragment******/
tabArray = tabsActionBar.newTab();
tabArray.setText(R.string.tab_two);
tabArray.setTabListener( new clockTabListener( this, analogClockFragment.class.getName() ) );//actual call to analogClockFragment
tabsActionBar.addTab(tabArray);
private class clockTabListener implements android.support.v7.app.ActionBar.TabListener
{
private final Activity currentActivity;
private final String currentFragment;
private Fragment launchFragment;
private android.app.FragmentManager frgManager;
public clockTabListener(Activity activityName, String fragmentName)
{
currentActivity = activityName;
currentFragment = fragmentName;
frgManager = getFragmentManager();
}
/******************************************************************/
/******************************************************************/
/******************************************************************/
#Override
public void onTabSelected(android.support.v7.app.ActionBar.Tab arg0,
android.support.v4.app.FragmentTransaction arg1)
{
launchFragment = Fragment.instantiate(currentActivity, currentFragment);
frgManager.beginTransaction().replace(android.R.id.content, launchFragment).commit();
}
Related
Sorry, I am new to android apps. creation. I have referred pretty much all solutions but this just doesn't work...and I don't see any problem in below simple-code. My app is simple, Load the splash screen, then load the webview. What is the problem below?
ERROR I get is:
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.wwes.EZEE/com.wwes.EZEE.SecondPage}; have you declared this activity in your Manifext.xml
[COMMENT] Pls. Look below, I have already declared it. what's wrong?
Files are:
MainActivity.java: Here I load the splashscreen image.
package com.example.EZEE;
import com.wwes.EZEE.SecondPage;
public class MainActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Thread for displaying the Splash Screen //
Thread splash_screen = new Thread() {
public void run() {
try {
sleep(1000);
} catch (Exception e){
e.printStackTrace();
} finally {
Intent i = new Intent(MainActivity.this, SecondPage.class);
startActivity(i);
}
}
}; splash_screen.start();
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
SecondPage.java: This loads the webview.
package com.wwes.EZEE;
public class SecondPage extends Activity {
WebView browserView;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Removed the title bare in the Application //
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_second_page);
// Creation of the Webview found in the XML Layout file //
browserView = (WebView)findViewById(R.id.webView1);
// Enable Javascripts //
browserView.getSettings().setJavaScriptEnabled(true);
browserView.getSettings()....
browserView.getSettings()....
browserView.getSettings()....
browserView.getSettings().setLoadsImagesAutomatically(true);
// Removed both vertical and horizontal scroll bars //
browserView.setVerticalScrollBarEnabled(false);
browserView.setHorizontalScrollBarEnabled(false);
browserView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
// Webview Wrap //
browserView.loadUrl("http://www.ABCDE.com");
browserView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
public void onBackPressed()
{ if(browserView.canGoBack())
browserView.goBack();
else super.onBackPressed(); }
}
activity_main.xml:
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#800808"
android:scaleType="fitStart"
android:visibility="visible"
android:src="#drawable/logo" />
4) activity_second_page.xml:
<WebView
android:id="#+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:visibility="gone"
android:layout_alignParentTop="true" />
5) manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wwes.EZEE"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />
----------------------------------updated----------------------------------
<application
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.wwes.EZEERACKS.MainActivity" //// UPDATED ///
android:configChanges="keyboard|keyboardHidden|orientation|smallestScreenSize"
android:screenOrientation="portrait"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.wwes.EZEE.SecondPage"
android:label="#string/title_activity_second_page" >
</activity>
</application>
</manifest>
Thanks for the help!
you must defin your activity in manifest.xml file
<activity android:name=".SecondPage"
android:label="#string/title_activity_second_page" >
</activity>
You don't need the <intent-filter> tag in the SecondPage tag of the manifest because you are already starting the activity from MainActivity.
So, remove this:
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
from this:
<activity
android:name="com.wwes.EZEE.SecondPage"
android:label="#string/title_activity_second_page" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
how come your main activity is com.example.EZEE.MainActivity while secondPage is com.wwes.EZEE.SecondPage? I would check if both resides on the same package.
I bet if you have changed the secondPage name to com.example.EZEE.SecondPage it will work.
if it didn't work I would remove the android:name of both activity and within the "", click ctrl + space and let the eclipse handle putting the naming to the activity. therefore the shown activities are guaranteed to work in the application.
Hope this works with you, please give me a feedback.
Just change your defination of .SecondPage to the following in manifest.xml file
<activity android:name="com.wwes.EZEE.SecondPage"
android:label="#string/title_activity_second_page" >
</activity>
I have 2 projects, and I want to embed a project in other. I have created 2 projects and have made a project as library file and inserted in other but I am still unable to get it working. I have taken a simple activity and want to display a toast message, using Intent I have given the address of the next project library. This is the code of the main (first) project.
public class MainActivity extends Activity {
public final static String EXTRA_MESSAGE = "com.example.sec_pro";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b = (Button)findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "First Activity", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(MainActivity.this, com.example.sec_pro.MainActivity.class);
EditText editText = (EditText) findViewById(R.id.editText1);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
Manifest file
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.integrate.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.sec_pro.MainActivity" >
</activity>
</application>
Now this "sec_pro" is the library file of my next project which I have inserted in the first project.
Please help.
Thanks in advance.
I think you have missed to declare your library activity in Manifest.
try this code to declare in to manifest under application tag:
<activity android:name="PackageName.YourLibraryActivity" />
Please check onClick method again, I think you missed a statement:
startActivity(intent);
I want to make the main activity which have some buttons ,how can i jump from activity to another one . Why when i pressed the button he said : Unfortunately , mynameapp has stopped
This work properly :
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
BlackPixel blackPixel;
blackPixel = new BlackPixel(this);
setContentView(blackPixel);
blackPixel.requestFocus();
});
}
Why this don't work ?:
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// BlackPixel blackPixel;
// blackPixel = new BlackPixel(this);
// setContentView(blackPixel);
// blackPixel.requestFocus();
Button buttonSave=(Button)findViewById(R.id.buttonDraw);
buttonSave.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent(MainActivity.this,ButtonDraw.class));
}
});
}
Here is the buttonDraw class :
public class ButtonDraw extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
BlackPixel blackPixel;
blackPixel = new BlackPixel(this);
setContentView(blackPixel);
blackPixel.requestFocus();
}
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:launchMode="singleInstance"
>
<activity
android:name="com.example.myfirstapp.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.buttons.ButtonDraw"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.buttonDraw" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
1- yes you can go to another Activity by
startActivity(new Intent(MainActivity.this,ButtonDraw.class));
2- Yes you can close your Activity with following code after above code:
this.finish();
for the learning about activity use this link and this
You can write the following line in of Androidmanifest.xml:-
android:launchMode="singleInstance"
then you don't need to write finish() every time
I am in the final stages of a Cocos2d - Android game and I am having a problem that I can't figure out.
When I lock my tablet (Nexus 7) or when I hit the home button to leave the game, it restarts. It goes right back to the splash screen like the game is opening all over again. For your reference, here is my Main Activity and my Android Manifest:
public class MainActivity extends Activity {
//To get a static reference to context for shared preferences
private static Context context;
protected CCGLSurfaceView _glSurfaceView;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//To get a static reference to context for shared preferences
MainActivity.context = getApplicationContext();
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
_glSurfaceView = new CCGLSurfaceView(this);
setContentView(_glSurfaceView);
}
//To get a static reference to context for shared preferences
public static Context getAppContext(){
return MainActivity.context;
}
#Override
public void onStart()
{
super.onStart();
CCDirector.sharedDirector().attachInView(_glSurfaceView);
CCDirector.sharedDirector().setDeviceOrientation(CCDirector.kCCDeviceOrientationPortrait);
CCDirector.sharedDirector().setDisplayFPS(true);
CCDirector.sharedDirector().setAnimationInterval(1.0f / 60.0f);
CCScene scene = Splash.scene();
CCDirector.sharedDirector().runWithScene(scene);
}
#Override
public void onPause()
{
super.onPause();
CCDirector.sharedDirector().pause();
SoundEngine.sharedEngine().pauseSound();
}
#Override
public void onResume()
{
super.onResume();
CCDirector.sharedDirector().resume();
SoundEngine.sharedEngine().resumeSound();
}
#Override
public void onStop()
{
super.onStop();
SoundEngine.sharedEngine().pauseSound();
}
and
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="bigfiresoftware.alphadefender"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/adicon"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="bigfiresoftware.alphadefender.MainActivity"
android:screenOrientation="portrait"
android:label="#string/app_name"
android:hardwareAccelerated="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
android:configChanges="keyboard|keyboardHidden|orientation"
</manifest>
Any/all help is very much appreciated. Thanks.
add below line in your manifest file to your activity.
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
when you locked the screen the orientation of your screen changes.So that your activity destroys and again it creates.If you ad this line your orientation will not change.
The answers above didn't fix it but I finally found the answer. This was a tough one.
If anyone else finds this problem:
Remove the targetSdkVersion in AdnroidManifest.xml. Or change to some others, I haven't tried others but removal worked.
android:minSdkVersion="9"
android:targetSdkVersion="17" /> //git rid of this guy
add this line in your onstop() method
CCDirector.sharedDirector().end();
and you need to write an onDestroy() method to remove all the instances when you close the game.
I am using
Window w = getWindow();
w.setTitle("My title");
to change title of my current Activity but it does not seem to work.
Can anyone guide me on how to change this?
Try setTitle by itself, like this:
setTitle("Hello StackOverflow");
Just an FYI, you can optionally do it from the XML.
In the AndroidManifest.xml, you can set it with
android:label="My Activity Title"
Or
android:label="#string/my_activity_label"
Example:
<activity
android:name=".Splash"
android:label="#string/splash_activity_title" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
If you want it one time & let system handle the rest (not dynamic) then do like this in your manifest file:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name_full" > //This is my custom title name on activity. <- The question is about this one.
<intent-filter android:label="#string/app_launcher_name" > //This is my custom Icon title name (launcher name that you see in android apps/homescreen)
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
setTitle(getResources().getText(R.string.MyTitle));
There's a faster way, just use
YourActivity.setTitle("New Title");
You can also find it inside the onCreate() with this, for example:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
this.setTitle("My Title");
}
By the way, what you simply cannot do is call setTitle() in a static way without passing any Activity object.
This worked for me.
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment, container, false);
getActivity().setTitle("My Title");
//...
}
If you have multiple activities, you can set it like this in AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".NumbersActivity"
android:label="#string/category_numbers"
android:theme="#style/category_numbers" />
<activity
android:name=".FamilyActivity"
android:label="#string/category_family"
android:theme="#style/category_family" />
<activity
android:name=".ColorsActivity"
android:label="#string/category_colors"
android:theme="#style/category_colors" />
<activity
android:name=".PhrasesActivity"
android:label="#string/category_phrases"
android:theme="#style/category_phrases" />
<activity
android:name=".ExperimentActivity"
android:label="#string/category_experiment"
android:theme="#style/category_experiment" />
</application>
I'm using Android Studio 3.0.1.
WIth an Activity:
setTitle("Title Text");
Inside a fragment:
getActivity().setTitle("Title Text");
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.Main_Activity);
this.setTitle("Title name");
}
If you want to set title in Java file, then write in your activity onCreate
setTitle("Your Title");
if you want to in Manifest then write
<activity
android:name=".MainActivity"
android:label="Your Title" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In Kotlin, this way:
this.title = resources.getText(R.string.fast_learning)
I have a Toolbar in my Activity and a Base Activity that overrides all Titles. So I had to use setTitle in onResume() in the Activity like so:
#Override
protected void onResume() {
super.onResume();
toolbar.setTitle(R.string.title);
}
The code helped me change the title.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_name);
ActivityName.this.setTitle("Your Activity Title");}
Inside a MainActivity:
public class act1 extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act1);
setTitle("First Activity");
}
}
setTitle("Whatever apps");
in MainActivity.java is simplier
I would say.
If you want to change Title of activity when you change activity by clicking on the Button. Declare the necessary variables in MainActivity:
private static final String TITLE_SIGN = "title_sign";
ImageButton mAriesButton;
Add onClickListener in onCreate() and make new intent for another activity:
mTitleButton = (ImageButton) findViewById(R.id.title_button);
mTitleButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this,
SignActivity.class);
String title_act = getText(R.string.simple_text).toString();
intent.putExtra("title_act", title_act);
startActivity(intent);
finish();
}
});
SecondActivity code in onCreate():
String txtTitle = getIntent().getStringExtra("title_act");
this.setTitle(txtTitle);
If you're using onCreateOptionsMenu, you can also add setTitle code in onCreateOptionsMenu.
#Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
setTitle("Neue Aktivität");
return true;
}
setTitle("Welcome Activity");