question about TableLayout

by chandlersong » Sat, 08 Aug 2009 12:43:51 GMT


Sponsored Links
 <RadioGroup
        android:id="@+id/
Radiogroup"
        
android:layout_width="fill_parent"
        
android:layout_height="wrap_content"
        
android:orientation="vertical"
<TableLayout
        android:id="@+id/
widget28"
        
android:layout_width="fill_parent"
        
android:layout_height="fill_parent"
        
android:orientation="vertical"
        xmlns:android=" http://schemas.android.com/apk/res/ 
android"
        
<TableRow>
        
<RadioButton
                        android:id="@+id/
radioNumber"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
                        android:text="@string/
number"
        
android:layout_marginRight="1dip"
                        /
        
<RadioButton
                        android:id="@+id/
radioCharter"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
                        android:text="@string/
character"
        
android:layout_marginRight="1dip"
                        /
  </
TableRow>
 
<TableRow>
        
<RadioButton
                        android:id="@+id/
radioMix"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
                        android:text="@string/
mix"
                        /
                </
TableRow>
        </
TableLayout>
</
RadioGroup>

    it's my xml config file.when  I add the tableLayout into the
raidogroup. I find that I can select more than one radiobutton at one
time.
    Does anyone konw how to fixed it?
--~--~---------~--~----~------------~-------~--~----~



question about TableLayout

by Mark Murphy » Sat, 08 Aug 2009 19:16:44 GMT


 


RadioButton widgets must be immediate children of RadioGroup for the
grouping effect to work. You cannot have intermediate containers, such
as your TableLayout and TableRows.

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

Android Training in Germany, 18-22 January 2010:  http://bignerdranch.com 

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


question about TableLayout

by 瀹嬪簡娆 » Sun, 09 Aug 2009 12:36:47 GMT


 Then How can I change the default screen formate.
   I hope that I can put the two  radiobutton at the first line the one at
the second line

2009/8/8 Mark Murphy <mmur...@commonsware.com>



--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. wifi status

Hi all,

I am facing one issue with wifi. Some times when i turn on the wifi,
after connecting to AP, it shows connected. But in AP list it shows
"Remembered, open network".

I am not getting problem with this?

1. is there any problem with restoring state of the AP while
reconnecting to it?

In function

getSummarizedStatus, if i print it shows primary as false and so
printing wrong value.

What I want to know is - who will control displaying of status in Wifi-
Networks section? is there any problem with "primary" status since it
is false.

Thanks
Gururaja b O

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Error Parsing JSON data

If I run my php file manually I am getting the output as follows:
=====================
[{"org_id":"39575","orgname":"ARTHRITIS FOUNDATION - {*filter*}IA
CHAPTER","orgcity":"RICHMOND","orgstate":"VA"}]

The php code is as follows:

=====================

<html>
<body style="background-color:#33990f">

<?php

// connect include
require ("connect.php");

$query = "SELECT * FROM orgs WHERE org_id = 39575";

$result = mysql_query($query)or die(mysql_error());
if (!$result) {
  echo("<p>Error performing query: " . mysql_error() . "</p>");
  exit();
}
while ($row = mysql_fetch_assoc($result))
{
        $output[]=$row;
        echo(json_encode($output));
}
/* Close Connection to MySQL server */
mysql_close ($connect);
exit();
?>
</body></html>

===============
If I access it using my Android code shown below I get the following
errors:

===============
10-12 11:14:08.199: INFO/global(233): Default buffer size used in
BufferedReader constructor. It would be better to be explicit if an 8k-
char buffer is required.
10-12 11:14:20.460: ERROR/log_tag(233): Error parsing data
org.json.JSONException: A JSONArray text must start with '[' at
character 0 of


ANDROID Code
===============
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ArrayList<OrgItem> nameValuePairs = new ArrayList<OrgItem>();
      //http post
        try{
                HttpClient httpclient = new DefaultHttpClient();
                HttpPost httppost = new HttpPost("graborginfo.php");
                httppost.setEntity((HttpEntity) new
UrlEncodedFormEntity((List<? extends NameValuePair>) nameValuePairs));
                HttpResponse response = httpclient.execute(httppost);
                HttpEntity entity = response.getEntity();
                InputStream is = entity.getContent();
        }catch(Exception e){
                Log.e("log_tag", "Error in http connection
"+e.toString());
        }
        //convert response to string
        try{
                        InputStreamReader is = new InputStreamReader(System.in);
                BufferedReader reader = new BufferedReader(is);
                StringBuilder sb = new StringBuilder();
                String line = null;
                while ((line = reader.readLine()) != null) {
                        sb.append(line + "\n");
                }
                is.close();

                result=sb.toString();
        }catch(Exception e){
                Log.e("log_tag", "Error converting result
"+e.toString());
        }

        //parse json data
        try{
                JSONArray jArray = new JSONArray(result);
                for(int i=0;i<jArray.length();i++){
                        JSONObject json_data =
jArray.getJSONObject(i);
                        Log.i("log_tag","org_id:
"+json_data.getInt("id")+
                                ", orgname:
"+json_data.getString("orgname")+
                                ", orgcity:
"+json_data.getString("orgcity")+
                                ", orgstate:
"+json_data.getString("orgstate")
                        );
                }
        }catch(JSONException e){
                Log.e("log_tag", "Error parsing data "+e.toString());
        }

    }


The LOGCAT output for the error is as follows:
=====================
10-12 11:14:08.199: INFO/global(233): Default buffer size used in
BufferedReader constructor. It would be better to be explicit if an 8k-
char buffer is required.
10-12 11:14:20.460: ERROR/log_tag(233): Error parsing data
org.json.JSONException: A JSONArray text must start with '[' at
character 0 of


I am new to this so I am subject to beginners errors. Any help would
be appreciated.

Thanks,
Capt Spaghetti

-- 

3. how to add button to do this line of codes

4. Facebook challenge response

5. XAuth Library for Android

6. Querying Content Providers

7. How to add camera on android platform