Example #1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    v = inflater.inflate(R.layout.lec_2_ted, container, false);

    mListView = (ListView) v.findViewById(R.id.list_lec_ted);

    listCardItems = new ArrayList<Item_CardList_Ted>();

    new ListSync().execute();

    cardItemAdapter =
        new Adapter_CardItem_Ted(
            getActivity().getApplicationContext(), R.layout.card_item_ted, listCardItems);
    mListView.setAdapter(cardItemAdapter);

    mListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(getActivity(), Card_Detail_Ted.class);
            startActivity(intent);
          }
        });

    return v;
  }
 /**
  * 创建listView 如果要兼容API9,需要修改此处
  *
  * @param context 上下文
  * @param attrs AttributeSet
  * @return ListView
  */
 @Override
 protected ListView createRootView(Context context, AttributeSet attrs) {
   ListView lv = new ListView(context, attrs);
   // Set it to this so it can be used in ListActivity/ListFragment
   lv.setId(android.R.id.list);
   return lv;
 }
 /** Show the last element in the list of adapters */
 private void showList() {
   if (mAdapters.isEmpty() || mAdapters.getLast().isEmpty()) {
     mList.setEmptyView(mEmptyLibrary);
   } else {
     LibraryAdapter adapter = mAdapters.getLast();
     adapter.getFilter().filter(mLastFilter);
     mList.setAdapter(adapter);
     if (adapter.isEmpty() || adapter.getCount() == 0) {
       buildSubActionBar("", "");
     } else {
       MyLibraryItem item = adapter.getItem(0);
       switch (item.getLevel()) {
         case MyLibrary.LVL_ARTIST:
           buildSubActionBar("", "");
           break;
         case MyLibrary.LVL_ALBUM:
           buildSubActionBar(item.getArtist(), "");
           break;
         default:
           buildSubActionBar(item.getArtist(), item.getAlbum());
           break;
       }
     }
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recommended);
    fb = new Firebase(getResources().getString(R.string.firebase_url));
    mArrayAdapter =
        new ArrayAdapter<>(
            this, R.layout.list_item, R.id.list_item_textview, new ArrayList<String>());
    ListView recentMovies = (ListView) findViewById(R.id.recommended_listView);
    majorfield = (EditText) findViewById(R.id.search_major_edittext);
    Button searchButton = (Button) findViewById(R.id.recommendation_search_button);
    ratingbar = (RatingBar) findViewById(R.id.search_ratingbar);

    searchButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            int rating = Math.round(ratingbar.getRating());
            String major = majorfield.getText().toString();
            getRecommendations(major, rating);
          }
        });

    recentMovies.setAdapter(mArrayAdapter);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    String[] osLijst =
        new String[] {
          "Android",
          "Iphone",
          "WindowsMobile",
          "Blackberry",
          "WebOS",
          "Ubuntu",
          "Windows7",
          "Mac OS X",
          "Linux",
          "OS/2"
        };

    ArrayAdapter<String> listViewArrayAdapter =
        new ArrayAdapter<String>(this, R.layout.listview_item, R.id.listViewItem, osLijst);

    final ListView listView = getListView();
    listView.setAdapter(listViewArrayAdapter);

    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Toast.makeText(
                    MainActivity.this, "Clicked ListItem number " + position, Toast.LENGTH_SHORT)
                .show();
          }
        });
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   mDrawerListView =
       (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
   mDrawerListView.setOnItemClickListener(
       new AdapterView.OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
           selectItem(position);
         }
       });
   mDrawerListView.setAdapter(
       new ArrayAdapter<String>(
           getActionBar().getThemedContext(),
           android.R.layout.simple_list_item_activated_1,
           android.R.id.text1,
           new String[] {
             getString(R.string.title_section1),
             getString(R.string.title_section2),
             getString(R.string.title_section3),
           }));
   mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
   return mDrawerListView;
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_algorithm_select);
    algorithmArray = getResources().getStringArray(R.array.algorithm);

    BlurBehind.getInstance()
        .withAlpha(100)
        .withFilterColor(Color.parseColor("#686350"))
        .setBackground(this);

    algorithmListView = (ListView) findViewById(R.id.algorithm_list);

    ArrayAdapter<String> itemsAdapter =
        new ArrayAdapter<String>(this, R.layout.algorithm_list_row, algorithmArray);

    algorithmListView.setAdapter(itemsAdapter);

    algorithmListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent();
            intent.putExtra("algorithmName", algorithmArray[position]);
            intent.putExtra("algorithmId", position);
            setResult(RESULT_OK, intent);

            Log.i("algorithm ", algorithmArray[position]);
            finish();
          }
        });
  }
Example #8
0
  private void initActionBar() {
    drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
    drawerList = (ListView) findViewById(R.id.drawerList);
    links = getResources().getStringArray(R.array.Links);
    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, links);
    drawerList.setAdapter(adapter);
    drawerList.setOnItemClickListener(this);
    drawerListner =
        new ActionBarDrawerToggle(
            this, drawerLayout, null, R.string.drawer_open, R.string.drawer_close) {
          @Override
          public void onDrawerOpened(View drawerView) {
            Toast.makeText(Home.this, "onglet ouvert ", Toast.LENGTH_SHORT).show();
            super.onDrawerOpened(drawerView);
          }

          @Override
          public void onDrawerClosed(View drawerView) {
            Toast.makeText(Home.this, " onglet  fermer ", Toast.LENGTH_SHORT).show();
            super.onDrawerClosed(drawerView);
          }
        };
    drawerLayout.setDrawerListener(drawerListner);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment

    view = inflater.inflate(R.layout.fragment_present, container, false);

    txtviewIntro = (TextView) view.findViewById(R.id.txtview_goals_intro);
    txtviewIntro.setTextColor(Color.GRAY);

    fab = (FloatingActionButton) view.findViewById(R.id.btn_action_button);
    fab.setOnClickListener(this);
    goalsMap = new HashMap<String, Integer>();

    MySQLiteHelper db = new MySQLiteHelper(activity);
    List<Goal> goals = db.getAllGoals();
    db.close();

    displayGoals(display_present);

    goalsListView = (ListView) view.findViewById(R.id.listview_goals);
    goalsListView.setAdapter(goalAdapter);
    goalsListView.setOnItemClickListener(this);

    for (Goal goal : goals) {
      goalsMap.put(goal.getTitle(), goal.getId());
    }

    fab.attachToListView(goalsListView);

    return view;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    this.tracingAppTextView = (TextView) this.findViewById(R.id.tracingAppTextView);

    this.appListView = (ListView) this.findViewById(R.id.appListView);
    appInfos = new ArrayList<AppInfo>();
    refreshAppInfos();
    appListAdapter = new ArrayAdapter<AppInfo>(this, android.R.layout.simple_list_item_1, appInfos);
    appListView.setAdapter(appListAdapter);

    appListView.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            AppInfo tracingAppInfo = appInfos.get((int) arg3);
            if (traceService != null) {
              traceService.setTracingApp(tracingAppInfo);
            }
            tracingAppTextView.setText("Tracing: " + tracingAppInfo.getProcessName());
          }
        });

    this.serviceToggleButton = (ToggleButton) this.findViewById(R.id.serviceToggleButton);

    this.bindService(new Intent("TraceService"), this.serviceConnection, BIND_AUTO_CREATE);
  }
Example #11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    listViewContact = (ListView) findViewById(R.id.listViewContact);

    String[] from = new String[] {"name", "surname"};

    int[] to = new int[] {R.id.textViewShowName, R.id.textViewShowSurname};

    listViewContact.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(MainActivity.this, PersonContact.class);
            intent.putExtra(ROW_ID, id);
            startActivity(intent);
          }
        });

    adapter = new DatabaseAdapter(MainActivity.this, R.layout.contact_item_row, null, from, to);

    listViewContact.setAdapter(adapter);
  }
 public void selectPerson(PersonDTO personDTO) {
   ProfessionalDTO professionalDTO = (ProfessionalDTO) personDTO;
   professionalLV.clearChoices();
   professionalLV.setItemChecked(professionalAdapter.getPosition(professionalDTO), true);
   professionalLV.setSelection(professionalAdapter.getPosition(professionalDTO));
   rearrangeAvailableDates(professionalDTO);
 }
  private void displayListView() {

    dbHelper.expireTraining(); // ADDED VIKALP CONTENT EXPIRY
    Cursor cursor = dbHelper.fetchAllTraining();

    // The desired columns to be bound
    String[] columns =
        new String[] {
          AnnounceDBAdapter.KEY_TITLE, AnnounceDBAdapter.KEY_DETAIL, AnnounceDBAdapter.KEY_SUMMARY
        };

    // the XML defined views which the data will be bound to
    int[] to = new int[] {R.id.tvTListTitle, R.id.tvTListDetail, R.id.tvListSummary};

    // create the adapter using the cursor pointing to the desired data
    // as well as the layout information
    dataAdapter = new TrainingAdapter(this, R.layout.trainlisting, cursor, columns, to);

    listView = (ListView) findViewById(R.id.listViewT);
    // Assign adapter to ListView
    listView.setAdapter(dataAdapter);
    registerForContextMenu(listView);

    listView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> listView, View view, int position, long id) {

            itemView(position);
          }
        }); // onClick
  } // end of displayList
  protected void onResume() {

    File file1 =
        new File(
            Environment.getExternalStorageDirectory().getAbsolutePath()
                + Constants.APP_FOLDER_TEMP);
    DeleteRecursive(file1);

    dbHelper = new AnnounceDBAdapter(this);
    dbHelper.open();
    displayListView();
    dbHelper.close();

    int temp = Integer.parseInt((getPreferences(MODE_PRIVATE).getString("listScroll", 0 + "")));
    Log.v("temp on resume", temp + "");
    listView.setSelection(temp);

    if (listView.getCount() < 1) {

      nomobcast.setVisibility(TextView.VISIBLE);

    } else {
      nomobcast.setVisibility(TextView.GONE);
    }

    IntentFilter filter = new IntentFilter();
    filter.addAction("MyGCMMessageReceived");
    registerReceiver(receiver, filter);
    super.onResume();
  }
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   ListView listView = (ListView) getRefreshView();
   position -= listView.getHeaderViewsCount();
   if (position >= 0 && position < getAdapterCount())
     BizFragment.getBizFragment(this).replyComment(null, getAdapterItems().get(position));
 }
Example #16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    lvContatos = (ListView) findViewById(R.id.lvContatos);

    contatos = new ArrayList<>();
    contatos.add(new Contato("Ana da Silva", "[email protected]", "99887766", R.drawable.ana));
    contatos.add(new Contato("Bruno dos Santos", "[email protected]", "88776655", R.drawable.bruno));
    contatos.add(new Contato("Camila Reis", "[email protected]", "77665544", R.drawable.camila));
    contatos.add(new Contato("Daniel Machado", "[email protected]", "66554433", R.drawable.daniel));

    adapter = new ContatoAdapter(this, contatos);

    lvContatos.setAdapter(adapter);

    lvContatos.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Contato c = (Contato) parent.getItemAtPosition(position);

            Intent i = new Intent(MainActivity.this, DetalheActivity.class);
            i.putExtra(CONTATO_CHAVE, c);
            i.putExtra(POSICAO_CHAVE, position);

            startActivityForResult(i, 1);
          }
        });
  }
 private void selectItem(int position) {
   System.out.println(position);
   switch (position) {
     case 0:
       showProfile(profileL, true);
       break;
     case 1:
       showQuickPay(true);
       break;
     case 2:
       showTransactions(null, null, true);
       break;
     case 3:
       showWallets(true);
       break;
     case 4:
       showRelations(null, null, true);
       break;
     case 5:
       mDrawerList.setItemChecked(position, true);
       setTitle(mPlanetTitles[position]);
       startActivity(demoIntent);
       break;
     case 6:
       mDrawerList.setItemChecked(position, true);
       setTitle(mPlanetTitles[position]);
       logOutNow();
       break;
     default:
       break;
   }
   mDrawerLayout.closeDrawer(mDrawerList);
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_spotify, container, false);
    ListView listViewArtists = (ListView) rootView.findViewById(R.id.list_artists);
    List<MyArtist> listAdapter;

    if (savedInstanceState == null || !savedInstanceState.containsKey("myArtistListQuery")) {
      listAdapter = new ArrayList<MyArtist>();
    } else {
      listAdapter = savedInstanceState.getParcelableArrayList("myArtistListQuery");
      myArtistListQuery = (ArrayList) listAdapter;
    }

    customAdapterSpotify = new CustomAdapterSpotify(getActivity(), listAdapter);

    listViewArtists.setAdapter(customAdapterSpotify);

    listViewArtists.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            MyArtist artist = customAdapterSpotify.getItem(position);
            ((Callback) getActivity()).onItemSelected(artist.getId());
          }
        });

    return rootView;
  }
Example #19
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    drawerItems = getResources().getStringArray(R.array.drawerItems);
    drawer = (DrawerLayout) findViewById(R.id.drawerLayout);
    drawerList = (ListView) findViewById(R.id.left_drawer);

    // Set the adapter for the list view
    drawerList.setAdapter(new ArrayAdapter<>(this, R.layout.item_row, drawerItems));
    // Set the list's click listener, and expose first view
    drawerList.setOnItemClickListener(new DrawerItemClickListener());
    selectItem(0);

    drawerToggle =
        new ActionBarDrawerToggle(this, drawer, toolbar, R.string.app_name, R.string.app_name) {

          @Override
          public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
          }

          @Override
          public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
          }
        };
    drawer.setDrawerListener(drawerToggle);
    drawerToggle.syncState();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.lista_socio_negocio_tab_fragment_lead, container, false);

    sideIndex = (LinearLayout) v.findViewById(R.id.sideIndex);
    lvSN = (ListView) v.findViewById(R.id.lvLstSocioLeadNeg);

    contexto = v.getContext();

    // Obtener el refreshLayout
    refreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipeRefresh);

    // Seteamos los colores que se usar�n a lo largo de la animaci�n
    refreshLayout.setColorSchemeResources(R.color.s1, R.color.s2, R.color.s3, R.color.s4);

    // FLOATING BUTTON
    FloatingActionButton fab = (FloatingActionButton) v.findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            Intent registrarSN = new Intent(v.getContext(), MainSocioNegocio.class);
            startActivity(registrarSN);
          }
        });
    // FLOATING BUTTON

    lvSN.setOnItemLongClickListener(this);
    lvSN.setOnScrollListener(this);
    setHasOptionsMenu(true);
    return v;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sharing);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mProgressDialog = new ProgressDialog(SharingActivity.this);

    // hook up list view
    ListView list = (ListView) findViewById(R.id.sharingListView);
    mAdapter = new ToolAdapter(mSharingTools, this);
    list.setAdapter(mAdapter);
    list.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            if (mSharingTools.size() > i && i >= 0) {
              ToolItem tool = mSharingTools.get(i);
              // execute the sharing action
              if (tool.isEnabled()) {
                tool.getAction().run();
              } else {
                app().showToastMessage(tool.getDisabledNotice());
              }
            }
          }
        });
  }
  private void initView(View layout) {
    lamp = layout.findViewById(R.id.v_lamp);
    menuLv = (ListView) layout.findViewById(R.id.lv_menu);
    subjectLv = (ListView) layout.findViewById(R.id.lv_subject);
    foldBtn = layout.findViewById(R.id.ll_title_sp);
    foldContent = layout.findViewById(R.id.ll_lv_sp);
    RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) foldBtn.getLayoutParams();
    lp.leftMargin = location[0];
    lp.topMargin = location[1];
    foldBtn.setLayoutParams(lp);
    foldBtn.setOnClickListener(this);
    lamp.setOnClickListener(this);
    menuAdapter = new DataAdapter(getActivity().getBaseContext());

    menuAdapter.setData(allocateData());
    menuLv.setAdapter(menuAdapter);
    menuLv.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            menuAdapter.checked(i);
            subjectAdapter.setData(allocateSubject());
            subjectAdapter.notifyDataSetChanged();
          }
        });
    subjectAdapter = new DataAdapter(getActivity().getBaseContext());
    subjectAdapter.checked(-1);
    subjectAdapter.setData(allocateSubject());
    subjectLv.setAdapter(subjectAdapter);
  }
  public void testListViewContentShouldComplyWithDataFromFacade() throws Exception {
    this.initializeValidAllocatableCategory();
    AllocatableDetailsActivity activity = this.getActivity();

    ListView listView = (ListView) activity.findViewById(R.id.allocatable_details_list);

    assertNotNull(listView);

    AllocatableAdapter adapter = null;
    // As list items are being retrieved asynchronously, try five times
    // whether the current number of list items equals the expected number.
    // If not, wait one second and try again.
    for (int i = 0; i < 5; i++) {
      // Get latest adapter
      adapter = (AllocatableAdapter) listView.getAdapter();
      // Check count
      if (adapter != null && adapter.getCount() == MockClientFacade.NUM_ALLOCATABLES) {
        break;
      } else {
        // List not updated, sleep for one second
        Thread.sleep(1000);
      }
    }

    assertNotNull(adapter);
    assertEquals(MockClientFacade.NUM_ALLOCATABLES, adapter.getCount());
  }
  public static void setListViewHeightBasedOnChildren(ListView listView) {

    ListAdapter listAdapter = listView.getAdapter();

    if (listAdapter == null) return;

    int desiredWidth =
        View.MeasureSpec.makeMeasureSpec(listView.getWidth(), View.MeasureSpec.UNSPECIFIED);

    int totalHeight = 0;

    View view = null;

    for (int i = 0; i < listAdapter.getCount(); i++) {

      view = listAdapter.getView(i, view, listView);

      if (i == 0)
        view.setLayoutParams(
            new ViewGroup.LayoutParams(desiredWidth, AbsListView.LayoutParams.MATCH_PARENT));

      view.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);

      totalHeight += view.getMeasuredHeight() + 20;
    }

    ViewGroup.LayoutParams params = listView.getLayoutParams();

    params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));

    listView.setLayoutParams(params);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO 自動生成されたメソッド・スタブ
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);

    // コンポーネントの関連付け
    layout = (RelativeLayout) this.findViewById(R.id.main_layout);
    listView = (ListView) this.findViewById(R.id.listView1);

    // リストビューのスクロールキャッシュ無効(色がおかしくなるので)
    listView.setScrollingCacheEnabled(false);

    // リスナーの設定
    listView.setOnItemClickListener(this);

    // アダプター作成
    adapter = new TaskArrayAdapter(this, setItem());

    // リストビューに項目データ(アダプタ)をセット
    listView.setAdapter(adapter);

    // 何もタスクが無いのなら新規作成のダイアログが開く
    int i = 0;
    editText = new EditText(this);
    editText.setInputType(InputType.TYPE_CLASS_TEXT);
    for (int j = 0; j < 10; j++) {
      i += adapter.getList().get(j).getTask().length();
      if (j == 9 && i == 0) {
        showYesDialog(
            ListActivity.this, "何かタスクを作ってみよう", "あなたがよく行う習慣を登録して時間を計りましょう", editText, this, 1);
        break;
      }
    }
  }
Example #26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_album);
    lv = (ListView) this.findViewById(R.id.listView);

    Proveedor proveedor = new Proveedor();

    Cursor c = proveedor.query(Contrato.TablaDisco.CONTENT_URI, null, null, null, null);
    c.moveToFirst();

    ad = new AdaptadorCursorDisco(this, c);

    lv.setAdapter(ad);

    lv.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent i = new Intent(AlbumActivity.this, CancionesActivity.class);
            Bundle bun = new Bundle();
            bun.putLong("id", id);
            i.putExtras(bun);
            startActivity(i);
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_daily_forecast);
    ButterKnife.bind(this);

    Intent intent = getIntent();

    mLocation = intent.getStringExtra(getString(R.string.location_name));
    Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.DAILY_FORECAST);
    mDays = Arrays.copyOf(parcelables, parcelables.length, Day[].class);

    mLocationLabel.setText(String.valueOf(mLocation));

    DayAdapter adapter = new DayAdapter(this, mDays);
    mListView.setAdapter(adapter);
    mListView.setEmptyView(mEmptyTextView);
    mListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            String dayOfTheWeek = mDays[position].getDayOfTheWeek();
            String conditions = mDays[position].getSummary();
            String highTemp = mDays[position].getTemperatureMax() + "";
            String lowTemp = mDays[position].getTemperatureMin() + "";
            String message =
                String.format(
                    "%s - High: %s, Low: %s, and %s", dayOfTheWeek, highTemp, lowTemp, conditions);
            Toast.makeText(DailyForecastActivity.this, message, Toast.LENGTH_LONG).show();
          }
        });
  }
  public void preencherInterface(final ArrayList<Avaliacoes> busca) {
    ArrayList<RowItemAvaliacao> data = new ArrayList<RowItemAvaliacao>();

    Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.prancheta);

    for (Avaliacoes a : busca) {

      RowItemAvaliacao item =
          new RowItemAvaliacao(
              bmp,
              a.getUsuarioAluno(),
              a.getDataAvaliacao(),
              a.getHoraAvaliacao(),
              a.getResultado());

      data.add(item);
    }

    CustomAdapterAvaliacoes adapter = new CustomAdapterAvaliacoes(getActivity(), data);
    lstListaAvaliacoesRealizadas.setAdapter(adapter);

    lstListaAvaliacoesRealizadas.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            Intent i = new Intent(getActivity(), VisualizarAvaliacao.class);
            i.putExtra("codAvaliacao", busca.get(arg2).getCodAvaliacao());
            startActivity(i);
          }
        });
  }
Example #29
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    AdRequest ar = new AdRequest();
    ar.addTestDevice("4B605421C6EAA120E18B7FA165D2E980");

    final ListView lv1 = (ListView) findViewById(R.id.listView);
    threadArray = new ArrayList<String>();
    authorArray = new ArrayList<String>();

    getDevice();

    lv1.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> a, View v, int position, long id) {
            Object o = lv1.getItemAtPosition(position);
            TitleResults fullObject = (TitleResults) o;
            threadTitle = fullObject.getItemName();
            Constants.THREADURL = threadArray.get(position);
            Intent intent = new Intent(MainActivity.this, ThreadActivity.class);
            Bundle b = new Bundle();
            b.putString("title", threadTitle);
            intent.putExtras(b);
            startActivity(intent);
          }
        });

    if (Constants.DEVICE != null) {
      ArrayList<TitleResults> titleArray = getTitles();
      lv1.setAdapter(new TitleAdapter(this, titleArray));
    }
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   super.onCreateView(inflater, container, savedInstanceState);
   RelativeLayout root =
       (RelativeLayout) inflater.inflate(R.layout.fragment_networks_list, container, false);
   listview = (ListView) root.findViewById(R.id.networks_list);
   wifiListAdapter = new WifiListAdapter(getActivity());
   listview.setAdapter(wifiListAdapter);
   noNetworksMessage = root.findViewById(R.id.message_group);
   if (savedInstanceState != null) {
     if (savedInstanceState.containsKey(NETWORKS_FOUND)) {
       Parcelable[] storedNetworksFound = savedInstanceState.getParcelableArray(NETWORKS_FOUND);
       networksFound = new WiFiNetwork[storedNetworksFound.length];
       for (int i = 0; i < storedNetworksFound.length; ++i)
         networksFound[i] = (WiFiNetwork) storedNetworksFound[i];
       onScanFinished(networksFound);
     }
     if (savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
       setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
     }
   }
   registerForContextMenu(listview);
   listview.setOnItemClickListener(this);
   return root;
 }