Advertisement
Guest User

Untitled

a guest
May 24th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. /*
  2. * Copyright 2014 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16.  
  17. package com.example.carl.mdhschemaapp;
  18.  
  19. import android.app.Fragment;
  20. import android.os.Bundle;
  21. import android.support.v7.widget.CardView;
  22. import android.util.Log;
  23. import android.view.LayoutInflater;
  24. import android.view.View;
  25. import android.view.ViewGroup;
  26. import android.widget.SeekBar;
  27. import android.widget.TextView;
  28.  
  29. import java.util.Random;
  30.  
  31. /**
  32. * Fragment that demonstrates how to use CardView.
  33. */
  34. public class CardViewFragment extends Fragment {
  35.  
  36. private static final String TAG = CardViewFragment.class.getSimpleName();
  37.  
  38. /** The CardView widget. */
  39. //@VisibleForTesting
  40. CardView mCardView;
  41.  
  42. /**
  43. * SeekBar that changes the cornerRadius attribute for the {@link #mCardView} widget.
  44. */
  45. //@VisibleForTesting
  46. SeekBar mRadiusSeekBar;
  47.  
  48. /**
  49. * SeekBar that changes the Elevation attribute for the {@link #mCardView} widget.
  50. */
  51. //@VisibleForTesting
  52. SeekBar mElevationSeekBar;
  53.  
  54. /**
  55. * Use this factory method to create a new instance of
  56. * this fragment using the provided parameters.
  57. *
  58. * @return A new instance of fragment NotificationFragment.
  59. */
  60. public static CardViewFragment newInstance() {
  61. CardViewFragment fragment = new CardViewFragment();
  62. fragment.setRetainInstance(true);
  63. return fragment;
  64. }
  65.  
  66. public CardViewFragment() {
  67. // Required empty public constructor
  68. }
  69.  
  70. @Override
  71. public void onCreate(Bundle savedInstanceState) {
  72. super.onCreate(savedInstanceState);
  73. }
  74.  
  75. @Override
  76. public View onCreateView(LayoutInflater inflater, ViewGroup container,
  77. Bundle savedInstanceState) {
  78. // Inflate the layout for this fragment
  79. return inflater.inflate(R.layout.fragment_card_view, container, false);
  80. }
  81.  
  82. @Override
  83. public void onViewCreated(View view, Bundle savedInstanceState) {
  84. super.onViewCreated(view, savedInstanceState);
  85. mCardView = (CardView) view.findViewById(R.id.cardview);
  86. TextView kek = (TextView) view.findViewById(R.id.Course);
  87. int random = (int )(Math.random() * 50 + 1);
  88. String test = Integer.toString(random);
  89. kek.setText(test);
  90.  
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement