1 – Тажриба иш



Download 0,72 Mb.
bet3/4
Sana04.03.2022
Hajmi0,72 Mb.
#481809
1   2   3   4
Bog'liq
2-3labaratoriya

Тузувчи: Шахзод Хусинов, ТАТУ УФ, ДИ кафедраси


Toast.makeText(getApplicationContext(), "done", Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(getApplicationContext(), "not done", Toast.LENGTH_SHORT).show();
}
Intent intent = new Intent(getApplicationContext(),com.example.addressbook.MainActivity.class); startActivity(intent);
}
}
}
}




MainActivity.java


public class MainActivity extends Activity {


public final static String EXTRA_MESSAGE = "com.example.AddressBook.MESSAGE";


private ListView obj; DBHelper mydb;

@Override


protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);


mydb = new DBHelper(this);
ArrayList array_list = mydb.getAllCotacts();

ArrayAdapter arrayAdapter =


new ArrayAdapter(this,android.R.layout.simple_list_item_1, array_list);

//adding it to the list view.


obj = (ListView)findViewById(R.id.listView1); obj.setAdapter(arrayAdapter);
obj.setOnItemClickListener(new OnItemClickListener(){ @Override
public void onItemClick(AdapterView arg0, View arg1, int arg2, long arg3) {
/ TODO Auto-generated method stub int id_To_Search
= arg2 + 1;
Bundle dataBundle = new Bundle();


dataBundle.putInt("id", id_To_Search); Intent intent = new
Intent(getApplicationContext(),com.example.addressbook.DisplayContact.class);
intent.putExtras(dataBundle); startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
/ Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.mainmenu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
super.onOptionsItemSelected(item); switch(item.getItemId())
{
case R.id.item1:
Bundle dataBundle = new Bundle(); dataBundle.putInt("id", 0);
Intent intent = new Intent(getApplicationContext(),com.example.addressbook.DisplayContact.class); intent.putExtras(dataBundle);
startActivity(intent); return true;
default:
return super.onOptionsItemSelected(item);

}


}
public boolean onKeyDown(int keycode, KeyEvent event) { if (keycode == KeyEvent.KEYCODE_BACK) {
moveTaskToBack(true);
}
return super.onKeyDown(keycode, event);
}

}



Download 0,72 Mb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish