Android output is showing editable text -


here code:

    package com.ricky.amnestyapp;     import java.util.arraylist;     import java.util.list;     import org.apache.http.namevaluepair;     import org.apache.http.message.basicnamevaluepair;     import org.json.jsonarray;     import org.json.jsonexception;     import org.json.jsonobject;     import android.app.activity;     import android.app.progressdialog;     import android.content.intent;     import android.os.asynctask;     import android.os.bundle;     import android.util.log;     import android.view.view;     import android.widget.button;     import android.widget.edittext;      public class editdiseasesactivity extends activity {         edittext txtname;        edittext txtprice;        edittext txtdesc;        edittext txtcreatedat;          string pid;      // progress dialog     private progressdialog pdialog;      // json parser class     jsonparser jsonparser = new jsonparser();      // single product url     private static final string url_product_detials = "http://10.0.2.2/android_connect/get_product_details.php";       // json node names     private static final string tag_success = "success";     private static final string tag_product = "product";     private static final string tag_pid = "pid";     private static final string tag_name = "name";     private static final string tag_price = "price";     private static final string tag_description = "description";      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.edit_diseases);            // getting product details intent         intent = getintent();          // getting product id (pid) intent         pid = i.getstringextra(tag_pid);          // getting complete product details in background thread         new getproductdetails().execute();       }      /**      * background async task complete product details      * */     class getproductdetails extends asynctask<string, string, string> {          /**          * before starting background thread show progress dialog          * */         @override         protected void onpreexecute() {             super.onpreexecute();             pdialog = new progressdialog(editdiseasesactivity.this);             pdialog.setmessage("loading product details. please wait...");             pdialog.setindeterminate(false);             pdialog.setcancelable(true);             pdialog.show();         }          /**          * getting product details in background thread          * */         protected string doinbackground(string... params) {              // updating ui background thread             runonuithread(new runnable() {                 public void run() {                     // check success tag                     int success;                     try {                         // building parameters              list<namevaluepair> params = new arraylist<namevaluepair>();              params.add(new basicnamevaluepair("pid", pid));                  // getting product details making http request                 // note product details url use request                         jsonobject json = jsonparser.makehttprequest(                                 url_product_detials, "get", params);                          // check log json response                         log.d("single product details", json.tostring());                          // json success tag                         success = json.getint(tag_success);                         if (success == 1) {                             // received product details                             jsonarray productobj = json                                     .getjsonarray(tag_product); // json array                              // first product object json array                             jsonobject product = productobj.getjsonobject(0);                              // product pid found                             // edit text                txtname = (edittext) findviewbyid(r.id.inputname);                txtprice = (edittext) findviewbyid(r.id.inputprice);                txtdesc = (edittext) findviewbyid(r.id.inputdesc);                          // display product data in edittext                txtname.settext(product.getstring(tag_name));               txtprice.settext(product.getstring(tag_price));               txtdesc.settext(product.getstring(tag_description));                          }else{                             // product pid not found                         }                     } catch (jsonexception e) {                         e.printstacktrace();                     }                 }             });              return null;         }          /**          * after completing background task dismiss progress dialog          * **/         protected void onpostexecute(string file_url) {             // dismiss dialog once got details             pdialog.dismiss();         }      } } 

i have tried make edittext textview in case programme stopped running.

    <?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" >      <!-- name label -->     <textview android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="product name"         android:paddingleft="10dip"         android:paddingright="10dip"         android:paddingtop="10dip"         android:textsize="17dip"/>      <!-- input name -->     <edittext android:id="@+id/inputname"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_margin="5dip"         android:layout_marginbottom="15dip"         android:singleline="true"/>      <!-- price label -->     <textview android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="price"         android:paddingleft="10dip"         android:paddingright="10dip"         android:paddingtop="10dip"         android:textsize="17dip"/>      <!-- input price -->     <edittext android:id="@+id/inputprice"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_margin="5dip"         android:layout_marginbottom="15dip"         android:singleline="true"         android:inputtype="numberdecimal"/>      <!-- description label -->     <textview android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="description"         android:paddingleft="10dip"         android:paddingright="10dip"         android:paddingtop="10dip"         android:textsize="17dip"/>      <!-- input description -->     <edittext android:id="@+id/inputdesc"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_margin="5dip"         android:layout_marginbottom="15dip"         android:lines="4"         android:gravity="top"/>        </linearlayout> 

how can show output textview. please me rid it?

if don't need edit text in inputprice change textview ewerywhere. problem so?


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -