This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Dialog; | |
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.os.Bundle; | |
import android.support.v4.app.DialogFragment; | |
import android.support.v4.app.Fragment; | |
import android.support.v7.app.AlertDialog; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="example.allilepidrasi.example.AlertDialogFragment"> | |
<!-- TODO: Update blank fragment layout --> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent i = getIntent(); | |
Bundle b = i.getExtras(); | |
String name = (String)b.get(MainActivity.TAG_NAME); | |
TextView nameTextView = (TextView)findViewById(R.id.textView); | |
nameTextView.setText("Hello " + name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nameEditText = (EditText) findViewById(R.id.editText); | |
Button nextBtn = (Button) findViewById(R.id.btn_next); | |
nextBtn.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
Intent i = new Intent(MainActivity.this, Main2Activity.class); | |
String nameStr = nameEditText.getText().toString(); | |
i.putExtra(TAG_NAME, nameStr); | |
startActivity(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Button customDialogBtn2 = (Button)findViewById(R.id.btn_custom_2); | |
customDialogBtn2.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
final Dialog dialog = new Dialog(MainActivity.this); | |
dialog.setContentView(R.layout.custom_dialog2); | |
dialog.setTitle("My custom dialog"); | |
//set the custom dialog components - text, image and button | |
TextView text = (TextView) dialog.findViewById(R.id.textView); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
android:orientation="vertical"> | |
<ImageView | |
android:id="@+id/image" | |
android:layout_width="wrap_content" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Button customDialogBtn = (Button)findViewById(R.id.btn_custom); | |
customDialogBtn.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
final Dialog dialog = new Dialog(MainActivity.this); | |
dialog.setContentView(R.layout.custom_dialog); | |
dialog.setTitle("My custom dialog"); | |
//set the custom dialog components - text, image and button | |
TextView text = (TextView) dialog.findViewById(R.id.textView); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tv = (TextView) findViewById(R.id.textView); | |
tv.setText("2years"); | |
final SeekBar volumeControl = (SeekBar) findViewById(R.id.sb); | |
volumeControl.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { | |
int progressChanged = 0; | |
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser){ | |
progressChanged = progress+2; | |
if (tv!=null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<SeekBar | |
android:id="@+id/sb" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:max="3" | |
android:progress="0" | |
android:theme="@style/Widget.AppCompat.SeekBar.Discrete" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" android:layout_height="match_parent"> | |
<fragment | |
android:layout_width="wrap_content" | |
android:layout_height="match_parent" | |
android:name="example.allilepidrasi.flagquiz5.SettingsFragment" | |
android:id="@+id/fragment1" | |
class="example.allilepidrasi.flagquiz5.SettingsFragment" /> |
NewerOlder