Advertisement
Guest User

Untitled

a guest
May 4th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.52 KB | None | 0 0
  1. package com.example.john.fragment;
  2.  
  3. import android.support.v7.app.ActionBarActivity;
  4. import android.os.Bundle;
  5. import android.view.Menu;
  6. import android.view.MenuItem;
  7.  
  8.  
  9. public class MainActivity extends ActionBarActivity implements TopSectionFragment.TopSectionListener{
  10.  
  11.     @Override
  12.     protected void onCreate(Bundle savedInstanceState) {
  13.         super.onCreate(savedInstanceState);
  14.         setContentView(R.layout.activity_main);
  15.     }
  16.  
  17.  
  18.  
  19.     //Anropas av Top Fragment när anv. trycker på knappen i appen.
  20.     @Override
  21.     public void createMeme(String top, String bottom) {
  22.  
  23.         BottomPictureFragment bottomFragment = (BottomPictureFragment)getSupportFragmentManager().findFragmentById(R.id.fragment2);
  24.         bottomFragment.setMemeText(top,bottom);
  25.     }
  26.  
  27.  
  28.    
  29.     @Override
  30.     public boolean onCreateOptionsMenu(Menu menu) {
  31.         // Inflate the menu; this adds items to the action bar if it is present.
  32.         getMenuInflater().inflate(R.menu.menu_main, menu);
  33.         return true;
  34.     }
  35.  
  36.     @Override
  37.     public boolean onOptionsItemSelected(MenuItem item) {
  38.         // Handle action bar item clicks here. The action bar will
  39.         // automatically handle clicks on the Home/Up button, so long
  40.         // as you specify a parent activity in AndroidManifest.xml.
  41.         int id = item.getItemId();
  42.  
  43.         //noinspection SimplifiableIfStatement
  44.         if (id == R.id.action_settings) {
  45.             return true;
  46.         }
  47.  
  48.         return super.onOptionsItemSelected(item);
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement