ソースを参照

added images

master
MrTob 5年前
コミット
9cdb538d54
2個のファイルの変更31行の追加30行の削除
  1. +28
    -30
      app/src/main/java/at/ac/perg/htl/bhif16/coffeeapp/MainActivity.java
  2. +3
    -0
      app/src/main/res/layout/listview_activity.xml

+ 28
- 30
app/src/main/java/at/ac/perg/htl/bhif16/coffeeapp/MainActivity.java ファイルの表示

@@ -1,25 +1,13 @@
package at.ac.perg.htl.bhif16.coffeeapp;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -28,14 +16,25 @@ public class MainActivity extends AppCompatActivity {


// Array of strings for ListView Title
String[] listviewTitle = new String[]{
"Achleitner", "Aichinger", "Bodingbauer", "Bogdan"
};


int[] listviewImage = new int[]{
R.drawable.achleitner, R.drawable.ic_launcher_background, R.drawable.ic_launcher_background, R.drawable.ic_launcher_background
};
String[] listviewTitle = new String[]{ "Achleitner", "Aichinger", "Bodingbauer",
"Bogdan","Derntl","Diesenreither",
"Forthofer","Fröschl","Fürholzer",
"Grünzweil","Gürler","Hametner",
"Hemmelmayr","Kargl","Link",
"Mayrhofer","Moser","Mühlbachler",
"Nerat","Pilgersdorfer","Rauch",
"Rauscher","Scheuchenpflug","Wall"};

int[] listviewImage = new int[]{ R.drawable.achleitner, R.drawable.aichinger, R.drawable.bodingbauer,
R.drawable.bogdan, R.drawable.derntl, R.drawable.unknown,
R.drawable.forthofer, R.drawable.froeschl, R.drawable.fuerholzer,
R.drawable.unknown, R.drawable.unknown, R.drawable.hametner,
R.drawable.hemmelmayr, R.drawable.kargl, R.drawable.link,
R.drawable.mayrhofer, R.drawable.moser, R.drawable.muehlbacher,
R.drawable.unknown, R.drawable.pilgersdorfer, R.drawable.rauch,
R.drawable.rauscher, R.drawable.scheuchenpflug, R.drawable.wall};

TextView count_field;


@Override
@@ -43,9 +42,6 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Button countBtn = (Button) findViewById(R.id.count_btn);
TextView count_field = (TextView) findViewById(R.id.count_field);

List<HashMap<String, String>> aList = new ArrayList<HashMap<String, String>>();
for (int i = 0; i < listviewTitle.length; i++) {
HashMap<String, String> hm = new HashMap<String, String>();
@@ -60,14 +56,16 @@ public class MainActivity extends AppCompatActivity {
SimpleAdapter simpleAdapter = new SimpleAdapter(getBaseContext(), aList, R.layout.listview_activity, from, to);
ListView androidListView = (ListView) findViewById(R.id.list_view);
androidListView.setAdapter(simpleAdapter);
countBtn.setOnClickListener(new View.OnClickListener() {


@Override
public void onClick(View v) {
Log.d("HURE","mog nimma");
}
});








}




+ 3
- 0
app/src/main/res/layout/listview_activity.xml ファイルの表示

@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/android_list_view_tutorial_with_example"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity">
android:padding="7dp">

<ImageView
@@ -27,6 +29,7 @@
android:id="@+id/count_btn"
android:layout_height="wrap_content"
android:text="+ Getränk"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"


読み込み中…
キャンセル
保存