testuser
testuser

Reputation: 1

how to read encrypted string in Android

I have try to read one String that may be Encoded by some one, But i need to read this String, Actually this String is Gujrati Language, And i hava also use the .ttf file for read this gujarati String

ઽૈરડૈર઻વૈયદ%ઐવરૄઇ)%ફ઻ષ઺ઐૅ%઼ઐ%ઃયર૎

My main question is how to make this string to readable format.

 public class ConnectDatabase extends Activity {
        private SimpleDBAdapter mDbHelper;
        private ListView list;
         private Typeface font;
         private String android_id;
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            android_id = Secure.getString(getBaseContext().getContentResolver(),
                    Secure.ANDROID_ID);
            Log.i("me",android_id+"");
            Log.i("TAG","android.os.Build.SERIAL: " + Build.SERIAL);

            list = (ListView) findViewById(R.id.simpleListView);
            mDbHelper = new SimpleDBAdapter(ConnectDatabase.this);
            mDbHelper.createDatabase();
            mDbHelper.open();
            font = Typeface.createFromAsset(getAssets(), "mit.ttf");

            String[] values = mDbHelper.getEditTextValue();

            list.setAdapter( new MyCustAdapt(values));





        }




        class MyCustAdapt extends BaseAdapter{

            public String[] strv ;
            public LayoutInflater fInflater;
            public MyCustAdapt(String[] valuesstr) {
                // TODO Auto-generated constructor stub
                strv = valuesstr;
            }

            @Override
            public int getCount() {
                // TODO Auto-generated method stub
                return strv.length;
            }

            @Override
            public Object getItem(int position) {
                // TODO Auto-generated method stub
                return position;
            }

            @Override
            public long getItemId(int position) {
                // TODO Auto-generated method stub
                return position;
            }

            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                // TODO Auto-generated method stub


                LayoutInflater inflater = getLayoutInflater();
                View row;
                row = inflater.inflate(R.layout.mainlist_item, parent,false);

                TextView t = (TextView)row.findViewById(R.id.twAddress);

                t.setTypeface(font);
                t.setText(strv[position]);

               Log.i("Image",""+strv[position]);

                    return(row);
            }

        }
    }

Upvotes: 0

Views: 133

Answers (1)

Add your Gujarati font inside the assets folder of your Android Application and use this code as below

Assuming textBox is name of your TextView

TextView myTextView=(TextView)findViewById(R.id.textBox);
Typeface typeFace=Typeface.createFromAsset(getAssets(),"fonts/gujarati.ttf");
myTextView.setTypeface(typeFace);

Upvotes: 1

Related Questions