[android-developers] "Button" in Android and also Apple ..that no one uses... as it should be. maybe the most important one...

2016-09-01 Thread michael Hoehne
Does anybody knew that there is 1 button which seems nearly  dead 
exists in Android software also in apple ... but  it is nearly unused 
.t should have  more potencial than google has.. sounds ... no i am really 
not shizophrenic etc  ..no. 
I do know what i am talking about . I would like to talk to Larry Page 
personally. please, possible? Please answer.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/38798895-7831-495b-ad6c-a99a8057307e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] button onClick handler retrieve custom attribute value declared in activity_main.xml

2016-08-08 Thread Steve Gabrilowitz
You might also want to create your buttons with a loop in your code instead
of in the layout file

On Aug 8, 2016 5:41 AM, "Thomas Fazekas"  wrote:

> My bad... thanks for setting me straight.
>
> On Sunday, August 7, 2016 at 5:18:52 PM UTC+2, Steve Gabrilowitz wrote:
>>
>> toString() returns a string representation of an object which is not
>> necessarily the value of the object.  your view.getTag() returns an object
>> which is already a String so all you have to do is cast it to string rather
>> than using toString() on it
>>
>> String buttStr = (String) view.getTag(); is what you need
>>
>> On Aug 7, 2016 3:35 AM, "Thomas Fazekas"  wrote:
>>
>> Dear all,
>>
>> here is what I want to do : declare a whole bunch of buttons in the
>> activity_main.xml each of them having one custom tag (in this case it's
>> called "tag").
>> All the buttons would share the same onClick handler, where I would use
>> this custom property value to construct some strings (a URL actually).
>>
>> Code excerpt :
>>
>> activity_main.xml
>>
>> > android:orientation="horizontal"
>> android:layout_width="match_parent"
>> android:layout_height="wrap_content"
>> android:gravity="center">
>>
>> > android:layout_width="48dp"
>> android:layout_height="48dp"
>> android:text="o"
>> android:id="@+id/led0"
>> android:tag="paramValue1"
>> android:onClick="sendURL" />
>>
>> > android:layout_width="48dp"
>> android:layout_height="48dp"
>> android:text="o"
>> android:tag="paramValue2"
>> android:id="@+id/led1"
>> android:onClick="sendURL"/>
>>
>> 
>> 
>>
>> and then in the ActivityMain.java I would use this value :
>>
>> public class MainActivity extends AppCompatActivity {
>>
>> @Override
>> protected void onCreate(Bundle savedInstanceState) {
>> super.onCreate(savedInstanceState);
>> setContentView(R.layout.activity_main);
>> }
>>
>> public void sendLed(View view){
>> ...
>> String buttStr = view.getTag().toString();
>> ...
>> }
>> }
>>
>> Now , is that in anyway possible ?
>> The above construct gets me an NPE.
>>
>> I am aware that I could use a switch statement (to compare the view.getId()
>> with the individual ids of the buttons) but that seems a lot of comparisons
>> for nothing (I would use that additional value "blindly", i.e. it doesn't
>> matter which button has been pressed)
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Android Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to android-developers+unsubscr...@googlegroups.com.
>> To post to this group, send email to android-d...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/android-developers.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/android-developers/fa4ae215-281e-4fcf-b929-005b59f2ef2f%
>> 40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to android-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/android-developers.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/android-developers/2ed4bd2b-dab2-404d-bc33-
> bbe5ac7a5bf6%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CABfabRi8rXh1Z5Q6KnjM%3D3zO6Bfg6SWToW-Dp1jX5rnK4x0gyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] button onClick handler retrieve custom attribute value declared in activity_main.xml

2016-08-08 Thread Thomas Fazekas
My bad... thanks for setting me straight.

On Sunday, August 7, 2016 at 5:18:52 PM UTC+2, Steve Gabrilowitz wrote:
>
> toString() returns a string representation of an object which is not 
> necessarily the value of the object.  your view.getTag() returns an object 
> which is already a String so all you have to do is cast it to string rather 
> than using toString() on it
>
> String buttStr = (String) view.getTag(); is what you need
>
> On Aug 7, 2016 3:35 AM, "Thomas Fazekas"  > wrote:
>
> Dear all,
>
> here is what I want to do : declare a whole bunch of buttons in the 
> activity_main.xml each of them having one custom tag (in this case it's 
> called "tag").
> All the buttons would share the same onClick handler, where I would use 
> this custom property value to construct some strings (a URL actually).
>
> Code excerpt :
>
> activity_main.xml
>
>  android:orientation="horizontal"
> android:layout_width="match_parent"
> android:layout_height="wrap_content"
> android:gravity="center">
>
>  android:layout_width="48dp"
> android:layout_height="48dp"
> android:text="o"
> android:id="@+id/led0"
> android:tag="paramValue1"
> android:onClick="sendURL" />
>
>  android:layout_width="48dp"
> android:layout_height="48dp"
> android:text="o"
> android:tag="paramValue2"
> android:id="@+id/led1"
> android:onClick="sendURL"/>
>
> 
> 
>
> and then in the ActivityMain.java I would use this value :
>
> public class MainActivity extends AppCompatActivity {
>
> @Override
> protected void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.activity_main);
> }
>
> public void sendLed(View view){
> ...
> String buttStr = view.getTag().toString();
> ...
> }
> }
>
> Now , is that in anyway possible ?
> The above construct gets me an NPE.
>
> I am aware that I could use a switch statement (to compare the view.getId() 
> with the individual ids of the buttons) but that seems a lot of comparisons 
> for nothing (I would use that additional value "blindly", i.e. it doesn't 
> matter which button has been pressed) 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to android-developers+unsubscr...@googlegroups.com .
> To post to this group, send email to android-d...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/android-developers.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/android-developers/fa4ae215-281e-4fcf-b929-005b59f2ef2f%40googlegroups.com
>  
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/2ed4bd2b-dab2-404d-bc33-bbe5ac7a5bf6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] button onClick handler retrieve custom attribute value declared in activity_main.xml

2016-08-07 Thread Steve Gabrilowitz
toString() returns a string representation of an object which is not
necessarily the value of the object.  your view.getTag() returns an object
which is already a String so all you have to do is cast it to string rather
than using toString() on it

String buttStr = (String) view.getTag(); is what you need

On Aug 7, 2016 3:35 AM, "Thomas Fazekas"  wrote:

Dear all,

here is what I want to do : declare a whole bunch of buttons in the
activity_main.xml each of them having one custom tag (in this case it's
called "tag").
All the buttons would share the same onClick handler, where I would use
this custom property value to construct some strings (a URL actually).

Code excerpt :

activity_main.xml










and then in the ActivityMain.java I would use this value :

public class MainActivity extends AppCompatActivity {

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

public void sendLed(View view){
...
String buttStr = view.getTag().toString();
...
}
}

Now , is that in anyway possible ?
The above construct gets me an NPE.

I am aware that I could use a switch statement (to compare the view.getId()
with the individual ids of the buttons) but that seems a lot of comparisons
for nothing (I would use that additional value "blindly", i.e. it doesn't
matter which button has been pressed)

-- 
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit https://groups.google.com/d/
msgid/android-developers/fa4ae215-281e-4fcf-b929-
005b59f2ef2f%40googlegroups.com

.

For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CABfabRgeWAZaagA%3DPCZoTDjvp9t8B_U_FxM6e%2Bbn3BgN0VwiQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] button onClick handler retrieve custom attribute value declared in activity_main.xml

2016-08-07 Thread Thomas Fazekas
Dear all,

here is what I want to do : declare a whole bunch of buttons in the 
activity_main.xml each of them having one custom tag (in this case it's 
called "tag").
All the buttons would share the same onClick handler, where I would use 
this custom property value to construct some strings (a URL actually).

Code excerpt :

activity_main.xml










and then in the ActivityMain.java I would use this value :

public class MainActivity extends AppCompatActivity {

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

public void sendLed(View view){
...
String buttStr = view.getTag().toString();
...
}
}

Now , is that in anyway possible ?
The above construct gets me an NPE.

I am aware that I could use a switch statement (to compare the view.getId() 
with the individual ids of the buttons) but that seems a lot of comparisons 
for nothing (I would use that additional value "blindly", i.e. it doesn't 
matter which button has been pressed) 

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/fa4ae215-281e-4fcf-b929-005b59f2ef2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] button onClick handler retrieve custom attribute value declared in activity_main.xml

2016-08-07 Thread Thomas Fazekas
Dear all,

here is what I want to do : declare a whole bunch of buttons in 
the activity_main.xml each of them having one custom tag (in this case it's 
called "tag").
All the buttons would share the same onClick handler, where I would use 
this custom property value to construct some strings (a URL actually).

Code excerpt :

actiity_main.xml













and then in the I would use this value :


public class MainActivity extends AppCompatActivity {

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

public void sendLed(View view){
...




urlText.setText("http://"+hostText.getText().toString()+":"+portText.getText().toString()+"/"+view.getId());
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/85e842f5-c237-46be-b283-35a7bde7c300%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Button

2013-02-26 Thread Arun Kumar K
Hi guys,

I want to add a button in App Uninstall page..how can i add the button
can any one help me..



-- 
*Thanks  Regards*
*K.Arun Kumar*

-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Button#onClickListener thread unsafe?

2012-10-14 Thread Greenhand
In my project, I has a layout as follows:
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_width=fill_parent
android:layout_height=fill_parent
android:orientation=vertical

Button
android:id=@+id/startButton
android:layout_width=fill_parent
android:layout_height=0dp
android:layout_weight=1
android:text=start
 /
Button
android:id=@+id/stopButton
android:layout_width=fill_parent
android:layout_height=0dp
android:layout_weight=1
android:text=stop
 /
/LinearLayout
It is quite simple. There are two buttons. One is start and the other
is stop.

And an Activity as follows:
package button.test;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {
private static final String TAG = MainActivity;
private Button startButton;
private Button stopButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
startButton = (Button)findViewById(R.id.startButton);
startButton.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
Log.d(TAG,startButton isEnabled(): 
+arg0.isEnabled()+ executing
on thread + Thread.currentThread().getName());
if(arg0.isEnabled()==false){
throw new 
RuntimeException(startButton);
}
arg0.setEnabled(false);
stopButton.setEnabled(true);
}
});
stopButton = (Button)findViewById(R.id.stopButton);
stopButton.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
Log.d(TAG,stopButton isEnabled(): 
+arg0.isEnabled()+ executing
on thread + Thread.currentThread().getName());
if(arg0.isEnabled()==false){
throw new 
RuntimeException(stopButton);
}
arg0.setEnabled(false);
startButton.setEnabled(true);
}
});
}
}
The logic is: (1)When the start button is clicked, disable it and
enable the stop button. (2)When the stop button is clicked, disable it
and enable the start button.

What I expect is that when the onClickListener of a button is
executing, the button state should be enabled. It is impossible to
fire the onClickListener when the button is disabled. Therefore, I add
the if block and the RuntimeException to detect it.

It works when I interact with it but it crashes when I run the monkey
test (adb shell monkey -p button.test -v 5).

The logcat messages are as follows:
D/MainActivity(1836): startButton isEnabled(): true main
D/MainActivity(1836): stopButton isEnabled(): true main
D/MainActivity(1836): startButton isEnabled(): true main
D/MainActivity(1836): startButton isEnabled(): false main
D/AndroidRuntime(1836): Shutting down VM
W/dalvikvm(1836): threadid=1: thread exiting with uncaught exception
(group=0x41745300)
E/AndroidRuntime(1836): FATAL EXCEPTION: main
E/AndroidRuntime(1836): java.lang.RuntimeException: startButton
E/AndroidRuntime(1836): at button.test.MainActivity
$1.onClick(MainActivity.java:24)
E/AndroidRuntime(1836): at android.view.View.performClick(View.java:
4084)
E/AndroidRuntime(1836): at android.view.View
$PerformClick.run(View.java:16966)
E/AndroidRuntime(1836): at
android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime(1836): at
android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(1836): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(1836): at
android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime(1836): at
java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(1836): at
java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(1836): at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime(1836): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(1836): at dalvik.system.NativeStart.main(Native
Method)

Note that at line 4, the button state is disabled when the
onClickListener is executing!!! It is quite strange. In addition, both
the onClickListeners are run on the main thread.
What I expect is that there is no race condition between the

Re: [android-developers] Button#onClickListener thread unsafe?

2012-10-14 Thread Gergely Juhász
The input events are queued. So your case is valid. When you disable a
button there can be already multiple events in the event queue. Sad
but true :(

On 14 October 2012 10:09, Greenhand cooperateonl...@gmail.com wrote:
 In my project, I has a layout as follows:
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/
 android
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:orientation=vertical

 Button
 android:id=@+id/startButton
 android:layout_width=fill_parent
 android:layout_height=0dp
 android:layout_weight=1
 android:text=start
  /
 Button
 android:id=@+id/stopButton
 android:layout_width=fill_parent
 android:layout_height=0dp
 android:layout_weight=1
 android:text=stop
  /
 /LinearLayout
 It is quite simple. There are two buttons. One is start and the other
 is stop.

 And an Activity as follows:
 package button.test;

 import android.app.Activity;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.View;
 import android.widget.Button;

 public class MainActivity extends Activity {
 private static final String TAG = MainActivity;
 private Button startButton;
 private Button stopButton;
 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 startButton = (Button)findViewById(R.id.startButton);
 startButton.setOnClickListener(new View.OnClickListener() {

 @Override
 public void onClick(View arg0) {
 Log.d(TAG,startButton isEnabled(): 
 +arg0.isEnabled()+ executing
 on thread + Thread.currentThread().getName());
 if(arg0.isEnabled()==false){
 throw new 
 RuntimeException(startButton);
 }
 arg0.setEnabled(false);
 stopButton.setEnabled(true);
 }
 });
 stopButton = (Button)findViewById(R.id.stopButton);
 stopButton.setOnClickListener(new View.OnClickListener() {

 @Override
 public void onClick(View arg0) {
 Log.d(TAG,stopButton isEnabled(): 
 +arg0.isEnabled()+ executing
 on thread + Thread.currentThread().getName());
 if(arg0.isEnabled()==false){
 throw new 
 RuntimeException(stopButton);
 }
 arg0.setEnabled(false);
 startButton.setEnabled(true);
 }
 });
 }
 }
 The logic is: (1)When the start button is clicked, disable it and
 enable the stop button. (2)When the stop button is clicked, disable it
 and enable the start button.

 What I expect is that when the onClickListener of a button is
 executing, the button state should be enabled. It is impossible to
 fire the onClickListener when the button is disabled. Therefore, I add
 the if block and the RuntimeException to detect it.

 It works when I interact with it but it crashes when I run the monkey
 test (adb shell monkey -p button.test -v 5).

 The logcat messages are as follows:
 D/MainActivity(1836): startButton isEnabled(): true main
 D/MainActivity(1836): stopButton isEnabled(): true main
 D/MainActivity(1836): startButton isEnabled(): true main
 D/MainActivity(1836): startButton isEnabled(): false main
 D/AndroidRuntime(1836): Shutting down VM
 W/dalvikvm(1836): threadid=1: thread exiting with uncaught exception
 (group=0x41745300)
 E/AndroidRuntime(1836): FATAL EXCEPTION: main
 E/AndroidRuntime(1836): java.lang.RuntimeException: startButton
 E/AndroidRuntime(1836): at button.test.MainActivity
 $1.onClick(MainActivity.java:24)
 E/AndroidRuntime(1836): at android.view.View.performClick(View.java:
 4084)
 E/AndroidRuntime(1836): at android.view.View
 $PerformClick.run(View.java:16966)
 E/AndroidRuntime(1836): at
 android.os.Handler.handleCallback(Handler.java:615)
 E/AndroidRuntime(1836): at
 android.os.Handler.dispatchMessage(Handler.java:92)
 E/AndroidRuntime(1836): at android.os.Looper.loop(Looper.java:137)
 E/AndroidRuntime(1836): at
 android.app.ActivityThread.main(ActivityThread.java:4745)
 E/AndroidRuntime(1836): at
 java.lang.reflect.Method.invokeNative(Native Method)
 E/AndroidRuntime(1836): at
 java.lang.reflect.Method.invoke(Method.java:511)
 E/AndroidRuntime(1836): at com.android.internal.os.ZygoteInit
 $MethodAndArgsCaller.run(ZygoteInit.java:786)
 E/AndroidRuntime(1836): at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
 

Re: [android-developers] Button#onClickListener thread unsafe?

2012-10-14 Thread Lew
svins wrote:

 The input events are queued. So your case is valid. When you disable a 
 button there can be already multiple events in the event queue. Sad 
 but true :( 

 Greenhand wrote: 
  In my project, I has a layout as follows: 
  LinearLayout xmlns:android=http://schemas.android.com/apk/res/ 
  android 
  android:layout_width=fill_parent 
  android:layout_height=fill_parent 
  android:orientation=vertical 
  
  Button 
  android:id=@+id/startButton 
  android:layout_width=fill_parent 
  android:layout_height=0dp 
  android:layout_weight=1 
  android:text=start 
   / 
  Button 
  android:id=@+id/stopButton 
  android:layout_width=fill_parent 
  android:layout_height=0dp 
  android:layout_weight=1 
  android:text=stop 
   / 
  /LinearLayout 
  It is quite simple. There are two buttons. One is start and the other 
  is stop. 
  
  And an Activity as follows: 
  package button.test; 
  
  import android.app.Activity; 
  import android.os.Bundle; 
  import android.util.Log; 
  import android.view.View; 
  import android.widget.Button; 
  
  public class MainActivity extends Activity { 
  private static final String TAG = MainActivity; 
  private Button startButton; 
  private Button stopButton; 
  @Override 
  public void onCreate(Bundle savedInstanceState) { 
  super.onCreate(savedInstanceState); 
  setContentView(R.layout.activity_main); 
  startButton = (Button)findViewById(R.id.startButton); 
  startButton.setOnClickListener(new View.OnClickListener() { 
  
  @Override 
  public void onClick(View arg0) { 
  Log.d(TAG,startButton isEnabled(): 
 +arg0.isEnabled()+ executing 
  on thread + Thread.currentThread().getName()); 
  if(arg0.isEnabled()==false){ 
  throw new 
 RuntimeException(startButton); 
  } 
  arg0.setEnabled(false); 
  stopButton.setEnabled(true); 
  } 
  }); 
  stopButton = (Button)findViewById(R.id.stopButton); 
  stopButton.setOnClickListener(new View.OnClickListener() { 
  
  @Override 
  public void onClick(View arg0) { 
  Log.d(TAG,stopButton isEnabled(): 
 +arg0.isEnabled()+ executing 
  on thread + Thread.currentThread().getName()); 
  if(arg0.isEnabled()==false){ 
  throw new 
 RuntimeException(stopButton); 
  } 
  arg0.setEnabled(false); 
  startButton.setEnabled(true); 
  } 
  }); 
  } 
  } 
  The logic is: (1)When the start button is clicked, disable it and 
  enable the stop button. (2)When the stop button is clicked, disable it 
  and enable the start button. 
  
  What I expect is that when the onClickListener of a button is 
  executing, the button state should be enabled. It is impossible to 
  fire the onClickListener when the button is disabled. Therefore, I add 
  the if block and the RuntimeException to detect it. 
  
  It works when I interact with it but it crashes when I run the monkey 
  test (adb shell monkey -p button.test -v 5). 
  
  The logcat messages are as follows: 
  D/MainActivity(1836): startButton isEnabled(): true main 
  D/MainActivity(1836): stopButton isEnabled(): true main 
  D/MainActivity(1836): startButton isEnabled(): true main 
  D/MainActivity(1836): startButton isEnabled(): false main 
  D/AndroidRuntime(1836): Shutting down VM 
  W/dalvikvm(1836): threadid=1: thread exiting with uncaught exception 
  (group=0x41745300) 
  E/AndroidRuntime(1836): FATAL EXCEPTION: main 
  E/AndroidRuntime(1836): java.lang.RuntimeException: startButton 
  E/AndroidRuntime(1836): at button.test.MainActivity 
  $1.onClick(MainActivity.java:24) 
  E/AndroidRuntime(1836): at 
 android.view.View.performClick(View.java: 
  4084) 
  E/AndroidRuntime(1836): at android.view.View 
  $PerformClick.run(View.java:16966) 
  E/AndroidRuntime(1836): at 
  android.os.Handler.handleCallback(Handler.java:615) 
  E/AndroidRuntime(1836): at 
  android.os.Handler.dispatchMessage(Handler.java:92) 
  E/AndroidRuntime(1836): at 
 android.os.Looper.loop(Looper.java:137) 
  E/AndroidRuntime(1836): at 
  android.app.ActivityThread.main(ActivityThread.java:4745) 
  E/AndroidRuntime(1836): at 
  java.lang.reflect.Method.invokeNative(Native Method) 
  E/AndroidRuntime(1836): at 
  java.lang.reflect.Method.invoke(Method.java:511) 
  

[android-developers] button does not appear for new Android application in eclipse IDE

2012-10-12 Thread Alex Jiménez
Soy nuevo en esto, quiero empezar a desarrollar aplicaciones para Android e 
instalar el SDK de Android y el Eclipse Java EE Java 7u7 IDE para 
desarrolladores web, además de la instalación de plug-in android en 
eclipse, pero en la barra de tareas en el botón otra vez yo no te para 
hacer una nueva aplicación para Android, quisiera saver que fallar o 
aparecer como el hace o que optan por desarrollar

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button does not appear for new Android application in eclipse IDE

2012-10-12 Thread Justin Anderson
   1. Go to File -- New -- Project
   2. In the dialog that opens, Android is one of the options in the list

P.S.  It is generally a good idea to post your questions in English...
Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


2012/10/9 Alex Jiménez ing.alex.jime...@gmail.com

 Soy nuevo en esto, quiero empezar a desarrollar aplicaciones para Android
 e instalar el SDK de Android y el Eclipse Java EE Java 7u7 IDE para
 desarrolladores web, además de la instalación de plug-in android en
 eclipse, pero en la barra de tareas en el botón otra vez yo no te para
 hacer una nueva aplicación para Android, quisiera saver que fallar o
 aparecer como el hace o que optan por desarrollar

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button (onClick)

2012-10-01 Thread Алексей Фенев


https://docs.google.com/drawings/pub?id=18u7ZqCM-13k_OxO3ecm7UXftoWMcBScpGo-wL4WtRjww=174h=76
Hello! When I add an event handler of button onClick, for example: 
android:onClick=click, I get a fail: instead of my widget in emulator I 
have a message Problem loading widget. 
What do you think, how fix it?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Button (onClick)

2012-10-01 Thread TreKing
On Sun, Sep 30, 2012 at 8:21 AM, Алексей Фенев alexeyfe...@gmail.comwrote:

 What do you think, how fix it?


Try debugging your app. Look at Logcat, for starters.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button change onClick

2012-08-31 Thread Xiao.Yang
use selector is the right way...

在 2012年8月31日星期五UTC+8上午1时55分33秒,MagouyaWare写道:

 Use a statelist drawable, also known as a selector:

 http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware


 On Thu, Aug 30, 2012 at 11:47 AM, oriolmesia mesi...@gmail.comjavascript:
  wrote:

 Hi guys, I have an issue with the final tweak of my new app.

 Now that I'm nearly to finish I'm looking to improve my interface. What I 
 want it's just to see how my buttons change when someone pressed on them, 
 only for the amount of time that the button remain pressed.

 The buttons on my app are image buttons with some text situated on them.


 The only way to do that it's to change the button image or the text over 
 the button? What kind of event I need to use, onClick method here it's 
 useless?



 Thank you for your help,



 Oriol

 -- 
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to 
 android-d...@googlegroups.comjavascript:
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button change onClick

2012-08-31 Thread oriol mesia
thank you all for your answers, this idea works perfectly

2012/8/31 Xiao.Yang yangxiao1...@gmail.com

 use selector is the right way...

 在 2012年8月31日星期五UTC+8上午1时55分33秒,MagouyaWare写道:

 Use a statelist drawable, also known as a selector:
 http://developer.android.com/**guide/topics/resources/**
 drawable-resource.html#**StateListhttp://developer.android.com/guide/topics/resources/drawable-resource.html#StateList

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/**magouyawarehttp://sites.google.com/site/magouyaware


 On Thu, Aug 30, 2012 at 11:47 AM, oriolmesia mesi...@gmail.com wrote:

 Hi guys, I have an issue with the final tweak of my new app.

 Now that I'm nearly to finish I'm looking to improve my interface. What
 I want it's just to see how my buttons change when someone pressed on them,
 only for the amount of time that the button remain pressed.

 The buttons on my app are image buttons with some text situated on them.


 The only way to do that it's to change the button image or the text over
 the button? What kind of event I need to use, onClick method here it's
 useless?



 Thank you for your help,



 Oriol

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-d...@**googlegroups.com

 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] button change onClick

2012-08-30 Thread oriolmesia
Hi guys, I have an issue with the final tweak of my new app.

Now that I'm nearly to finish I'm looking to improve my interface. What I 
want it's just to see how my buttons change when someone pressed on them, 
only for the amount of time that the button remain pressed.

The buttons on my app are image buttons with some text situated on them.


The only way to do that it's to change the button image or the text over 
the button? What kind of event I need to use, onClick method here it's 
useless?



Thank you for your help,



Oriol

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button change onClick

2012-08-30 Thread Justin Anderson
Use a statelist drawable, also known as a selector:
http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Thu, Aug 30, 2012 at 11:47 AM, oriolmesia mesia@gmail.com wrote:

 Hi guys, I have an issue with the final tweak of my new app.

 Now that I'm nearly to finish I'm looking to improve my interface. What I
 want it's just to see how my buttons change when someone pressed on them,
 only for the amount of time that the button remain pressed.

 The buttons on my app are image buttons with some text situated on them.


 The only way to do that it's to change the button image or the text over
 the button? What kind of event I need to use, onClick method here it's
 useless?



 Thank you for your help,



 Oriol

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button change onClick

2012-08-30 Thread Liem.T Vo
Please refer at url 
http://developer.android.com/guide/topics/ui/controls/button.html:


I copied from that location for you:

Custom background

If you want to truly redefine the appearance of your button, you can 
specify a custom background. Instead of supplying a simple bitmap or 
color, however, your background should be a state list resource that 
changes appearance depending on the button's current state.


You can define the state list in an XML file that defines three 
different images or colors to use for the different button states.


To create a state list drawable for your button background:

Create three bitmaps for the button background that represent the 
default, pressed, and focused button states.
To ensure that your images fit buttons of various sizes, create the 
bitmaps as Nine-patch bitmaps.
Place the bitmaps into the res/drawable/ directory of your project. Be 
sure each bitmap is named properly to reflect the button state that they 
each represent, such as button_default.9.png, button_pressed.9.png, and 
button_focused.9.png.
Create a new XML file in the res/drawable/ directory (name it something 
like button_custom.xml). Insert the following XML:

?xml version=1.0 encoding=utf-8?
selector xmlns:android=http://schemas.android.com/apk/res/android;
item android:drawable=@drawable/button_pressed
  android:state_pressed=true /
item android:drawable=@drawable/button_focused
  android:state_focused=true /
item android:drawable=@drawable/button_default /
/selector
This defines a single drawable resource, which will change its image 
based on the current state of the button.
The first item defines the bitmap to use when the button is pressed 
(activated).
The second item defines the bitmap to use when the button is focused 
(when the button is highlighted using the trackball or directional pad).
The third item defines the bitmap to use when the button is in the 
default state (it's neither pressed nor focused).
Note: The order of the item elements is important. When this drawable 
is referenced, the item elements are traversed in-order to determine 
which one is appropriate for the current button state. Because the 
default bitmap is last, it is only applied when the conditions 
android:state_pressed and android:state_focused have both evaluated as 
false.
This XML file now represents a single drawable resource and when 
referenced by a Button for its background, the image displayed will 
change based on these three states.


Best regards,
Liem.V
On 8/31/12 12:47 AM, oriolmesia wrote:

Hi guys, I have an issue with the final tweak of my new app.

Now that I'm nearly to finish I'm looking to improve my interface. 
What I want it's just to see how my buttons change when someone 
pressed on them, only for the amount of time that the 
button remain pressed.


The buttons on my app are image buttons with some text situated on them.


The only way to do that it's to change the button image or the text 
over the button? What kind of event I need to use, onClick method here 
it's useless?




Thank you for your help,



Oriol
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en 


--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button that goes to website

2012-08-06 Thread techno
I've been searching for hours to find this, and couldn't so I decided to 
create a thread here.
I want to create a button that will open a webpage. 
Can someone tell me how?
If possible I would like to have info on each part so that I will learn 
it...
Thanks guys!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Button that goes to website

2012-08-06 Thread TreKing
On Sun, Aug 5, 2012 at 6:38 PM, techno 1.jonathan.pi...@gmail.com wrote:

 I've been searching for hours to find this, and couldn't


Seriously? You couldn't find anything anywhere about creating *a button*?
Or anything about *opening a webpage*? Did you try Google?


 I want to create a button that will open a webpage.
 Can someone tell me how?


 Just watch this instructional video:
http://lmgtfy.com/?q=android+button+open+web+page

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Button that goes to website

2012-08-06 Thread Justin Anderson

 Did you try Google?


I've heard some rumors about Google becoming the next big search company...
:-)

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, Aug 6, 2012 at 4:13 PM, TreKing treking...@gmail.com wrote:

 On Sun, Aug 5, 2012 at 6:38 PM, techno 1.jonathan.pi...@gmail.com wrote:

 I've been searching for hours to find this, and couldn't


 Seriously? You couldn't find anything anywhere about creating *a button*?
 Or anything about *opening a webpage*? Did you try Google?


 I want to create a button that will open a webpage.
 Can someone tell me how?


  Just watch this instructional video:
 http://lmgtfy.com/?q=android+button+open+web+page


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button

2012-06-21 Thread bob
Are you talking about using this?

void setOnTouchListener(View.OnTouchListener l)


On Wednesday, June 20, 2012 10:34:42 AM UTC-5, Kristopher Micinski wrote:

 Sure, in the onPressed event, change the image, when it's not pressed, 
 change it back.? 

 kris 

 On Wed, Jun 20, 2012 at 11:32 AM, bob b...@coolfone.comze.com wrote: 
  I'm trying to make a button that uses two different images - one for 
 when it 
  is pressed, and one for when it's not. 
  
  
  Anyone know an easy way to do this? 
  
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Android Developers group. 
  To post to this group, send email to android-developers@googlegroups.com 
  To unsubscribe from this group, send email to 
  android-developers+unsubscr...@googlegroups.com 
  For more options, visit this group at 
  http://groups.google.com/group/android-developers?hl=en 


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button

2012-06-21 Thread sajjan androiddeveloper
Use selector that will be easy for you

On Thu, Jun 21, 2012 at 3:22 PM, bob b...@coolfone.comze.com wrote:

 Are you talking about using this?

 void setOnTouchListener(View.OnTouchListener l)


 On Wednesday, June 20, 2012 10:34:42 AM UTC-5, Kristopher Micinski wrote:

 Sure, in the onPressed event, change the image, when it's not pressed,
 change it back.?

 kris

 On Wed, Jun 20, 2012 at 11:32 AM, bob b...@coolfone.comze.com wrote:
  I'm trying to make a button that uses two different images - one for
 when it
  is pressed, and one for when it's not.
 
 
  Anyone know an easy way to do this?
 
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button

2012-06-21 Thread jagruti sangani
Hello,
if you want to just differenciate the button images then use the one xml
and define the two image one for default and one for press and set that xml
as background of button.It will solve your problem ok.

On Wed, Jun 20, 2012 at 9:02 PM, bob b...@coolfone.comze.com wrote:

 I'm trying to make a button that uses two different images - one for when
 it is pressed, and one for when it's not.


 Anyone know an easy way to do this?


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Regards
jagruti Sangani
*iNextrix Technologies*

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] button

2012-06-20 Thread bob
 

I'm trying to make a button that uses two different images - one for when 
it is pressed, and one for when it's not.


Anyone know an easy way to do this?


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button

2012-06-20 Thread Kristopher Micinski
Sure, in the onPressed event, change the image, when it's not pressed,
change it back.?

kris

On Wed, Jun 20, 2012 at 11:32 AM, bob b...@coolfone.comze.com wrote:
 I'm trying to make a button that uses two different images - one for when it
 is pressed, and one for when it's not.


 Anyone know an easy way to do this?


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] button

2012-06-20 Thread Mark Murphy
Or take a peek at ToggleButton, or create your own CompoundButton.

BTW, we are assuming that by pressed you mean a persistent status
change (what Android refers to as checked), as in a CheckBox or
RadioButton..

On Wed, Jun 20, 2012 at 11:34 AM, Kristopher Micinski
krismicin...@gmail.com wrote:
 Sure, in the onPressed event, change the image, when it's not pressed,
 change it back.?

 kris

 On Wed, Jun 20, 2012 at 11:32 AM, bob b...@coolfone.comze.com wrote:
 I'm trying to make a button that uses two different images - one for when it
 is pressed, and one for when it's not.


 Anyone know an easy way to do this?


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] button

2012-06-20 Thread Kristopher Micinski
On Wed, Jun 20, 2012 at 11:38 AM, Mark Murphy mmur...@commonsware.com wrote:
 Or take a peek at ToggleButton, or create your own CompoundButton.

 BTW, we are assuming that by pressed you mean a persistent status
 change (what Android refers to as checked), as in a CheckBox or
 RadioButton..


Ah, I actually assumed the other way, otherwise I would have pointed
him at ToggleButton :-)

kris

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] button

2012-06-20 Thread Mark Murphy
On Wed, Jun 20, 2012 at 11:45 AM, Kristopher Micinski
krismicin...@gmail.com wrote:
 On Wed, Jun 20, 2012 at 11:38 AM, Mark Murphy mmur...@commonsware.com wrote:
 Or take a peek at ToggleButton, or create your own CompoundButton.

 BTW, we are assuming that by pressed you mean a persistent status
 change (what Android refers to as checked), as in a CheckBox or
 RadioButton..


 Ah, I actually assumed the other way, otherwise I would have pointed
 him at ToggleButton :-)

Ah, right, sorry.

So many choices, so little time... :-)

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] button

2012-06-20 Thread Justin Anderson

 Sure, in the onPressed event, change the image, when it's not pressed,
 change it back.?


Or you can do it with a selector  If you save the following xml to a
file called btnImage.xml:

?xml version=1.0 encoding=utf-8?
selector
xmlns:android=http://schemas.android.com/apk/res/android;
android:constantSize=true

item android:state_pressed=true
android:drawable=@drawable/pressed_image /
item android:drawable=@drawable/normal_image /
/selector

Then you would just set the image of your button to your selector drawable:

Code: btn.SetImageResource(R.drawable.btnImage);
XML: android:src=@drawable/btnImage

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jun 20, 2012 at 9:45 AM, Kristopher Micinski krismicin...@gmail.com
 wrote:

 On Wed, Jun 20, 2012 at 11:38 AM, Mark Murphy mmur...@commonsware.com
 wrote:
  Or take a peek at ToggleButton, or create your own CompoundButton.
 
  BTW, we are assuming that by pressed you mean a persistent status
  change (what Android refers to as checked), as in a CheckBox or
  RadioButton..
 

 Ah, I actually assumed the other way, otherwise I would have pointed
 him at ToggleButton :-)

 kris

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button in listitem in listview unclickable

2012-05-31 Thread mizyeh
Hi all,

I found a weird scenario which is button in listitem in listview are
unclickable unless scroll listview to the last listitem,

after some research seems the problem is occurred by the layout
Relativelayout1-Relativelayout2-Listview ,

If you move Listview into the Relativelayout1 it will work fine.

you may see exactly what happens by download this sample project .

http://www.ingree.com/issue.zip

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button is not actionable when i set to button background color

2012-05-21 Thread srinivasa reddy avula
Hi friends,

i am facing the one issue in android.


issue is in single alert box we display 16 buttons with different back
ground colors and we handling the listener for getting the  result
which button is clicked(setonclick listener) but button is not
actionable(requirement is Color selector box).

Regards
Srinivas

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button is not actionable when i set to button background color

2012-05-21 Thread Jason Teagle

issue is in single alert box we display 16 buttons with different back
ground colors and we handling the listener for getting the  result
which button is clicked(setonclick listener) but button is not
actionable(requirement is Color selector box).


It seems unlikely that just changing its colour would make any difference. 
Try temporarily *not* changing the background colour of the buttons - do 
they now become 'actionable'?


When you say 'not actionable', what exactly do you mean? Do you mean that 
you are not going through your listener's onClick() method? How do you know 
this - have you tried using a quick Toast to prove (or disprove) you are at 
least getting *into* that method? (It may be getting into the method, but 
something goes wrong later in the method and it doesn't complete all the 
actions you are expecting).


Anything unexpected in the LogCat?

If neither of the above quick things help for testing purposes, try 
temporarily creating a new project with one activity and two buttons, set 
one's background colour to yellow and leave the other one with its normal 
colour. Add the listener to both and put a little Toast in the onClick() to 
show it gets that far. If *that* doesn't work, then post the code for that 
*test* project so we can see how you're doing things (one activity + two 
buttons should be a nice, short piece of code).


If the test project works, then it suggests something else in your main 
project is interfering and you'll have to start commenting bits out until 
you find the culprit.



--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button Style programmaticaly

2012-04-26 Thread Joel
Hi,

I am a new Android developer and i have a problem with buttons and
styles.

I have to create buttons with java code and I want set a specific
style.

My code:

in values directory -- styles.xml

?xml version=1.0 encoding=utf-8?
resources
style name=ButtonText
item name=android:layout_widthfill_parent/item
item name=android:layout_heightwrap_content/item
item name=android:gravitycenter_vertical/item
item name=android:layout_margin3dp/item
item name=android:textColor#303a39/item
item name=android:shadowColor#8a9493/item
item name=android:shadowDx1/item
item name=android:shadowDy1/item
item name=android:shadowRadius2/item
item name=android:drawableRight@drawable/icon_button/item
/style
/resources

in Activity I have

private void generateButtons(){
LinearLayout layout = (LinearLayout)
findViewById(R.id.contentLayout);

IteratorLanguage itr = languages.iterator();
while (itr.hasNext()) {
Language l = itr.next();
Button createButton = new Button(this,null,R.style.ButtonText);
createButton.setId(l.getId());

createButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.button));
createButton.setText(l.getName());
layout.addView(createButton);
}
}

In construct I pass the button style but it doesn't work. Any idea?

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] button click event listener

2012-04-05 Thread Vivek Punjabi
I am having problem with onclick event listener.I am building a card
game for which i have to wait for button click by the user, after each
round. So I've used a recursive function. My code looks like

oncreate()
{
function1( );
//wait for onclick event
function2( );  //After some calculation, calls function1( )
}

Should I use a different activity or the same one for UI, logic and
click event?
Can u suggest me the structure of my game as I am a newbie in Android
programming?
Thanks in advance

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] button click event listener

2012-04-05 Thread Justin Anderson

 oncreate()
 {
 function1( );
 //wait for onclick event
 function2( );  //After some calculation, calls function1( )
 }

That won't work... The UI will not show up until after onCreate() and
onResume() are called.  Why are you explicitly waiting for a click event?
What are you doing to do that, an infinite loop or something?

Can u suggest me the structure of my game as I am a newbie in Android
 programming?

Seems like you need to read up on the Android Activity lifecycle:
http://developer.android.com/guide/topics/fundamentals/activities.html#Lifecycle

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Thu, Apr 5, 2012 at 2:58 AM, Vivek Punjabi vivekpunjab...@gmail.comwrote:

 oncreate()
 {
 function1( );
 //wait for onclick event
 function2( );  //After some calculation, calls function1( )
 }


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button cannot be clicked when used with an IME

2012-03-14 Thread tsukishiro yamazaki
Hello everyone,

My custom IME is slowly coming to life! Thanks to all the people who have 
replied to my posts regarding my IME. I hope I can get the same support for 
this question too. So here it is. Up until now, I have been using 
KeyboardView as the root tag in the layout xml for my InputView. Now, I am 
thinking of replacing it with a general View that contains something like a 
RelativeLayout and several buttons. Inflating the layout and getting it 
displayed as my new InputView for the IME have no problems. But when I try 
to click on any of the buttons in the new InputView, it seems I cannot fire 
any click event at all. 

Does anyone know how to resolved this problem? 
Hoping for your support. Thanks and best regards,
- tsukishiro

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button cannot be clicked when used with an IME

2012-03-14 Thread tsukishiro yamazaki
Hello everyone,

My custom IME is slowly coming to life! Thanks to all the people who have 
replied to my posts regarding my IME. I hope I can get the same support for 
this question too. So here it is. Up until now, I have been using 
KeyboardView as the root tag in the layout xml for my InputView. Now, I am 
thinking of replacing it with a general View that contains something like a 
RelativeLayout and several buttons. Inflating the layout and getting it 
displayed as my new InputView for the IME have no problems. But when I try 
to click on any of the buttons in the new InputView, it seems I cannot fire 
any click event at all. 

Does anyone know how to resolved this problem? 
Hoping for your support. Thanks and best regards,
- tsukishiro

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button animation

2012-03-13 Thread Tytanit
I need help - i am new to android, and i couldn't solve my problem at
my own, so i'm posting here -
I've got an image animation,  a few buttons, and an animation files
( xml) written. What i want to do, is to make a button animation ( i
don't know to bound a button with an animation) , following image
animation with a little delay - what functions should i use? What
should the code look like?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button animation

2012-03-13 Thread Marcin Orlowski
On 12 March 2012 16:47, Tytanit tyta...@gmail.com wrote:

 I need help - i am new to android, and i couldn't solve my problem at
 my own, so i'm posting here -
 I've got an image animation,  a few buttons, and an animation files
 ( xml) written. What i want to do, is to make a button animation ( i
 don't know to bound a button with an animation) , following image
 animation with a little delay - what functions should i use? What
 should the code look like?


View button = (View)findViewById( R.id.my_button );
button.startAnimation( AnimationUtils.loadAnimation(
R.anim.anim_for_my_button ) );

you can safely stick to View instead of i.e. ImageButton in case of
applying animation.

Regards,
Marcin Orlowski

*Tray Agenda http://bit.ly/trayagenda* - keep you daily schedule handy...
*Date In Tray* http://bit.ly/dateintraypro - current date at glance...
WebnetMobile on *Facebook http://webnetmobile.com/fb/*,
*Google+*http://bit.ly/webnetmobile-gpand
*Twitter http://webnetmobile.com/twitter/*

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button for dynamic text

2012-02-22 Thread Pram
I am writing a program that when the user enter a number text appears
according to that number. My problem is that the button line has
public void ... after this I am trying to use if statements and return
methods, but because of the public void, the return method can not
return anything. I tried to close the public void, but I am getting
errors. Please help. The code is as follows. I have included the
different codes that I have tried like toast, etc..

ente@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
  Button button = (Button)findViewById(R.id.go);
  button.setOnClickListener(mAddListener);

//  tv = (TextView) findViewById(R.id.textView1);
}

private OnClickListener mAddListener = new OnClickListener()
{
public void onClick(View v) {
}}
;
//Toast.makeText(Num.this, This Display,
Toast.LENGTH_SHORT).show();
//toast.show();
//finish ();
//  long id = 0;

// try { PleaseEnter=(EditText)findViewById(R.id.PleaseEnter);

  {
  }

  if (PleaseEnter.equals(1))
 // tv.setText(This is the display 1.);
  return This display;

   //   Context context = getApplicationContext();
 // CharSequence text =this display;
 // int duration =Toast.LENGTH_LONG;
 // Toast toast =Toast.makeText(context, text, duration);
//toast.show();
else if  (PleaseEnter.equals(2))
return;
//tv.setText(Dispaly 2);

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button for dynamic text

2012-02-22 Thread TreKing
On Wed, Feb 22, 2012 at 1:45 PM, Pram goodp...@gmail.com wrote:

 My problem is that the button line has public void ... after this I am
 trying to use if statements and return methods, but because of the public
 void, the return method can not return anything. I tried to close the
 public void, but I am getting errors.


How well do you know Java? It sounds like you're getting hung up over
language syntax and semantics. If that's the case, you need to brush up on
Java, which is off-topic for this list.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button textAppearance Problem.Someone Help me!!

2012-02-16 Thread Henry
Dear All:
Im a chinese,my english is not very good,but a problem troubled me for
few days.Im a beginer.
Someone had the same problem on inernet, but the anwsers did not help
me.
I coped the code from someone on inernet.
--
Button
android:layout_width=179dp
android:layout_height=match_parent
android:layout_centerHorizontal=true
android:background=@drawable/bg_act_incall_actions_end_call
android:text=End Call
android:textAppearance=@style/TextInCallEndCallButton
style=@style/SimpleBlackShadow
/
and a TextInCallEndCallButton style:
style name=TextInCallEndCallButton
item name=android:textSize20sp/item
item name=android:textColor#ff/item
item name=android:textStylebold/item
/style
The button color (the text) will stay BLACK.
Now, when I'm setting android:textColor directly on the Button, it
works.
So, supposed textAppearance is not working, the button label would
still be BOLD and in the specified size of 20sp.

I just want to know why the textColor in textAppearance is not work...
and 3ks.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button enabled issue

2012-02-11 Thread Raju Gaddam
Hi iam disable button in xml .how to enable button from my activity class


in XMl i write like this   android:visibility=invisible
in my activity button.setEnabled(true);

But button is not visible please any one help me

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Button enabled issue

2012-02-11 Thread T.M.S.VIJAYKUMARR
button.setVisibility(View.VISIBLE);

try this one it will help you

On Sat, Feb 11, 2012 at 4:12 PM, Raju Gaddam gaddam967...@gmail.com wrote:

 Hi iam disable button in xml .how to enable button from my activity class


 in XMl i write like this   android:visibility=invisible
 in my activity button.setEnabled(true);

 But button is not visible please any one help me

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 




-
Thanks  Regards,
T.M.S.VIJAYKUMARR
BloG:http://iamvijayakumar.blogspot.com/

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Button clicking colour change problem

2012-01-13 Thread TreKing
On Fri, Jan 13, 2012 at 1:41 AM, B.Arunkumar
awsnetworkrecor...@gmail.comwrote:

 The colouring of the 2 buttons should appear sequentially because button
 clicking happens on the main thread, is it not?


A) There is nothing related to color in the code you posted.
B) If you have a Thread.Sleep() in a function that is executing in the main
thread (like anything View related) you Are Doing Something Wrong™

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button clicking colour change problem

2012-01-12 Thread B.Arunkumar
Hi,

I am having problem with colour change of 2 buttons:

This is a simple code that I tested out on a device:

 button1.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

try {
Thread.sleep(15000);
} catch (InterruptedException e) {
// TODO Auto-generated catch 
block
e.printStackTrace();
}
}

});



   button2.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

try {
Thread.sleep(15000);

} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

});

When I click on button1 and (while this is executing) click on button2
and back to button1, both button1 and button2 appear coloured blue.
Why is this happening? The colouring of the 2 buttons should appear
sequentially because button clicking happens on the main thread, is it
not?

(Actually, I posted the same question on an earlier thread too but I
have not been able to figure out why this is happening)

Thank you,
B.Arunkumar

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button on emulator looked joined with no padding

2012-01-11 Thread jlau
Hi
I was trying to arrange 9 Buttons in TableLayout.(main.xml below)

On the eclipse Graphical Layout, it looked ok, Buttons spaced out
nicely. Somehow on the emulator, all the 9 Buttons looked joined

Here's the screenshot:
http://www.freeimagehosting.net/sagst

Yet to try on actual device but does anyone know why this is
happening?

Thanks in advance!
--jason

?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 

TextView
android:id=@+id/score
android:layout_width=fill_parent
android:layout_height=wrap_content
android:gravity=center|bottom
android:text=@string/score
android:textSize=20dip /

TableLayout
android:layout_width=fill_parent
android:layout_height=wrap_content
android:stretchColumns=0,1,2 

TableRow 
Button
android:id=@+id/button1
/
Button
android:id=@+id/button2
android:text= /
Button
android:id=@+id/button3
android:text= /
/TableRow
TableRow 
Button
android:id=@+id/button4
android:text= /
Button
android:id=@+id/button5
android:text= /
Button
android:id=@+id/button6
android:text= /
/TableRow
TableRow 
Button
android:id=@+id/button7
android:text= /
Button
android:id=@+id/button8
android:text= /
Button
android:id=@+id/button9
android:text= /
/TableRow
/TableLayout

Button
android:id=@+id/rstButton
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=Restart /

/LinearLayout

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button on emulator looked joined with no padding

2012-01-11 Thread common user
Hi

Check this code

Image link :

http://www.freeimagehosting.net/d3xav

xml code:

?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
android:orientation=vertical 

TextView  android:gravity=center android:textSize=24dp
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=Sample program/

TableLayout
android:layout_width=fill_parent
android:layout_height=fill_parent
android:stretchColumns=0,1,2 

TableRow android:layout_width=fill_parent
android:layout_height=fill_parent
Button android:id=@+id/b1 android:text=01 /
Button android:id=@+id/b2 android:text=02/
Button android:id=@+id/b3 android:text=03/
/TableRow
TableRow 
Button android:id=@+id/b4 android:text=04/
Button android:id=@+id/b5 android:text=05/
Button android:id=@+id/b6 android:text=06/
/TableRow
TableRow 
Button android:id=@+id/b7 android:text=07/
Button android:id=@+id/b8 android:text=08/
Button android:id=@+id/b9 android:text=09/
/TableRow
TableRow android:gravity=center Button android:text=Hello
android:layout_height=fill_parent
android:layout_width=fill_parent//TableRow
/TableLayout

/LinearLayout



On Wed, Jan 11, 2012 at 10:29 PM, jlau marketisalwaysri...@gmail.comwrote:

 Hi
 I was trying to arrange 9 Buttons in TableLayout.(main.xml below)

 On the eclipse Graphical Layout, it looked ok, Buttons spaced out
 nicely. Somehow on the emulator, all the 9 Buttons looked joined

 Here's the screenshot:
 http://www.freeimagehosting.net/sagst

 Yet to try on actual device but does anyone know why this is
 happening?

 Thanks in advance!
 --jason

 ?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 

TextView
android:id=@+id/score
android:layout_width=fill_parent
android:layout_height=wrap_content
android:gravity=center|bottom
android:text=@string/score
android:textSize=20dip /

TableLayout
android:layout_width=fill_parent
android:layout_height=wrap_content
android:stretchColumns=0,1,2 

TableRow 
Button
android:id=@+id/button1
/
Button
android:id=@+id/button2
android:text= /
Button
android:id=@+id/button3
android:text= /
/TableRow
TableRow 
Button
android:id=@+id/button4
android:text= /
Button
android:id=@+id/button5
android:text= /
Button
android:id=@+id/button6
android:text= /
/TableRow
TableRow 
Button
android:id=@+id/button7
android:text= /
Button
android:id=@+id/button8
android:text= /
Button
android:id=@+id/button9
android:text= /
/TableRow
/TableLayout

Button
android:id=@+id/rstButton
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=Restart /

 /LinearLayout

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button not excepting typeface

2012-01-08 Thread Raghav Sood
Hi all,

I was updating the ui to one of my apps, and encountered a problem setting
the typeface of the button. According to the online docs, calling
setTypeface() on a button should work. However, I get the following error:

 java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.raghavsood.gravity/com.raghavsood.gravity.Forceometer}:
java.lang.ClassCastException: android.widget.TextView cannot be cast to
android.widget.Button
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread.access$600(ActivityThread.java:123)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-08 14:55:41.757: E/ACRA(15317): at
android.os.Handler.dispatchMessage(Handler.java:99)
01-08 14:55:41.757: E/ACRA(15317): at
android.os.Looper.loop(Looper.java:137)
01-08 14:55:41.757: E/ACRA(15317): at
android.app.ActivityThread.main(ActivityThread.java:4424)
01-08 14:55:41.757: E/ACRA(15317): at
java.lang.reflect.Method.invokeNative(Native Method)
01-08 14:55:41.757: E/ACRA(15317): at
java.lang.reflect.Method.invoke(Method.java:511)
01-08 14:55:41.757: E/ACRA(15317): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: android.widget.TextView
cannot be cast to android.widget.Button
  at com.raghavsood.gravity.Forceometer.onCreate(Forceometer.java:87)
  at android.app.Activity.performCreate(Activity.java:4465)
  at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
  at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
... 11 more


-- 
Raghav Sood
http://www.androidactivist.org/ - Author
http://www.appaholics.in/ - Founder

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button lick problem

2011-12-26 Thread B.Arunkumar
Hi,

  I have a problem with button click. This is what I have written in a
sample Activity:

 button1 = (Button) findViewById (R.id.button1);
 button2 = (Button) findViewById (R.id.button2);

 button1.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
try {
android.util.Log.e(Button1, 
clicked);
Thread.sleep(15000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

});

 button2.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

try {
android.util.Log.e(Button2, 
clicked);
Thread.sleep(15000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

});

This is what happens (We tested the application on Samsung Galaxy).
When we click on Button1 and then Button2 and button1 again, we see
that both button1 and button2 have changed theiir color to blue
simultaneously. Why is that the color of both the buttons change
simultaneously? As per this link:

http://android-developers.blogspot.com/2009/05/painless-threading.html

the button click event happens on the same main UI thread. In that
sense, both the buttons should not have changed their colors
simultaneously.

Thank you,
B.Arunkumar

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button lick problem

2011-12-26 Thread Mukesh Srivastav
Arun,

I am not sure what is the purpose of going to sleep mode, and secondly you
put a logs on the other abstract methods of your activity class. I would
suggest read the Android life cycle as well.

Warm Regards,
*Mukesh Kumar*,
Android Consultant/Freelancer,
India,Hyderabad.

On Mon, Dec 26, 2011 at 4:04 PM, B.Arunkumar
awsnetworkrecor...@gmail.comwrote:

 Hi,

  I have a problem with button click. This is what I have written in a
 sample Activity:

  button1 = (Button) findViewById (R.id.button1);
  button2 = (Button) findViewById (R.id.button2);

  button1.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
try {
android.util.Log.e(Button1,
 clicked);
Thread.sleep(15000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

});

  button2.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

try {
android.util.Log.e(Button2,
 clicked);
Thread.sleep(15000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

});

 This is what happens (We tested the application on Samsung Galaxy).
 When we click on Button1 and then Button2 and button1 again, we see
 that both button1 and button2 have changed theiir color to blue
 simultaneously. Why is that the color of both the buttons change
 simultaneously? As per this link:

 http://android-developers.blogspot.com/2009/05/painless-threading.html

 the button click event happens on the same main UI thread. In that
 sense, both the buttons should not have changed their colors
 simultaneously.

 Thank you,
 B.Arunkumar

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




--

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Button creation

2011-11-29 Thread TreKing
On Thu, Nov 24, 2011 at 8:00 AM, RameshKumar Mani rameshman...@gmail.comwrote:

 How can i create multiple buttons using for loop in thread


Read the documentation and learn to program.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button creation

2011-11-28 Thread RameshKumar Mani
How can i create multiple buttons using for loop in thread

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] button

2011-11-07 Thread bob
I have a button with some white text.  When pressed, the text needs to
change to dark gray.  Anyone know the best way to do this?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button Animation

2011-10-14 Thread F4L|{0
hi
I have a problem with an animation of a button.
I would move and fade a button from a origin position to another
position. well i created a translate animation and fade animation, i
start the animation with the follow code:

AnimationSet exchangeAnimation = new AnimationSet(true);
exchangeAnimation.setFillAfter(true);
exchangeAnimation.setAnimationListener(new AnimationListener() {
  public void onAnimationStart(Animation anim)
{button.setEnabled(false);}
  public void onAnimationRepeat(Animation anim) {}
  public void onAnimationEnd(Animation anim) {
  button.setEnabled(true);}});
exchangeAnimation.addAnimation(AnimationHelper.fadeAnimation(0,
1, 2000));
//i valori passati come fromX, toX, fromY e toY sono dati da un
rapporto e vanno da 0.0F a 1.0F
//quindi bisogna calcolari come pos voluta / width screen o
height screen

exchangeAnimation.addAnimation(AnimationHelper.translateAnimation(0.0F,
0.5F, 0.0F, 0.5F, 1500));
button.startAnimation(exchangeAnimation);

So, my problem is that while the button moves to the position that I
want, the hit area remains at the point of origin.

somebody can help me on how to correctly position the hit area of the
button?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button Animation

2011-10-14 Thread TreKing
On Fri, Oct 14, 2011 at 2:49 AM, F4L|{0 simone.dolcio...@gmail.com wrote:

 somebody can help me on how to correctly position the hit area of
 the button?


AFAIK, animations only make it look like an object is moving / scaling /
whatever. The actual position / size / whatever of the View in unchanged. If
you want the position to update, manually update it when the animation is
finished.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button not clickable while playing animation

2011-10-14 Thread buda gavril
I have a button which I need to be able to click on it white it is
playing an animation. here is the full source code:
http://pastie.org/2695839 Thanks

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button not clickable while playing animation

2011-10-14 Thread Justin Anderson
Gee that's a really cool idea... thanks for telling us about it.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Fri, Oct 14, 2011 at 11:01 AM, buda gavril dlbudagav...@gmail.comwrote:

 I have a button which I need to be able to click on it white it is
 playing an animation. here is the full source code:
 http://pastie.org/2695839 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button/ImageButton Rotation Not working

2011-10-11 Thread Chenna
Hi

I am trying to create a Button/ImageButton and rotating to required
degrees. I can able to rotate ImageView but same not working for
Button/ImageButton

ImageButton homeButton = new ImageButton (context);
homeButton.setOnClickListener(homeButtonListener);

 
homeButton.setScaleType(android.widget.ImageView.ScaleType.MATRIX);
 
homeButton.setBackgroundResource(ScannerConfiguration.homeButtonResource); //
0x7f020001

matrix = new Matrix();
matrix.postRotate(270F);
//matrix.preTranslate(-((float)20 * density), -(height -10));
matrix.postTranslate((float)20 * density, height -10);

homeButton.setImageMatrix(matrix);

Please let me know anything needs to be done.

thanks
Chenna

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button Issue

2011-09-16 Thread giles ian
There is some space at bottom of the bottom. Its not centered vertically
properly even after using android:layout_centerVertical=true. If u look
very closely the button is occupying all space vertically (lite shade of
green around button after selection) but the actual button image is slightly
upwards.


[image: issue1.JPG]

emulator:
[image: issue2.JPG]

RelativeLayout android:background=@drawable/gradient_bar
android:id=@+id/image_bar_bottom android:layout_height=0dip
android:layout_width=fill_parent android:layout_weight=1

Button android:text=Button android:id=@+id/button1
android:layout_width=wrap_content android:layout_height=fill_parent
android:layout_centerHorizontal=true android:layout_centerVertical=true
/Button

/RelativeLayout

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=enissue1.JPGissue2.JPG

[android-developers] Button click listview has to visible

2011-08-26 Thread arun kumar
Hi
 i defined a button at the bottom in the xml fileand i made (listview)
invisible in the xml filein java code i give list view
implementationhere when i click on the button that list view has to
appear ..
Thaks in advance

?xml version=1.0 encoding=utf-8?
RelativeLayout android:id=@+id/LinearLayout01
android:layout_width=fill_parent
android:layout_height=fill_parent

 /
ListView android:id=@+id/ListView01
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_above=@+id/rl1
android:background=#bebebe
android:visibility=invisible
/

 Button android:text=projects   android:id=@+id/t1
android:layout_height=wrap_content
android:layout_width=wrap_content/Button

 /RelativeLayout

  Public class ListView extends Activity{

private ListView lv1;

private String
lv_arr1[]={Android,iPhone,BlackBerry,AndroidPeople};
  public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.main);



lv1=(ListView)findViewById(R.id.ListView01);
lv1.setAdapter(new
ArrayAdapterString(this,android.R.layout.simple_list_item_1 , lv_arr1));


Button btn=(Button)findViewById(R.id.t1);
btn.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub

 if (((Button) v).isClickable()) {
 ListView btn=(ListView)findViewById(R.id.ListView01);
 ListView01.setVisibility(View.VISIBLE);

 }

}

}
});

}}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button in Custom Preference gets enabled automatically

2011-08-25 Thread KK
I have a custom preference in my application which consists of a
textview and a button and it is put in a preference screen. I load the
layout in the onCreateView of the preference

LayoutInflater inflater =  (LayoutInflater)getContext().
 
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.custom_preference, parent,
false);

In my xml, I have put android:enabled=false for the button because I
want to disable it and enable it conditionally later. When my
preferencescreen comes up, this button is disabled, but gets enabled
automatically in a second(I still haven't added any code to enable
this yet).

Also I find that the onCreateView of my custom preference keeps
getting called again and again.

Can someone please help me as to what is happening here?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button add programmatically not clickable

2011-07-26 Thread TreKing
On Fri, Jul 22, 2011 at 10:09 AM, deveLoper h.deder...@gmail.com wrote:

 any suggestions?


Break at the point you set the onclicklistener on each button. What is the
value of listener ?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button id causes app to crash

2011-07-26 Thread TreKing
On Fri, Jul 22, 2011 at 10:41 AM, DB12 daniel.burg...@gmail.com wrote:

 and this one gives me a force close runtime exception when my app starts


And the exception would be ... ?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] button id causes app to crash

2011-07-25 Thread DB12
Howdy, I searched for about 30 minutes to see if anyone had the same
issue but couldn't find anything.

I have a custom dialog I created with a relative layout, when the user
clicks on a button it brings up the dialog just fine normally.  I
added a few buttons to the dialog layout and this is where the trouble
begins. For some reason when I add an id to the third button, my I get
a runtime exception/force close dialog when my app starts up.  If the
third button has no id, the app works fine.  The other two buttons
already have id's and work great.
so in summary...

this layout works fine
?xml version=1.0 encoding=utf-8?
RelativeLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_width=fill_parent
android:layout_height=fill_parent
Button
android:id=@+id/cancel
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_alignParentRight=true
android:text=Cancel /
Button
android:id=@+id/line
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_alignParentLeft=true
android:text=Line /
Button
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_toRightOf=@id/line
android:text=Vehicle /
/RelativeLayout


and this one gives me a force close runtime exception when my app
starts
?xml version=1.0 encoding=utf-8?
RelativeLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_width=fill_parent
android:layout_height=fill_parent
Button
android:id=@+id/cancel
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_alignParentRight=true
android:text=Cancel /
Button
android:id=@+id/line
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_alignParentLeft=true
android:text=Line /
Button
android:id=@+id/random   
this is the only difference between the two
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_toRightOf=@id/line
android:text=Vehicle /
/RelativeLayout

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button add programmatically not clickable

2011-07-25 Thread deveLoper
Hi,
I need to add some of my buttons programmatically since the titles are
coming from a database that may change. The buttons are being add
fine, but are not clickable. I am using a custom background for the
buttons, but I am using the same background for some button I am using
from xml and they work find. If I add the line
countybutton[i].setFocusableInTouchMode(true); , the button can focus,
but doesn't click. I also tried to set it clickable, but it didn't
work. Here is my code:

res = getResources();

button_background = res.getDrawable(R.drawable.custom_button_gray);
context = getApplicationContext();
float scale = context.getResources().getDisplayMetrics().density;



for(int i = 0; i  county.size(); i++){
countybutton[i] = new Button(this);
countybutton[i].setText(county.elementAt(i));
countybutton[i].setBackgroundDrawable(button_background);
countybutton[i].setLayoutParams(new 
LinearLayout.LayoutParams((int)
(85*scale),
LinearLayout.LayoutParams.FILL_PARENT));
countybutton[i].setTextColor(Color.WHITE);
countybutton[i].setTextSize(13 * scale);
countybutton[i].setOnClickListener(listener);
county_linear.addView(countybutton[i]);

}

listener = new OnClickListener(){

@Override
public void onClick(View v) {
Log.d(TAG, a button was clicked);
}

};


any suggestions?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] button back home with AppInventor

2011-06-06 Thread Kuka
Hi Developers!
I'm a new android developer. I'm trying to make an app with
AppInventor. I would ask you a question: how i can insert the botton
back home in my app??
Thanks!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] button back home with AppInventor

2011-06-06 Thread TreKing
On Sat, Jun 4, 2011 at 11:38 AM, Kuka francesco.cuc...@gmail.com wrote:

 I would ask you a question: how i can insert the botton back home in my
 app??


I would ask you a question: why insert the botton back home in your app
when devices have a dedicated Home button??

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button Backgroundsetting error

2011-05-18 Thread hüseyin toplu
do{

koltuk1.setBackgroundColor(getResources().getColor(R.color.esatin));
  koltuk1.setId(1);

  
}while(koltuk_durum[z]==dolu 
koltuk_cinsiyet[z]==erkek);
color doesnt changing in do while loop i used it before loop it was
worked

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button in a ListView cell

2011-05-05 Thread Eric
I have seen dozens of posts about people trying to put a clickable
Button in a ListView cell, along with other text, and apparently
nobody has been able to get it to work.

Here is what I need to do:

1. Have a couple of TextViews in a ListView cell, with a clickable
Button on the right-side of the cell.

2. When the user clicks in the cell outside of the button, I should
receive the click in OnItemClicked (which will navigate me to another
Activity).

3.  When the user clicks on the Button in the cell, the Button's
onClick() should be executed and some other operation will be
performed.

4. This has to work for both Touch input, and trackball/D-pad input.

5. This cannot interfere with the ListViews selector highlighting such
that when I use the trackball-DPad to navigate the ListView, the
selected cell should be highlighted.

I just can't get this to work.  I've tried many permutations of many
approaches, but one of the above items stops working in each of the
cases.  Can anyone please tell me the best/correct way to achieve
this?

- Eric

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button in a ListView cell

2011-05-05 Thread B Lyon
So you were able to get everything to work without the trackball case?

On Thu, May 5, 2011 at 6:37 PM, Eric e...@alum.mit.edu wrote:
 I have seen dozens of posts about people trying to put a clickable
 Button in a ListView cell, along with other text, and apparently
 nobody has been able to get it to work.

 Here is what I need to do:

 1. Have a couple of TextViews in a ListView cell, with a clickable
 Button on the right-side of the cell.

 2. When the user clicks in the cell outside of the button, I should
 receive the click in OnItemClicked (which will navigate me to another
 Activity).

 3.  When the user clicks on the Button in the cell, the Button's
 onClick() should be executed and some other operation will be
 performed.

 4. This has to work for both Touch input, and trackball/D-pad input.

 5. This cannot interfere with the ListViews selector highlighting such
 that when I use the trackball-DPad to navigate the ListView, the
 selected cell should be highlighted.

 I just can't get this to work.  I've tried many permutations of many
 approaches, but one of the above items stops working in each of the
 cases.  Can anyone please tell me the best/correct way to achieve
 this?

 - Eric

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button code

2011-04-28 Thread Marcin Orlowski
Create object of Button class and add it to your layout. All is in
documentation. All you need it is to read it.

Regards,
Marcin Orlowski

*Tray Agenda http://bit.ly/trayagenda* - keep you daily schedule handy...
*Date In Tray* http://bit.ly/dateintraypro - current date at glance...
WebnetMobile on *Facebook http://webnetmobile.com/fb/* and
*Twitterhttp://webnetmobile.com/twitter/
*



On 27 April 2011 23:43, rishabh agrawal android.rish...@gmail.com wrote:

 How to crate button  also called without using xml.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button code

2011-04-27 Thread rishabh agrawal
How to crate button  also called without using xml.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button and onClickListner help needed

2011-04-05 Thread Justin Anderson
Have you verified you are not getting in the onClick method?  Try putting a
Toast inside your onClick method and see whether or not you are getting in
there...

I don't see anything wrong offhand with your onClickListener...


Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, Apr 4, 2011 at 3:53 AM, Karl Kristian Markman 
karlkristian.mark...@gmail.com wrote:

 This is probably a really n00b question but none the less.

 I cant get a button to change view (or activity)

 this is my code for the button:

 [code]
 package com.markel.NSF;

 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;

 public class Merker extends Activity
 {
  public void onCreate(Bundle icicle)
   {
  super.onCreate(icicle);
  setContentView(R.layout.alder);
  Button bever = (Button) findViewById(R.id.bever);
  bever.setOnClickListener(new View.OnClickListener() {
 public void onClick(View v) {
 Intent i = new Intent(Merker.this, Bmerk1Activity.class);
 startActivity(i);
 }
  });
   }
 }
 [/code]

 The view alder is just five image buttons and they are all in a Tab.

 If I just show the layout the app works but not when i try one of the
 many button codes that are out there.

 Pleas help me

 Regards Karl Kristian
 Norway

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button and onClickListner help needed

2011-04-04 Thread Karl Kristian Markman
This is probably a really n00b question but none the less.

I cant get a button to change view (or activity)

this is my code for the button:

[code]
package com.markel.NSF;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Merker extends Activity
{
  public void onCreate(Bundle icicle)
   {
  super.onCreate(icicle);
  setContentView(R.layout.alder);
  Button bever = (Button) findViewById(R.id.bever);
  bever.setOnClickListener(new View.OnClickListener() {
 public void onClick(View v) {
 Intent i = new Intent(Merker.this, Bmerk1Activity.class);
 startActivity(i);
 }
  });
   }
}
[/code]

The view alder is just five image buttons and they are all in a Tab.

If I just show the layout the app works but not when i try one of the
many button codes that are out there.

Pleas help me

Regards Karl Kristian
Norway

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button text padding changes when text changes

2011-03-23 Thread Zarah
Hi guys,

I have encountered a weird occurrence with Buttons and I hope someone
can explain to me why it is happening.

On load of my activity, my Button has default texts set in it. When
the user clicks on one of them, the Button's text changes. When I test
my app on small screen devices, the bottom part of the default text is
cut off for letters with hooks like j, p, y, g. But when the
button's text changes, the letters are not cut off.

According to my investigations, the top padding for default texts is 8
pixels. When the text changes, it becomes 6 pixels. I don't change the
padding before changing the text, so why does this happen?

Thanks in advance.


- Zarah.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button click Navigation not working ( application gets crashes)

2011-02-10 Thread Ramesh M
This is manifest.xml file:
?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=button.pack
  android:versionCode=1
  android:versionName=1.0
application android:icon=@drawable/icon android:label=@string/
app_name
activity android:name=.Activity1
  android:label=@string/app_name
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
activity android:name=.Activity2/activity
/application
uses-sdk android:minSdkVersion=8 /
/manifest

.

Java file: Activity1.Java


package button.pack;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Activity1 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);

Button next = (Button) findViewById(R.id.Button01);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(),
Activity2.class);
startActivityForResult(myIntent, 0);
}

});
}
}



Java file: Activity2.Java

package button.pack;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Activity2 extends Activity {

/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);

Button next = (Button) findViewById(R.id.Button02);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
}

});

}
}



...


Xml Files...
main.xml..
?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent
android:background=#ff  

TextView
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:textColor=#00
 android:text=This is Activity 2 /

Button
android:text=Previous
android:id=@+id/Button02
android:layout_width=250px
android:textSize=18px
android:layout_height=55px
/Button
/LinearLayout

main2.xml

?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent
android:background=#ff

 TextView
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:textColor=#00
 android:text=This is Activity 1 /

 Button android:layout_width=250px
 android:textSize=18px
 android:layout_height=55px
 android:id=@+id/Button01
 android:text=Next
/Button

/LinearLayout
..

This my Logcat:


02-10 13:33:53.962: ERROR/AndroidRuntime(1756): FATAL EXCEPTION: main
02-10 13:33:53.962: ERROR/AndroidRuntime(1756):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{button.pack/button.pack.Activity1}:
java.lang.NullPointerException
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
1622)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
1638)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.os.Handler.dispatchMessage(Handler.java:99)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.os.Looper.loop(Looper.java:123)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.app.ActivityThread.main(ActivityThread.java:3647)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
java.lang.reflect.Method.invokeNative(Native Method)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at

Re: [android-developers] Button click Navigation not working ( application gets crashes)

2011-02-10 Thread Kostya Vasilyev

10.02.2011 11:05, Ramesh M пишет:

02-10 13:33:53.962: ERROR/AndroidRuntime(1756): Caused by:
java.lang.NullPointerException
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
button.pack.Activity1.onCreate(Activity1.java:18)


The above says there is a null pointer in your code, in Activity1.java, 
at line 18.


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button Onclick Events-Page Navigation

2010-12-23 Thread Ramesh M
Hi, Everyone,
  I have designed 3pages using 3xml files in layouts folder
android,each having 2 buttons previous page and next page..i was
loaded  first page using set content view , From here, through Button
onclick i have moved to second page.. till that  every thing was fine,
if try to go previous page or next page my application gets crashes,
forced to close...

Can any one give me the sample code for above scenario , Thanks in
Advance!!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button Onclick Events-Page Navigation

2010-12-23 Thread TreKing
On Thu, Dec 23, 2010 at 9:15 PM, Ramesh M rameshm.m...@gmail.com wrote:

 Can any one give me the sample code for above scenario


The likelihood of anyone here not only having the code to solve your exact
scenario (which you did not clearly explain) but also being willing to just
give you said code is very near zero.

You would be better served by posting the stack trace of the error and the
snippet of code for where it occurs.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button color - StateListDrawable question

2010-12-09 Thread AUandroid
I am allowing the user to change the color of the buttons. I want to
maintain the default drawables used for focused and onPressed state
and apply the color only when the button is neither  pressed nor
focused.

I am currently achieving this by checking the state of the view in
onDraw() on the button class and apply the color filter if it is
neither pressed or focused, else I am passing null to color filter.

Is there any easier way of doing this? Is there a way to get the
default StateListDrawable of the button and change only the desired
state drawable. I have too many views in my layout and I am trying to
reduce any work done in onDraw method as it is slows down the
layout.Thanks

-VK


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button color - StateListDrawable question

2010-12-09 Thread Mark Murphy
The StateListDrawable and nine-patch PNG resources used by a Button
are in your SDK. Copy them into your project and modify to suit.

On Thu, Dec 9, 2010 at 10:24 AM, AUandroid thevk...@gmail.com wrote:
 I am allowing the user to change the color of the buttons. I want to
 maintain the default drawables used for focused and onPressed state
 and apply the color only when the button is neither  pressed nor
 focused.

 I am currently achieving this by checking the state of the view in
 onDraw() on the button class and apply the color filter if it is
 neither pressed or focused, else I am passing null to color filter.

 Is there any easier way of doing this? Is there a way to get the
 default StateListDrawable of the button and change only the desired
 state drawable. I have too many views in my layout and I am trying to
 reduce any work done in onDraw method as it is slows down the
 layout.Thanks

 -VK


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button placement problems

2010-11-30 Thread Serdel
Hello,

I could find anything similar so I decided to open a new thread.
However if there already is a similar answer please post the link.

I need to place my buttons in a little unconventional way shown here
(dkw I could post the message with an imageshack link so an ASCI
'picture'):

___
||
||
||
||
||
||
|__|
|___B1_|
||
|    |
|___B2___|_|___ B3__ |

In fact I need it working in a second screen without B2.

So far my code is the following:

?xml version=1.0 encoding=utf-8?
LinearLayout
android:id=@+id/layout1
android:layout_width=fill_parent
android:layout_height=fill_parent
xmlns:android=http://schemas.android.com/apk/res/android;
android:background=@drawable/id_app2 android:orientation=vertical
android:gravity=fill

Button android:id=@+id/button1
android:layout_width=fill_parent
android:layout_gravity=center_vertical
android:layout_marginTop=291dp
android:layout_height=40dp
/Button

Button android:id=@+id/button3
android:layout_width=wrap_content
android:layout_height=wrap_content
android:height=30dp
android:width=160dp
 android:layout_gravity=bottom|right
android:layout_marginTop=70dp
/Button
/LinearLayout

(for simplicity I have removed the B2 from the code) An it worked on
my Samsung Galaxy. However I tried the same app on my friends acer
phone and the buttons were higher that should be. This is a little bit
strange since everything on other screens works fine (as you can see I
use dp not px) - I only have problem with this one. How to place them
so they would be the same at every device?

PS: For clarity B1 is a  below the center of the screen.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button placement problems

2010-11-30 Thread Daniel Drozdzewski
Serdel,


Please note that you set B1 to be centered_vertical and have
top_margin of 291dp.

Which Acer phone you tested this on and the result was not the same?
Do you need the space between B1 and B2, B3?


Daniel




On Tue, Nov 30, 2010 at 1:53 PM, Serdel adam.lichwierow...@gmail.com wrote:
 Hello,

 I could find anything similar so I decided to open a new thread.
 However if there already is a similar answer please post the link.

 I need to place my buttons in a little unconventional way shown here
 (dkw I could post the message with an imageshack link so an ASCI
 'picture'):

 ___
 |                                |
 |                                |
 |                                |
 |                                |
 |                                |
 |                                |
 |__|
 |___B1_|
 |                                |
 |    |
 |___B2___|_|___ B3__ |

 In fact I need it working in a second screen without B2.

 So far my code is the following:

 ?xml version=1.0 encoding=utf-8?
 LinearLayout
 android:id=@+id/layout1
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 xmlns:android=http://schemas.android.com/apk/res/android;
 android:background=@drawable/id_app2 android:orientation=vertical
 android:gravity=fill

 Button android:id=@+id/button1
 android:layout_width=fill_parent
 android:layout_gravity=center_vertical
 android:layout_marginTop=291dp
 android:layout_height=40dp
 /Button

 Button android:id=@+id/button3
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:height=30dp
 android:width=160dp
  android:layout_gravity=bottom|right
 android:layout_marginTop=70dp
 /Button
 /LinearLayout

 (for simplicity I have removed the B2 from the code) An it worked on
 my Samsung Galaxy. However I tried the same app on my friends acer
 phone and the buttons were higher that should be. This is a little bit
 strange since everything on other screens works fine (as you can see I
 use dp not px) - I only have problem with this one. How to place them
 so they would be the same at every device?

 PS: For clarity B1 is a  below the center of the screen.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en



-- 
Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] button on screen that controls page sliding

2010-11-23 Thread TreKing
On Sat, Nov 20, 2010 at 4:51 PM, timecatcher3 timecatch...@gmail.comwrote:

 I wanted to make a button on one of
 my activities that I can drag to slide my current activity page to the
 next activity page. The button will be in the center of the screen and
 I want to be able to press and drag it horizontally to one end of the
 screen while I am dragging my button I can see my current activity
 page moving. It is actually like when one slides on the home screen
 and can control the sliding depending on how far he slides his finger
 on the screen.


OK ... this is pretty broad. What do you have working so far? Where exactly
are you having trouble?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] button on screen that controls page sliding

2010-11-22 Thread timecatcher3
Hi,

I am new to android development. I wanted to make a button on one of
my activities that I can drag to slide my current activity page to the
next activity page. The button will be in the center of the screen and
I want to be able to press and drag it horizontally to one end of the
screen while I am dragging my button I can see my current activity
page moving. It is actually like when one slides on the home screen
and can control the sliding depending on how far he slides his finger
on the screen.

Thanks,
timecatcher3

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] button click

2010-11-01 Thread Jayu Sagar
Hi joy ,
what you can do is get all the text views in your activity by using the
Findviewbyid.

when clicked the button you can do get text from the First textView and
Second textview and keep Toggling it :) hope it was informative.



Jayu.




On Fri, Oct 29, 2010 at 3:56 PM, nena joy nenaj...@gmail.com wrote:

 Hello,

  I have an activity.Have an image view, 3 text views and a button.
 2 text views are hard coded.
 When click the button the other  shows first  value taken from an xml file
 (xml tag value).
 When click this again value of text view want to change.The value should be
 the second value from the xml file). and so on.
 But how this possible???

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button click

2010-10-31 Thread TreKing
Your question is difficult to understand. You should try to clarify and
rephrase so we can better understand the problem you're having.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button click

2010-10-31 Thread Filip Havlicek
I'm going the crystal ball way here.

You need to take the current content of text view (or save it somewhere) and
when you press the button next time, take that content (or it's id or
something like that, really depends on what you are trying to do and how)
and then select next content based on current one. If you are trying to
show, for example, tags from your xml, I would suggest parsing the whole
file on first button press and save the tags along with their ids
(reflecting their position in the file), then just selecting next id on next
button presses.

Best regards,
Filip Havlicek



2010/10/31 TreKing treking...@gmail.com

 Your question is difficult to understand. You should try to clarify and
 rephrase so we can better understand the problem you're having.


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] button click

2010-10-29 Thread nena joy
Hello,

 I have an activity.Have an image view, 3 text views and a button.
2 text views are hard coded.
When click the button the other  shows first  value taken from an xml file
(xml tag value).
When click this again value of text view want to change.The value should be
the second value from the xml file). and so on.
But how this possible???

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button organisation

2010-10-19 Thread Laurent Lugon Moulin
Hi all,

I want to put three buttons in one single line with the left and the right
button at a fixed size, and the middle button wich take the distance between
the two buttons. My application will work in different device, so I can't
fix the size, it has to be adaptative...

Here is my current code :

RelativeLayout android:layout_height=wrap_content
android:layout_width=fill_parent
android:orientation=horizontal
android:gravity=center

Button android:layout_width=70dp
android:layout_height=wrap_content
android:text=@string/lbl_help
android:gravity=center
android:background=@drawable/btn_grey_9p
android:textColor=#cc
android:textSize=18dp
android:layout_margin=1dp
android:layout_alignParentLeft=true/

LinearLayout android:layout_height=wrap_content
android:layout_width=wrap_content
android:gravity=center
android:layout_centerInParent=true

Button android:id=@+id/btnApply
android:layout_width=140dp
android:layout_height=wrap_content
android:text=@string/protect_me
android:gravity=center
android:background=@drawable/btn_bottom
android:textColor=#ff
android:textStyle=bold
android:textSize=18dp
android:layout_marginTop=1dp/
/LinearLayout

Button android:id=@+id/btnLocate
android:layout_width=70dp
android:layout_height=wrap_content
android:gravity=center
android:background=@drawable/btn_bottom
android:textColor=#ff
android:textSize=18dp
android:text=@string/btn_locate
android:layout_margin=1dp
android:layout_alignParentRight=true/

/RelativeLayout

For the moment, the size is fixed (in red in the code). If I use a
LinearLayout, with the middle button widht parameter :
'android:layout_width=fill_parent' It start at the right of the left
button (OK) but overwrite the right button (NOT OK)

Anyone can help me ?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Button organisation

2010-10-19 Thread Mark Murphy
Step #1: Get rid of the LinearLayout, since you do not appear to need it

Step #2: Get rid of the android:orientation=horizontal from the
RelativeLayout, since orientation is not a valid attribute for
RelativeLayout

Step #3: Give your first Button an android:id value, so we can refer
to it from within the XML

Step #4: Have your middle Button anchor itself to the other two
(android:layout_toRightOf=... and
android:layout_toLeftOf=@+id/btnLocate)

Step #5: Remove the + sign from @+id/btnLocate in the last Button,
since ideally you only use the + sign on the first occurrence of the
ID value in the layout file, and step #4 refers to btnLocate first

On Tue, Oct 19, 2010 at 8:11 AM, Laurent Lugon Moulin
laurent.lu...@gmail.com wrote:
 Hi all,

 I want to put three buttons in one single line with the left and the right
 button at a fixed size, and the middle button wich take the distance between
 the two buttons. My application will work in different device, so I can't
 fix the size, it has to be adaptative...

 Here is my current code :

 RelativeLayout android:layout_height=wrap_content
         android:layout_width=fill_parent
         android:orientation=horizontal
         android:gravity=center

             Button android:layout_width=70dp
                 android:layout_height=wrap_content
                 android:text=@string/lbl_help
                 android:gravity=center
                 android:background=@drawable/btn_grey_9p
                 android:textColor=#cc
                 android:textSize=18dp
                 android:layout_margin=1dp
                 android:layout_alignParentLeft=true/

             LinearLayout android:layout_height=wrap_content
                 android:layout_width=wrap_content
                 android:gravity=center
                 android:layout_centerInParent=true

                 Button android:id=@+id/btnApply
                     android:layout_width=140dp
                     android:layout_height=wrap_content
                     android:text=@string/protect_me
                     android:gravity=center
                     android:background=@drawable/btn_bottom
                     android:textColor=#ff
                     android:textStyle=bold
                     android:textSize=18dp
                     android:layout_marginTop=1dp/
             /LinearLayout

             Button android:id=@+id/btnLocate
                 android:layout_width=70dp
                 android:layout_height=wrap_content
                 android:gravity=center
                 android:background=@drawable/btn_bottom
                 android:textColor=#ff
                 android:textSize=18dp
                 android:text=@string/btn_locate
                 android:layout_margin=1dp
                 android:layout_alignParentRight=true/

     /RelativeLayout

 For the moment, the size is fixed (in red in the code). If I use a
 LinearLayout, with the middle button widht parameter :
 'android:layout_width=fill_parent' It start at the right of the left
 button (OK) but overwrite the right button (NOT OK)

 Anyone can help me ?


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button organisation

2010-10-19 Thread TreKing
On Tue, Oct 19, 2010 at 7:11 AM, Laurent Lugon Moulin 
laurent.lu...@gmail.com wrote:

 Anyone can help me ?


Also look at the weight or layout_weight attribute, learn it, and love
it.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button placement problem

2010-10-08 Thread TreKing
On Thu, Oct 7, 2010 at 6:13 PM, Varun Khanduja varunkhand...@gmail.comwrote:

 I am trying to get a button at bottom of a screen having a list view.


Could you add more detail to the problem you're having and the outcome
you're trying to achieve?
A picture of each case would help as well if you have it.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] button placement problem

2010-10-07 Thread Varun Khanduja
Hey guys,

I am trying to get a button at bottom of a screen having a list view.
This button is non-scrollable and the list view slips below the button
if it is larger than the size of the button. Could someone please help
me get the right xml properties. Tried layout_gravity and other things
but it doesnt seems to be displaying.

Here is the main.xml file


?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent


TextView
  android:id=@+id/textViewHello
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=@string/hello
/
LinearLayout android:layout_width=fill_parent
android:layout_height=wrap_content android:orientation=horizontal
 Button
android:id=@+id/Button1
android:layout_height=wrap_content
android:layout_width=wrap_content
android:layout_alignParentLeft=true
android:textSize=15sp
android:typeface=monospace
android:textColor=#ffFFffFF
android:text=@string/Button1

/Button
Button

android:id=@+id/Button2
android:layout_height=wrap_content
android:layout_width=wrap_content
android:layout_alignParentRight=true
android:textSize=15sp
android:typeface=monospace
android:textColor=#ffFFffFF
android:text=@string/Button2

/Button
Button

android:id=@+id/Button3
android:layout_height=wrap_content
android:layout_width=wrap_content
android:layout_alignParentRight=true
android:textSize=15sp
android:typeface=monospace
android:textColor=#ffFFffFF
android:text=@string/Button3

/Button
Button
android:id=@+id/Button4
android:layout_height=wrap_content
android:layout_width=wrap_content
android:layout_alignParentRight=true
android:textSize=15sp
android:typeface=monospace
android:textColor=#ffFFffFF
android:text=@string/Button4

/Button
/LinearLayout
ListView
android:id=@android:id/list
android:layout_width=wrap_content
android:layout_height=wrap_content
android:drawSelectorOnTop=false
/
 Button android:layout_width=fill_parent
android:layout_height=wrap_content
android:id=@+id/Button4
android:text=@string/hello
android:layout_gravity=bottom
android:isScrollContainer=false /
/LinearLayout


Here is the list xml file.


?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=wrap_content
android:orientation=horizontal
ImageView
android:id=@+id/icon
android:layout_width=22px
android:paddingLeft=2px
android:paddingRight=2px
android:paddingTop=2px
android:layout_height=wrap_content
android:src=@drawable/icon/

LinearLayout
android:layout_width=fill_parent
android:layout_height=wrap_content
android:orientation=vertical
TextView
android:id=@+id/label1
android:layout_width=100px
android:layout_height=wrap_content
android:textSize=10sp/
TextView
android:id=@+id/label2
android:layout_width=100px
android:layout_height=wrap_content
android:textSize=10sp/


/LinearLayout
TextView
android:id=@+id/label3
android:layout_width=100px
android:layout_height=wrap_content
android:layout_marginLeft=40px
android:textSize=15sp
android:text=hello
/
ImageView
android:id=@+id/icon
android:layout_width=22px
android:paddingLeft=2px
android:paddingRight=2px
android:paddingTop=2px
android:layout_height=wrap_content
android:src=@drawable/icon android:layout_gravity=right/



/LinearLayout

Thank you,
Varun

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] button focus

2010-10-06 Thread Kumar Bibek
Look at the state list drawables. Buttons and other widgets have a default
statelist drawable. If you are using your own drawable, (just a image), the
button doesn't know what to show when in different states. Rather than
setting a drawable(picture) as a background, you should be using a state
list drawable which specifies which images to use for different states.

On Wed, Oct 6, 2010 at 11:28 AM, A N K ! T ankit.awasth...@gmail.comwrote:

 i have set background as transparent for the button ..
 (button.setbacgroundcolor(Color.transparent) )...


 now it is not showing focus on the same button..what to do..

 --

  A N K ! T..


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] button focus

2010-10-06 Thread A N K ! T
thanks it is very helpful
On Wed, Oct 6, 2010 at 4:44 PM, Kumar Bibek coomar@gmail.com wrote:

 Look at the state list drawables. Buttons and other widgets have a default
 statelist drawable. If you are using your own drawable, (just a image), the
 button doesn't know what to show when in different states. Rather than
 setting a drawable(picture) as a background, you should be using a state
 list drawable which specifies which images to use for different states.

 On Wed, Oct 6, 2010 at 11:28 AM, A N K ! T ankit.awasth...@gmail.comwrote:

 i have set background as transparent for the button ..
 (button.setbacgroundcolor(Color.transparent) )...


 now it is not showing focus on the same button..what to do..

 --

  A N K ! T..


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Kumar Bibek
 http://techdroid.kbeanie.com
 http://www.kbeanie.com

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 

 A N K ! T..

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] button focus

2010-10-05 Thread A N K ! T
i have set background as transparent for the button ..
(button.setbacgroundcolor(Color.transparent) )...


now it is not showing focus on the same button..what to do..

-- 

 A N K ! T..

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

  1   2   >