Exemple #1
0
  protected void buildMultiPic(final GridLayout gridLayout) {
    gridLayout.setVisibility(View.VISIBLE);
    // 获取当前屏幕尺寸
    DisplayMetrics metrics = new DisplayMetrics();
    WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    windowManager.getDefaultDisplay().getMetrics(metrics);
    // 设置图片的宽度和高度
    int picWidth = metrics.widthPixels / 3 - 48;

    for (int i = 0; i < 9; i++) {
      // 获取View
      SimpleDraweeView simpleDraweeView = (SimpleDraweeView) gridLayout.getChildAt(i);
      // 设置布局参数
      GridLayout.LayoutParams layoutParams = new GridLayout.LayoutParams();
      layoutParams.width = picWidth;
      layoutParams.height = picWidth;
      layoutParams.setMargins(8, 8, 8, 8);
      simpleDraweeView.setLayoutParams(layoutParams);
      // 设置图片数据源
      simpleDraweeView.setImageURI(Uri.parse(Image.imageThumbUrls[i]));
      // 准备传递数据
      final ImageViewPageMessage imageViewPageMessage =
          new ImageViewPageMessage(Image.imageThumbUrls, i);
      simpleDraweeView.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              EventBus.getDefault().postSticky(imageViewPageMessage);
              Intent intent = new Intent(mContext, ImageViewPagerActivity.class);
              mContext.startActivity(intent);
            }
          });
    }
  }
  public void playAgain(View view) {
    winningLayout.setTranslationX(-1000f);
    player = 0;
    for (int i = 0; i < 9; i++) {
      spots[i] = 2;
    }
    gameIsActive = true;
    GridLayout gridLayout = (GridLayout) findViewById(R.id.grid);
    for (int i = 0; i < gridLayout.getChildCount(); i++) {

      ((ImageView) gridLayout.getChildAt(i)).setImageResource(0);
    }
  }
  public CellButton[] getallcells() {
    int l = 0;
    liCellBut = new CellButton[board.getChildCount()];
    for (int i = 0; i <= board.getChildCount(); i++) {
      View tmpView = (View) board.getChildAt(i);
      // Toast.makeText(getActivity(),tmpView.getClass().getName(),Toast.LENGTH_SHORT).show();
      if (tmpView instanceof CellButton) {

        // Toast.makeText(getActivity(),"CellButt",Toast.LENGTH_SHORT).show();
        liCellBut[l] = (CellButton) tmpView;
        l++;
      }
    }

    return liCellBut;
  }
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    cardWidth = (Math.min(w, h) - 10) / 4;

    addCardView();
  }
 /*
  * M: For CR ALPS00333114
  *
  * We need update updateStatusLines when dialog dismiss
  * which is in font of lock screen.
  *
  * @see android.view.View#onWindowFocusChanged(boolean)
  */
 @Override
 public void onWindowFocusChanged(boolean hasWindowFocus) {
   super.onWindowFocusChanged(hasWindowFocus);
   if (hasWindowFocus) {
     refresh();
   }
 }
 @Override
 protected void onDetachedFromWindow() {
   super.onDetachedFromWindow();
   KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mInfoCallback);
   /// M: Unregister the phone listener for dual clock
   mDualClock.resetPhonelistener();
 }
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();
    mDualClock.createClockView(getContext(), this);

    mAlarmStatusView = (TextView) findViewById(R.id.alarm_status);
    mDateView = (TextClock) findViewById(R.id.date_view);
    mClockView = (ClockView) findViewById(R.id.clock_view);
    mLockPatternUtils = new LockPatternUtils(getContext());
    final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn();
    setEnableMarquee(screenOn);

    /// M: For loading the mediatek resource and avoid changing a lot. @{
    if (mDateView == null) {
      KeyguardUtils.xlogD(TAG, "onFinishInflate mDateView == null");
      mDateView = (TextClock) findViewById(R.id.date_view);
    }
    if (mAlarmStatusView == null) {
      KeyguardUtils.xlogD(TAG, "onFinishInflate mAlarmStatusView == null");
      mAlarmStatusView = (TextView) findViewById(R.id.alarm_status);
    }
    if (mClockView == null) {
      KeyguardUtils.xlogD(TAG, "onFinishInflate mClockView == null");
      mClockView = (ClockView) findViewById(R.id.clock_view);
    }
    /// @}

    KeyguardUtils.xlogD(TAG, "onFinishInflate --before-- new LockPatternUtils(getContext())");
    mLockPatternUtils = new LockPatternUtils(getContext());

    KeyguardUtils.xlogD(TAG, "onFinishInflate --before-- refresh()");
    refresh();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_grid);

    this.layout = (GridLayout) findViewById(R.id.activity_grid_root);
    for (int i = 0; i < chars.length; i++) {
      Button btn = new Button(this);
      btn.setText(chars[i]);
      btn.setTextSize(40);
      btn.setPadding(5, 35, 5, 35);
      GridLayout.Spec row = GridLayout.spec(i / 4 + 2);
      GridLayout.Spec col = GridLayout.spec(i % 4);
      GridLayout.LayoutParams param = new GridLayout.LayoutParams(row, col);
      param.setGravity(Gravity.FILL);
      this.layout.addView(btn, param);
    }
  }
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
   // PagedView currently has issues with different-sized pages since it calculates the
   // offset of each page to scroll to before it updates the actual size of each page
   // (which can change depending on the content if the contents aren't a fixed size).
   // We work around this by having a minimum size on each widget page).
   int widthSpecSize = Math.min(getSuggestedMinimumWidth(), MeasureSpec.getSize(widthMeasureSpec));
   int widthSpecMode = MeasureSpec.EXACTLY;
   super.onMeasure(MeasureSpec.makeMeasureSpec(widthSpecSize, widthSpecMode), heightMeasureSpec);
 }
  public void setAttributes(View view) {
    GridLayout viewParent = (GridLayout) view.getParent();
    GridLayout.Spec spec =
        GridLayout.spec(
            getStart(), getSpan(), getAlignment(viewParent, layout_gravity, isHorizontal()));

    GridLayout.LayoutParams params = (GridLayout.LayoutParams) view.getLayoutParams();
    setSpec(params, spec);
  }
  public void addDrink(View v) {

    // set up dialog
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.dialog_consumptie);
    dialog.setTitle("");
    dialog.setCancelable(true);
    // there are a lot of settings, for dialog, check them all out!

    int kosten = 0;
    switch (v.getId()) {
      case R.id.OnePaultje:
        kosten = 1;
        break;
      case R.id.TwoPaultje:
        kosten = 2;
        break;
      case R.id.ThreePaultje:
        kosten = 3;
        break;
    }
    GridLayout grid = (GridLayout) dialog.findViewById(R.id.gridLayout);
    for (Consumptie c : consumpties) {
      if (c.getKosten() == kosten) {
        Button b = new Button(dialog.getContext());
        b.setText(c.getNaam());
        b.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                dialog.cancel();
                Button but = (Button) v;
                addToList(but.getText().toString());
              }
            });
        grid.addView(b);
      }
    }
    dialog.show();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(com.polarion.starter.R.layout.activity_agenda_details);

    // setup the Toolbar
    mToolbar = (Toolbar) findViewById(com.polarion.starter.R.id.toolbar);
    if (mToolbar != null) {
      mToolbar.setTitle("Session Details");
      setSupportActionBar(mToolbar);
    }
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    // get the selected Agenda Item stored in Application
    StarterApplication myApp = (StarterApplication) getApplication();
    mItem = myApp.getSelectedAgendaItem();
    TextView sessionTime = (TextView) findViewById(com.polarion.starter.R.id.sessionTime);
    sessionTime.setText(mItem.getDisplayTime());
    TextView descriptionView =
        (TextView) findViewById(com.polarion.starter.R.id.sessionDescription);
    descriptionView.setText(mItem.getDescription());
    TextView sessionName = (TextView) findViewById(com.polarion.starter.R.id.sessionName);
    sessionName.setText(mItem.getSessionName());
    TextView speakerView = (TextView) findViewById(com.polarion.starter.R.id.presenter);
    speakerView.setText(mItem.getSpeaker());
    final RatingBar contentBar = (RatingBar) findViewById(com.polarion.starter.R.id.contentBarGrid);
    final RatingBar presenterBar =
        (RatingBar) findViewById(com.polarion.starter.R.id.presenterBarGrid);
    mRateButton = (Button) findViewById(com.polarion.starter.R.id.rateButton);
    mRateButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            ParseObject sessionRating = new ParseObject("SessionRating");
            float contentRating = contentBar.getRating(),
                presenterRating = presenterBar.getRating();
            sessionRating.put("contentRating", contentRating);
            sessionRating.put("presenterRating", presenterRating);
            if (ParseUser.getCurrentUser() != null)
              sessionRating.put("user", ParseUser.getCurrentUser());
            sessionRating.put("session", mItem);
            sessionRating.saveEventually();
            finish(); // when done rating close the Agenda Details
          }
        });
    Boolean isRateable = mItem.isRateable();
    if (!isRateable) {
      mRateButton.setVisibility(View.INVISIBLE);
      mRatingLayout = (GridLayout) findViewById(com.polarion.starter.R.id.ratingGridLayout);
      mRatingLayout.setVisibility(View.INVISIBLE);
    }
  }
  private void showInvitations() {

    GridLayout.Spec row;
    GridLayout.Spec column;
    GridLayout.LayoutParams params;

    for (Invitation i : invitations) {

      final TextView tempText = new TextView(getApplicationContext());
      tempText.setText(i.getNomFoyer());
      tempText.setTextSize(18);
      row = GridLayout.spec(mainLayout.getRowCount());
      column = GridLayout.spec(0);
      params = new GridLayout.LayoutParams(row, column);
      params.setGravity(Gravity.FILL_HORIZONTAL);
      tempText.setLayoutParams(params);
      mainLayout.addView(tempText);

      Button tempAcceptButton =
          new Button(getApplicationContext(), null, android.R.attr.buttonStyleSmall);
      tempAcceptButton.setText(R.string.show_invitations_accept);
      column = GridLayout.spec(1);
      params = new GridLayout.LayoutParams(row, column);
      tempAcceptButton.setLayoutParams(params);
      tempAcceptButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              accept(tempText.getText().toString(), mainLayout.getFocusedChild());
            }
          });
      mainLayout.addView(tempAcceptButton);

      Button tempRefuseButton =
          new Button(getApplicationContext(), null, android.R.attr.buttonStyleSmall);
      tempRefuseButton.setText(R.string.show_invitations_refuse);
      column = GridLayout.spec(2);
      params = new GridLayout.LayoutParams(row, column);
      tempRefuseButton.setLayoutParams(params);
      tempRefuseButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              refuse(tempText.getText().toString(), mainLayout.getFocusedChild());
            }
          });
      mainLayout.addView(tempRefuseButton);
    }
  }
Exemple #14
0
  public void PlayAgain(View view) {

    LinearLayout layout = (LinearLayout) findViewById(R.id.winnerlayout);

    layout.setVisibility(view.INVISIBLE);
    // this.gameState = {2,2,2,2,2,2,2,2,2};

    // 0 = Yellow and 1 = Red;
    activePlayer = 0;
    // 2 means unplayed.

    for (int i = 0; i < gameState.length; i++) {
      gameState[i] = 2;
    }

    // reset the state of the images
    GridLayout gridLayout = (GridLayout) findViewById(R.id.gridLayout);

    for (int i = 0; i < gridLayout.getChildCount(); i++) {

      ((ImageView) gridLayout.getChildAt(i)).setImageResource(0);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    characters = new ArrayList<CharTextView>();
    mainLayout = new LinearLayout(this);
    setContentView(mainLayout);
    mainLayout.setOrientation(LinearLayout.VERTICAL);
    mainLayout.setId(442);
    grid = new GridLayout(this);
    GridLayout.LayoutParams gridParams =
        new GridLayout.LayoutParams(GridLayout.spec(3), GridLayout.spec(7));
    grid.setId(444);
    int counter = 0;
    for (int i = 0; i < 7; ++i) {
      for (int j = 0; j < 2; ++j) {
        CharTextView iv = new CharTextView(this);
        Bitmap joeAvatar = BitmapFactory.decodeResource(getResources(), R.drawable.joe);
        Character joe = new Character(joeAvatar, "Joe Nash", 24, "United Kingdom");
        iv.setCharacterCell(joe);
        iv.setId(50 + counter);
        GridLayout.LayoutParams buttonparams =
            new GridLayout.LayoutParams(GridLayout.spec(j), GridLayout.spec(i));
        buttonparams.height = 200;
        buttonparams.width = 150;
        iv.setOnClickListener(this);
        grid.addView(iv, buttonparams);
        characters.add(iv);
        counter++;
      }
    }

    heroLayout = new FrameLayout(this);
    heroLayout.setId(443);
    FrameLayout.LayoutParams frameParams =
        new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    frameParams.height = 600;
    ImageView portrait = new ImageView(this);
    portrait.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.joenash));
    heroLayout.addView(portrait);

    Button fightButton = new Button(this);
    fightButton.setText(R.string.fight);
    ViewGroup.LayoutParams buttonParams =
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    buttonParams.height = 150;
    buttonParams.width = 650;

    mainLayout.addView(heroLayout, frameParams);
    mainLayout.addView(grid, gridParams);
    mainLayout.addView(fightButton, buttonParams);
    // znameto
    //        heroLayout.setBackground();
    // String variable = "variable"
    // int Button = getResources().getIdentifier(variable, "drawable", getPackageName());
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_upload_matrix);

    super.onCreate(savedInstanceState);

    activity = this;

    mtxDAO = new LedMatrixDAO(this);

    final Intent intent = getIntent();
    currMatrix = intent.getParcelableExtra(EXTRAS_LED_MATRIX);
    if (currMatrix == null) {
      currMatrix = mtxDAO.getDummyLedMatrix();
    }

    GridLayout grid = (GridLayout) findViewById(R.id.gridLayout);
    String ledColorsStr = currMatrix.getMatrix();
    if (ledColorsStr == null) {
      ledColorsStr = LedMatrixDAO.MTX_BLANK;
    }

    assert (ledColorsStr.length() == MATRIX_NN);

    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    int btnWidth = (displaymetrics.widthPixels - 50) / MATRIX_N - 4;
    Log.v(TAG, "btnWidth = " + btnWidth);

    char _c;
    int _ci;
    LedButton btn;
    for (int i = 0; i < MATRIX_NN; i++) {
      _c = ledColorsStr.charAt(i);
      _ci = Integer.valueOf("" + _c);

      ledColors.add(_ci);

      btn = new LedButton(this);
      btn.setColorIndex(_ci);
      ledButtons.add(btn);

      btn.setMinimumWidth(btnWidth);
      btn.setMinimumHeight(btnWidth);
      btn.setMaxWidth(btnWidth);
      btn.setMaxHeight(btnWidth);

      btn.setOnClickListener(onLedBtnClickListener);
      btn.setOnLongClickListener(onLedBtnLongClickListener);

      grid.addView(btn);
    }

    // Sets up UI references.
    mConnectionState = (TextView) findViewById(R.id.connection_state);
    // is serial present?
    isSerial = (TextView) findViewById(R.id.isSerial);

    switchDraw = (Switch) findViewById(R.id.switchDraw);
    switchDraw.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            updateMatrixInfo(currMatrix);
            if (isChecked) {
              drawMode = true;
              sendMessage("B:" + currMatrix.getMatrix() + "\n");
            } else {
              drawMode = false;
            }
          }
        });

    returnText = (TextView) findViewById(R.id.textReturn);

    buttonSave = (Button) findViewById(R.id.saveButton);
    buttonDelete = (Button) findViewById(R.id.deleteButton);
    buttonSend = (Button) findViewById(R.id.sendButton);

    buttonSave.setOnClickListener(onClickListener);
    buttonDelete.setOnClickListener(onClickListener);
    buttonSend.setOnClickListener(onClickListener);

    infoButton = (ImageView) findViewById(R.id.infoImage);
    infoButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            iascDialog();
          }
        });

    getActionBar().setTitle(getString(R.string.title_image) + ":" + currMatrix.getName());
    getActionBar().setDisplayHomeAsUpEnabled(true);

    Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
    bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);

    toastMessage(getString(R.string.opt_info));
  }
 @Override
 protected void onAttachedToWindow() {
   super.onAttachedToWindow();
   KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mInfoCallback);
 }
 @Override
 protected void onLayout(boolean changed, int l, int t, int r, int b) {
   super.onLayout(changed, l, t, r, b);
   mDualClock.updateClockLayout();
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mainView = (GridLayout) findViewById(R.id.mainGridLayoutId);

    billEditText = (EditText) findViewById(R.id.billEditText);

    noOfPeopleTextView = (TextView) findViewById(R.id.noOfPeopleTextView);
    customTipTextView = (TextView) findViewById(R.id.customTipTextView);

    tipDownButton = (CustomButton) findViewById(R.id.tipDownButtonId);
    tipDownButton.setOnClickListener(new UpDownButtonListener());
    tipDownButton.setOnTouchListener(new UpDownTouchListener());
    tipDownButton.setOnLongClickListener(new UpDownLongClickListener());

    tipUpButton = (CustomButton) findViewById(R.id.tipUpButtonId);
    tipUpButton.setOnClickListener(new UpDownButtonListener());
    tipUpButton.setOnTouchListener(new UpDownTouchListener());
    tipUpButton.setOnLongClickListener(new UpDownLongClickListener());

    noOfPeopleDownButton = (CustomButton) findViewById(R.id.noOfPeopleDownButtonId);
    noOfPeopleDownButton.setOnClickListener(new UpDownButtonListener());
    noOfPeopleDownButton.setOnTouchListener(new UpDownTouchListener());
    noOfPeopleDownButton.setOnLongClickListener(new UpDownLongClickListener());

    noOfPeopleUpButton = (CustomButton) findViewById(R.id.noOfPeopleUpButtonId);
    noOfPeopleUpButton.setOnClickListener(new UpDownButtonListener());
    noOfPeopleUpButton.setOnTouchListener(new UpDownTouchListener());
    noOfPeopleUpButton.setOnLongClickListener(new UpDownLongClickListener());

    finalTipEditText = (EditText) findViewById(R.id.finalTipEditText);
    finalTotalEditText = (EditText) findViewById(R.id.finalTotalEditText);

    perPersonAmountEditText = (EditText) findViewById(R.id.perPersonEditText);

    billEditText.addTextChangedListener(new BillTotalTextWatchListener());

    mainView.setOnTouchListener(new TouchListener());

    billEditText.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {
          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
              getWindow()
                  .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
            }
          }
        });

    roundSwitch = (Switch) findViewById(R.id.togglebutton);

    SharedPreferences preferences = getPreferences(MODE_PRIVATE);
    if (preferences.contains(TIP_PREF)) {
      customTipValue = preferences.getInt(TIP_PREF, 15);
    }
    customTipTextView.setText(customTipValue + "");
    if (preferences.contains(ROUND_PREF)) {
      roundTotal = preferences.getBoolean(ROUND_PREF, false);
      roundSwitch.setChecked(roundTotal);
    }

    hideCursor = (LinearLayout) findViewById(R.id.focusId);

    // Create an ad.
    //        adView = new AdView(this);
    //        adView.setAdSize(AdSize.SMART_BANNER);
    //        adView.setAdUnitId(AD_UNIT_ID);
    //
    //        LinearLayout layout = (LinearLayout) findViewById(R.id.linearLayoutId);
    //        layout.addView(adView);
    //
    //        // Create an ad request. Check logcat output for the hashed device ID to
    //        // get test ads on a physical device.
    //        AdRequest adRequest = new AdRequest.Builder()
    //                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
    //                .addTestDevice("INSERT_YOUR_HASHED_DEVICE_ID_HERE")
    //                .build();
    //
    //        // Start loading the ad in the background.
    //        adView.loadAd(adRequest);

    // saveTestData();
    //        try {
    //            exportDb();
    //        } catch (Exception e) {
    //            e.printStackTrace();
    //        }
  }
 protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
   super.onLayout(changed, left, top, right, bottom);
   if (mOnLayoutListener != null) {
     mOnLayoutListener.run();
   }
 }
 @Override
 protected void onDetachedFromWindow() {
   super.onDetachedFromWindow();
   mOnLayoutListener = null;
 }
Exemple #22
0
  public void create() {

    int width = display.getWidth();
    int height = display.getHeight();

    board = (GridLayout) activity.findViewById(com.example.wertalp.battleship.R.id.board);
    board.removeAllViews();
    Button buttonSet = (Button) activity.findViewById(com.example.wertalp.battleship.R.id.button23);
    EditText edit1 = (EditText) activity.findViewById(com.example.wertalp.battleship.R.id.editText);

    // board.setColumnCount(Integer.parseInt(edit1.getText().toString()));
    // board.setRowCount(Integer.parseInt(edit1.getText().toString()));
    board.setColumnCount(10);
    board.setRowCount(10);

    laenge = (int) (this.getWidth() - 300) / board.getColumnCount();
    breite = laenge;

    for (int i = 0; i <= board.getRowCount() - 1; i++) {
      for (int j = 0; j <= board.getColumnCount() - 1; j++) {

        CellButton button = new CellButton(activity);
        button.setBackgroundResource(com.example.wertalp.battleship.R.drawable.rectangle);
        button.setId(i + j);
        button.setyField(j);
        button.setxField(i);
        // button.setText(""+i+j);

        button.setLayoutParams(new LinearLayout.LayoutParams(laenge, breite));
        board.addView(button);
        // anz++;

        if (i == 0) {
          button.setText("" + j);
          button.setBackgroundResource(com.example.wertalp.battleship.R.drawable.rectangle_second);
        }
        if (j == 0) {
          button.setText("" + i);
          button.setBackgroundResource(com.example.wertalp.battleship.R.drawable.rectangle_second);
        }
        if ((i != 0) && (j != 0)) {

          // button.setOnClickListener(new View.OnClickListener() {

          //   @Override
          //   public void onClick(View v) {

          //    CellButton b = (CellButton) v;
          //    Toast.makeText(getActivity().getBaseContext(), "" + b.getPositionText(),
          // Toast.LENGTH_SHORT).show();
          //    b.setBackgroundResource(com.example.wertalp.battleship.R.drawable.cross);
          //    Butty = b;
          //    Ship cur_Ship = new Ship(board);

          //   show_popup(b);

          // }

          // })

          ;
        }
        ;
      }
    } //  create Methode ende
  } // End Create