如何添加印度卢比符号? [英] How to add indian rupee symbol?

查看:265
本文介绍了如何添加印度卢比符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的机器人,在我的应用程序中使用JSON,而我得到的产品的价格,我想补充印度卢比的象征,但它没有显示............. ...........

I am new to android,In my application I used json,and I am getting price of product and I am trying to add indian rupee symbol,but its not showing........................

Tab1Activity.java

Tab1Activity.java

   public class Tab1Activity  extends ListActivity{
private ProgressDialog pDialog;
JSONArray Product=null;
private ListView listview;
ArrayList<HashMap<String,String>> aList;
ArrayList<HashMap<String, String>> arrayTemplist;
private static String PRODUCT_URL = "";
private static final String PRODUCT_DATA="Product";
private static final String PRODUCT_ID="productid";
private static final String PRODUCT_NAME="product_name";
private static final String PRODUCT_CODE="skucode";
private static final String PRODUCT_IMAGE="product_photo";
private static final String PRODUCT_WEIGHT="weight";
private static final String PRODUCT_SALERATE="sale_rate";
private CustomAdapterTabone adapter;
private TextView noacpt;
private AutoCompleteTextView inputSearch;
@Override
   protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_view_tabone);
    //noacpt=(TextView)findViewById(R.id.no_acceptedlist);
    /*String strtext = getIntent().getStringExtra("id");
System.out.println("<<<<<<<< id : " + strtext);*/
    //INTEREST_ACCEPT_URL = "
    ListView listview = (ListView)findViewById(android.R.id.list);
    //listview.setSelector( R.drawable.list_selector);
    //listview.setSelector(R.drawable.listselector);
    new LoadAlbums().execute();
    aList = new ArrayList<HashMap<String, String>>();
    final ListView lv = getListView();
    inputSearch = (AutoCompleteTextView)  findViewById(R.id.autoCompleteTextView1);
    inputSearch.addTextChangedListener(new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
            arrayTemplist= new ArrayList<HashMap<String,String>>();
            String searchString =inputSearch.getText().toString().toLowerCase();
            for (int i = 0; i < aList.size(); i++)
            {
                String currentString =aList.get(i).get(Tab1Activity.PRODUCT_NAME);
                if (currentString.toLowerCase().startsWith(searchString ))
                {
                    arrayTemplist.add(aList.get(i));
                }
            }
            for (int i = 0; i < arrayTemplist.size(); i++)
            {
                String currentstrin = arrayTemplist.get(i).get(Tab1Activity.PRODUCT_NAME);
                //Toast.makeText(getApplicationContext(), currentstrin, Toast.LENGTH_LONG).show();

            }
            CustomAdapterTabone adapter=new CustomAdapterTabone(getApplicationContext(), arrayTemplist);

        }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                int arg3) {
            // TODO Auto-generated method stub
        }
        @Override
        public void afterTextChanged(Editable arg0) {
            // TODO Auto-generated method stub                         
        }
    });


   }

   @Override
   public void onListItemClick(ListView l, View v, int position, long id) {
Intent intent = new Intent(getApplicationContext(), Tab1Activity.class);
intent.putExtra("interestaccept_user_id",   aList.get(position).get(PRODUCT_ID));
startActivity(intent);
 }

 class LoadAlbums extends AsyncTask<String, String,   ArrayList<HashMap<String,String>>> {

@Override
protected void onPreExecute() {
    super.onPreExecute();
    pDialog = new ProgressDialog(Tab1Activity.this);
    pDialog.setMessage("Loading...");
    pDialog.setIndeterminate(true);
   // pDialog.setIndeterminateDrawable(getResources().getDrawable(R.drawable.custom_progress));
    pDialog.setCancelable(false);
    pDialog.show();
}
protected ArrayList<HashMap<String,String>> doInBackground(String... args) {
    ServiceHandler sh = new ServiceHandler();
    // Making a request to url and getting response
    ArrayList<HashMap<String,String>> data = new    ArrayList<HashMap<String, String>>();
    String jsonStr = sh.makeServiceCall(PRODUCT_URL, ServiceHandler.GET);
    Log.d("Response: ", "> " + jsonStr);
    if (jsonStr != null) {
        try {
            JSONObject jsonObj = new JSONObject(jsonStr);

            // Getting JSON Array node
            Product = jsonObj.getJSONArray(PRODUCT_DATA);

            for (int i = 0; i < Product.length(); i++) {
                JSONObject c = Product.getJSONObject(i);
                // creating new HashMap
                HashMap<String, String> map = new HashMap<String, String>();
                // adding each child node to HashMap key => value
                map.put(PRODUCT_ID, c.getString(PRODUCT_ID));
                map.put(PRODUCT_NAME,c.getString(PRODUCT_NAME));
                map.put(PRODUCT_CODE, c.getString(PRODUCT_CODE));
                map.put(PRODUCT_IMAGE, c.getString(PRODUCT_IMAGE));
                map.put(PRODUCT_WEIGHT, c.getString(PRODUCT_WEIGHT));
                map.put(PRODUCT_SALERATE, c.getString(PRODUCT_SALERATE)+getResources().getString(R.string.rupee));
               // map.put(INTEREST_ACCEPT_LOCATION, c.getString(INTEREST_ACCEPT_LOCATION));
                // adding HashList to ArrayList
                data.add(map);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    } else {
        Log.e("ServiceHandler", "Couldn't get any data from the url");
    }
    return data;
}
protected void onPostExecute(ArrayList<HashMap<String,String>> result) {
    super.onPostExecute(result);
    if(Product == null || Product.length() == 0){
            Toast.makeText(getApplicationContext(), "No response", Toast.LENGTH_SHORT).show();
        //noacpt.setText("  No Accepted List  ");
    }
    else
    {
        //noacpt.setVisibility(View.INVISIBLE);
    }
    // dismiss the dialog after getting all albums
    if (pDialog.isShowing())
        pDialog.dismiss();

    if(aList == null){
        aList = new ArrayList<HashMap<String, String>>();
        aList.addAll(result);
        adapter = new CustomAdapterTabone(getApplicationContext(),result);
        setListAdapter(adapter);
    }else{
        aList.addAll(result);
        adapter.notifyDataSetChanged();
    }
}

}

使用此行:

  map.put(PRODUCT_SALERATE, c.getString(PRODUCT_SALERATE)+getResources().getString(R.string.rupee));

我得到follwing输出

I am getting follwing output

但我想是这样的

but I want something like this

推荐答案

尝试在哈希表的金额之前添加Ruppee符号:

Try adding the Ruppee symbol before the amount in hash map :

map.put(PRODUCT_SALERATE, getResources().getString(R.string.rupee) + c.getString(PRODUCT_SALERATE));

检查讨论<经过href="http://chat.stackoverflow.com/rooms/73057/discussion-on-question-by-fazilpuriasa-how-to-add-indian-rupee-symbol">Chat

,我觉得这是缺少的部分。

, I think this is missing part

这篇关于如何添加印度卢比符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆