Android allow multi-touch on an activity - android

I am trying to allow the user to put a ring on the circle on the screen and then press the larger button so that the circle goes to the next ring size.
Everything work fines when no ring is on the screen.
However when a ring it on the screen no other touches are called and the buttons and the seekbar does not work.
I'm new in android and i haven't came across this requirement before. Is there a way I can allow multi-touch gestures on the activity or a way to ignore touches on that specific layout?
XML File
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/White"
android:splitMotionEvents="false"
>
<TextView
android:id="#+id/us"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/uslbl"
android:padding="#dimen/standard_margin"
android:text="size"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/pressed_gemporia" />
<TextView
android:id="#+id/uklbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/uslbl"
android:padding="#dimen/standard_margin"
android:text="UK Size:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/Black" />
<TextView
android:id="#+id/uk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/uklbl"
android:layout_alignBottom="#+id/uklbl"
android:layout_toRightOf="#+id/uklbl"
android:padding="#dimen/standard_margin"
android:text="size"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/pressed_gemporia" />
<ImageView
android:id="#+id/ci"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<TextView
android:id="#+id/uslbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/uk"
android:gravity="left"
android:padding="#dimen/standard_margin"
android:text="US Size:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/Black" />
<SeekBar
android:id="#+id/seekbar"
android:progressDrawable="#drawable/red_scrubber_progress"
android:thumb="#drawable/red_scrubber_control"
android:max="8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/divider" />
<View
android:id="#+id/divider"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/uklbl"
android:layout_marginTop="18dp"
android:background="#color/pressed_gemporia" />
<TextView
android:id="#+id/sizes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:padding="#dimen/standard_margin"
android:layout_below="#+id/seekbar"
android:text="TextView" android:textColor="#color/pressed_gemporia" />
<Button
android:id="#+id/right"
android:layout_width="100dp"
android:textColor="#color/pressed_gemporia"
android:layout_height="wrap_content"
android:background="#color/White"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/left"
android:text="Larger" />
<Button
android:id="#+id/left"
android:layout_width="100dp"
android:background="#color/White"
android:textColor="#color/pressed_gemporia"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Smaller" />
<ImageView
android:id="#+id/ring"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ci"
android:layout_centerHorizontal="true"
android:src="#drawable/j" />
Java Code
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ring_sizes);
left = (Button)findViewById(R.id.left);
right = (Button)findViewById(R.id.right);
us = (TextView) findViewById(R.id.us);
uk = (TextView) findViewById(R.id.uk);
ci = (ImageView)findViewById(R.id.ci);
ring = (ImageView)findViewById(R.id.ring);
sizes.add(R.drawable.j);
sizes.add(R.drawable.l);
sizes.add(R.drawable.n);
sizes.add(R.drawable.p);
sizes.add(R.drawable.r);
sizes.add(R.drawable.t);
sizes.add(R.drawable.v);
sizes.add(R.drawable.x);
sizes.add(R.drawable.z);
USsizes.add("5");
USsizes.add("6");
USsizes.add("7");
USsizes.add("8");
USsizes.add("9");
USsizes.add("10");
USsizes.add("11");
USsizes.add("12");
USsizes.add("13");
UKsizes.add("J-K");
UKsizes.add("L-M");
UKsizes.add("N-O");
UKsizes.add("P-Q");
UKsizes.add("R-S");
UKsizes.add("T-U");
UKsizes.add("V-W");
UKsizes.add("X-Y");
UKsizes.add("Z+");
color = (getBaseContext().getResources().getColor(R.color.pressed_gemporia));
value = (TextView) findViewById(R.id.sizes);
seekbar = (SeekBar) findViewById(R.id.seekbar);
seekbar.getProgressDrawable().setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
value.setText("UK Size : "+UKsizes.get(0) + " - US Size: " + USsizes.get(0));
setUpViews();
seekbar.setOnSeekBarChangeListener( new OnSeekBarChangeListener()
{
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser)
{
ring.setImageResource(sizes.get(progress));
us.setText(USsizes.get(progress));
uk.setText(UKsizes.get(progress));
counter=progress;
value.setText("UK Size : "+UKsizes.get(progress) + " - US Size: " + USsizes.get(progress));
}
public void onStartTrackingTouch(SeekBar seekBar)
{
// TODO Auto-generated method stub
}
public void onStopTrackingTouch(SeekBar seekBar)
{
// TODO Auto-generated method stub
}
});
}
public void setUpViews(){
ring.setImageResource(sizes.get(counter));
us.setText(USsizes.get(counter));
uk.setText(UKsizes.get(counter));
right.setOnClickListener(new View.OnClickListener()
{
#Override
public void onClick(View view)
{
if(UKsizes.size()>counter+1){
ring.setImageResource(sizes.get(counter+1));
seekbar.setProgress(counter+1);
}
}
});
left.setOnClickListener(new View.OnClickListener()
{
#Override
public void onClick(View view)
{
if(counter!=0){
ring.setImageResource(sizes.get(counter));
seekbar.setProgress(counter-1);
} }
});
}
}

There is a way to ignore touches in particular layout,for that you should add
android:splitMotionEvents="false"
in your layout . You can refer answers from thie following link
https://stackoverflow.com/questions/12777435/disable-multi-finger-touch-in-my-app

Related

getCheckedRadioButtonId just gives me nullpoint exception

Im having some issues, i have two Groups of Radiobuttons in my XML which has handling in an activity. It just crashes with nullpoint exception on line 48:
int languangeId = languageGroup.getCheckedRadioButtonId();
I have set a "default" checked button in the XML to one of the buttons in the buttongroup,
So why doesnt it get an valid value?:(
public class FirstTimeSelectMenu extends Activity{
private RadioGroup languageGroup;
private RadioGroup storageGroup;
private Button okButton;
private String getStorage;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.first_time_run);
languageGroup = (RadioGroup)this.findViewById(R.id.languageGroup);
storageGroup = (RadioGroup)this.findViewById(R.id.storageGroup);
okButton = (Button)findViewById(R.id.okBtn);
okButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
int languangeId = languageGroup.getCheckedRadioButtonId();
int storageId = storageGroup.getCheckedRadioButtonId();
RadioButton languageb = (RadioButton)findViewById(languangeId);
RadioButton storageb = (RadioButton)findViewById(storageId);
if(languageb.equals("Norwegian")){
//Need to fix this!
}
if(languageb.equals("English")){
//Need to fix this!
}
if(storageb.equals("SD Card")){
String sdStoragePath = Environment.getExternalStorageDirectory().toString() + "/PictureTalk/";
FileInteraction fi = new FileInteraction();
fi.firstTimeFillPath(getResources(), "PictureTalk/Food", sdStoragePath +"PictureTalk/Food");
fi.firstTimeFillPath(getResources(), "PrivatePictures", Environment.getExternalStorageDirectory().toString() +"PrivatePictures");
Intent intent = new Intent(getApplicationContext(),MainMenuActivity.class);
intent.putExtra("dataStorePath",sdStoragePath);
startActivity(intent);
}
}
});
}}
My XML file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/languagetext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="236dp"
android:text="Choose language" />
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/languagetext"
android:layout_alignRight="#+id/languagetext"
android:layout_below="#+id/languageGroup">
<RadioButton
android:id="#+id/norwegianRadioBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Norwegian" />
<RadioButton
android:id="#+id/englishRadioBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="English" />
</RadioGroup>
<TextView
android:id="#+id/internal_sd"
android:layout_width="464dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="236dp"
android:text="Do you want to store the data to:" />
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:id="#+id/storageGroup">
<RadioButton
android:id="#+id/sdcardRadioBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:checked="true"
android:text="SD card" />
<RadioButton
android:id="#+id/internalRadioBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Internal storage" />
</RadioGroup>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ok"
android:id="#+id/okBtn"
android:layout_gravity="bottom" />
To start off with, what element is assigned the id "#+id/languageGroup" since it doesn't appear to be declared in your XML

I want to set minumum value in my seekbar android

I want my seekbar having values from 33 to 80, I have read in Google, that we cannot set minimum in xml, so I add 33 to progress. But the thing is that my seekbar gets values from 33 to 113(max + 30). Any tips will be valuable for me, thank you.
TextView textView123;
SeekBar seekBar;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calc);
seekBar = (SeekBar) findViewById(R.id.seekBar1);
textView123 = (TextView) findViewById(R.id.progress);
textView123.setText(seekBar.getProgress() + " ");
seekBar.setOnSeekBarChangeListener(
new OnSeekBarChangeListener() {
int progress = 0;
#Override
public void onProgressChanged(SeekBar seekBar,
int progresValue, boolean fromUser) {
progress = progresValue + 33;
}
#Override
public void onStartTrackingTouch(SeekBar seekBar) {
// Do something here,
}
#Override
public void onStopTrackingTouch(SeekBar arg0) {
// TODO Auto-generated method stub
textView123.setText(progress + " ");
}
});
xml layout
<ImageView
android:id="#+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="center"
android:src="#drawable/backgroundpic" />
<TextView
android:id="#+id/textView4"
android:layout_width="match_parent"
android:layout_height="240dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="20dp"
android:background="#color/white" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/seekBar1"
android:layout_alignParentLeft="true"
android:layout_marginLeft="14dp"
android:text="Quantity"
android:textAppearance="?android:attr/textAppearanceLarge" />
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView4"
android:layout_marginTop="27dp"
android:max="80"
android:progress="1" />
<TextView
android:id="#+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView1"
android:layout_alignParentRight="true"
android:layout_marginRight="91dp"
android:text="33"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
Simple solution:
Set max to the actual value you want minus the min value you programmatically add in onProgressChanged.
In your case, simply set max to 47 (80 - 33).

Building a custom AlertDialog, how to implement button click?

final AlertDialog builder = new AlertDialog.Builder(activity).create();
LayoutInflater factory = LayoutInflater.from(activity);
View view = factory.inflate(R.layout.inventory_item_pop_up, null);
builder.setView(view);
ImageButton discardButton = (ImageButton) view.findViewById(R.id.popup_discard);
discardButton.setClickable(true);
discardButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
listener.remove(f);
builder.dismiss();
}
});
This button click does not respond at all. How can I make this piece of code work?
I use this code in an Adapter, by the way.
the onCLickListener you have registered, is it DialogInterface.OnClickListener? If you have used onCLickListener from View class then that won't work here. Please recheck.
You need to do
discardButton.setOnClickListener(new DialogInterface.OnClickListener() {
#Override
public void onClick(View v) {
listener.remove(f);
builder.dismiss();
}
});
I hope this will helpfull for you. I implement this way for custom Dialog
public void showUpdateDialog() {
updateDialog = new Dialog(this,
android.R.style.Theme_Translucent_NoTitleBar_Fullscreen) {
#Override
public void onBackPressed() {
this.dismiss();
loadDataAsync.execute();
}
};
updateDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
updateDialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
updateDialog.setContentView(R.layout.updatepopup);
logger.info("Network error popup on");
updateDialog.setCancelable(true);
ImageView dialogImage = (ImageView) updateDialog
.findViewById(R.id.dialogheaderimageupdateupdate);
dialogImage.setBackgroundResource(R.drawable.infoimage);
TextView dialogMesage = (TextView) updateDialog
.findViewById(R.id.dialogmessgetextupdate);
TextView currVersion = (TextView) updateDialog
.findViewById(R.id.currentversionupdate);
TextView newVersion = (TextView) updateDialog
.findViewById(R.id.newversionupdate);
TextView dialogHeader = (TextView) updateDialog
.findViewById(R.id.dialogheadertextupdate);
newVersion.setText("Latest version: " + versionCode);
currVersion.setText("Current version : " + currentVersionName);
dialogMesage.setText("Would you like to update now?");
dialogHeader.setText("A program update is available! ");
Button dialogOk = (Button) updateDialog
.findViewById(R.id.dialogokbuttonupdate);
dialogOk.setText("Update");
dialogOk.setFocusable(true);
dialogOk.requestFocus();
dialogOk.setFocusableInTouchMode(true);
dialogOk.requestFocus();
Button dialogCancel = (Button) updateDialog
.findViewById(R.id.dialogcancelbuttonupdate);
dialogOk.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
updateDialog.dismiss();
downLoad = new DownLoad();
downLoad.execute(apkUrl.trim());
}
});
dialogCancel.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
updateDialog.dismiss();
loadDataAsync.execute();
}
});
try {
updateDialog.show();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
And my updatepopup.xml is displayed below
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="#+id/layoutsample"
style="#android:style/Theme.Black.NoTitleBar.Fullscreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/dialoghdrbg"
android:orientation="horizontal" >
<ImageView
android:id="#+id/dialogheaderimageupdateupdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/dialogheadertextupdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginLeft="1dp"
android:gravity="center_vertical|right"
android:textColor="#000000"
android:textSize="25dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/dialogcontentbg"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical" >
<TextView
android:id="#+id/currentversionupdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="#ffffff"
android:textSize="23dp"
android:layout_marginTop="10dp"/>
<TextView
android:id="#+id/newversionupdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="#ffffff"
android:textSize="23dp" />
<TextView
android:id="#+id/dialogmessgetextupdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="#ffffff"
android:textSize="23dp"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|center_horizontal"
android:layout_marginTop="15dp"
android:gravity="center|center_horizontal"
android:orientation="horizontal" android:layout_marginBottom="10dp">
<Button
android:id="#+id/dialogokbuttonupdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:background="#drawable/buttonanimation"
android:text="#string/OKButton"
android:textSize="20dp"
android:textStyle="bold" />
<Button
android:id="#+id/dialogcancelbuttonupdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:background="#drawable/buttonanimation"
android:text="#string/CancelButton"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Well, this is awkward... The code is correct, I just wasn't calling the right createDialog() method.

How to change the TextView Color on click of a layout in android?

I want to change the background image and TextView Color on click of a layout .The background color is chnaging properly but my textview color is not changing.Here is my XML code :
<RelativeLayout
android:id="#+id/flight_relative"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_below="#+id/imgLogo"
android:layout_marginTop="5dp"
android:background="#drawable/button_effect"
android:gravity="center_vertical" >
<TextView
android:id="#+id/flight_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/flight_list_image"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/flight_list_image"
android:text="#string/flight_tittle"
android:textColor="#152b72"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/content_flight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/flight_content"
android:layout_toRightOf="#+id/flight_list_image"
android:text="#string/flight_content"
android:textColor="#2f2f2f"
android:textSize="10sp" />
<ImageView
android:id="#+id/flight_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/flight_content"
android:layout_alignParentRight="true"
android:src="#drawable/arrow" />
<ImageView
android:id="#+id/flight_list_image"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="3dip"
android:src="#drawable/flight_icon" />
</RelativeLayout>
Code to chnage the textview color is :
flightRelative = (RelativeLayout )findViewById(R.id.flight_relative);
flightRelative.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
flight = (TextView)findViewById(R.id.flight_content);
flight.setTextColor(Color.WHITE);
}
});
What wrong i am doing please suggest me .For the first time it is not working on second time it is working
You should add this definitely working.I am also check it out...
flightRelative.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
TextView flight = (TextView)findViewById(R.id.flight_content);
flight.setTextColor(Color.parseColor("#FFFFFF"));
}
});
you should use
#Override
public void onClick(View arg0) {
flight = (TextView)flightRelative.findViewById(R.id.flight_content);
flight.setTextColor(Color.WHITE);
}
I believe it should work now.

Android Activity as dialog black border

I have activity as a dialogue, all the shows I like. But I have a problem with a frame around them. Just like here.
My Activity:
public class AlarmAlert extends Activity implements Alarms.AlarmSettings {
#Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
AlarmAlertWakeLock.acquire(this);
/*
* FIXME Intentionally verbose: always log this until we've fully
* debugged the app failing to start up
*/
Log.v("AlarmAlert.onCreate()");
DigitalClock dc = (DigitalClock) findViewById(R.id.digitalClock1);
mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
Intent i = getIntent();
mAlarmId = i.getIntExtra(Alarms.ID, -1);
Alarms.getAlarm(getContentResolver(), this, mAlarmId);
mKlaxon = new AlarmKlaxon();
mKlaxon.postPlay(this, mAlarmId);
/* Set the title from the passed in label */
setTitleFromIntent(i);
/*
* allow next alarm to trigger while this activity is active
*/
Alarms.disableSnoozeAlert(AlarmAlert.this);
Alarms.disableAlert(AlarmAlert.this, mAlarmId);
Alarms.setNextAlert(this);
mKlaxon.setKillerCallback(new AlarmKlaxon.KillerCallback() {
public void onKilled() {
if (Log.LOGV)
Log.v("onKilled()");
updateSilencedText();
/* don't allow snooze */
mSnoozeButton.setEnabled(false);
dismiss();
mState = KILLED;
}
});
updateLayout();
SharedPreferences settings = getSharedPreferences(
AlarmClock.PREFERENCES, 0);
if (settings.getBoolean(AlarmClock.PREF_SHAKE_SNOOZE, true)) {
mShakeListener = new ShakeListener(this);
mShakeListener
.setOnShakeListener(new ShakeListener.OnShakeListener() {
public void onShake() {
snooze();
if (mCaptchaSnooze == 0)
finish();
}
});
}
}
private void setTitleFromIntent(Intent i) {
mLabel = i.getStringExtra(Alarms.LABEL);
if (mLabel == null || mLabel.length() == 0) {
mLabel = getString(R.string.default_label);
}
setTitle(mLabel);
}
private void updateSilencedText() {
TextView silenced = (TextView) findViewById(R.id.silencedText);
silenced.setText(getString(R.string.alarm_alert_alert_silenced,
mDuration / 1000 * 60));
silenced.setVisibility(View.VISIBLE);
}
private void updateLayout() {
setContentView(R.layout.alarm_alert);
My alert_alarm.xml (Dialog).
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/root"
android:layout_width="327dp"
android:layout_height="295dp"
android:background="#drawable/alertbg"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:id="#+id/silencedText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="2dp"
android:paddingTop="2dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/ltgrey"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="230dp"
android:gravity="center_horizontal" >
<Button
android:id="#+id/snooze"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#drawable/teesstt"
android:text="#string/snooze_button"
android:textColor="#fff"
android:textSize="25dp"
android:visibility="visible" />
<Button
android:id="#+id/dismiss"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="25dp"
android:layout_marginTop="20dp"
android:background="#drawable/teesstt"
android:text="#string/dismiss_button"
android:textColor="#fff"
android:textSize="25dp"
android:visibility="visible" />
</RelativeLayout>
<TextView
android:id="#+id/tvDD"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/tvDate"
android:layout_alignLeft="#+id/tvDate"
android:text="Medium Text"
android:textSize="20dp"
android:textColor="#a6a6a6" />
<TextView
android:id="#+id/tvDate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/relativeLayout1"
android:layout_alignParentLeft="true"
android:layout_marginBottom="55dp"
android:layout_marginLeft="30dp"
android:text="Medium Text"
android:textSize="25dp"
android:textColor="#a6a6a6" />
<com.boxclocks.android.alarmclock.dc
android:id="#+id/digitalClock1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="58dp"
android:text="DigitalClock"
android:textColor="#a6a6a6"
android:textSize="70dp" />
</RelativeLayout>
How do I remove the border.
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
Dialog
You have two options. You can set the theme of your Activity to
Theme_Translucent_NoTitleBar
Or you have to create a new theme and load it with a custom nine patch as specified here
How to remove border from Dialog?

Categories

Resources