Returning Malayam string from another class in android / java

Maybe very stupid, but I can't figure it out.

Demand

- print the text of Malayalam .. I can achieve as follows.

 class MainActivity extends Activity{
    @Override
        protected void onCreate(Bundle savedInstanceState) {
         JSONObject j = new JSONObject();
         TextView tv=(TextView) findViewById(R.id.textview);
         j.put("contain", "മലയാളം"); 
         tv.setText(j.getString("contain"));

    }
    }

      

above works fine .. but if i try like below the text view only prints question marks like -> "?????"

    public class Language_Mapping{
        String appName = "മലയാളം";

        public String get_Data(){
        return appName;
        }
        }

  class MainActivity extends Activity{
        @Override
            protected void onCreate(Bundle savedInstanceState) {
             Language_Mapping obj = new Language_Mapping();
             TextView tv=(TextView) findViewById(R.id.textview);
             tv.setText(obj.get_Data());

        }
        }

      

Why??

+3


source to share





All Articles