Make Text View Editable upon longclick

by Srinivas VG » Tue, 05 Apr 2011 03:46:42 GMT


Sponsored Links
 Hi

I am new to android development. I was implementing a feature in
android where in upon long click of the Textview,it *should be
editable.upon long click of the contents set by textView,  I tried
in the listener method , I used the following:

textView.onEditorAction(MODE_WORLD_WRITEABLE)

But I was unable to perform the function...plz let me know if there
are any other approaches...

Thanks,
Srinivas

-- 



Re: Make Text View Editable upon longclick

by TreKing » Wed, 06 Apr 2011 01:06:55 GMT


 On Sat, Apr 2, 2011 at 11:00 PM, Srinivas VG




Swap the TextView out with an EditText.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 


Sponsored Links


Other Threads

1. Binding resources programmatically

Hi -

I'd like to know if its possible, from within a program, to get the id
of each resource in a particular res/ directory?

As an example, let's assume I'm building a method that will change the
background image every 20 seconds. I'd like the method to:

1. get the id's of every image in the res/drawable directory,
2. store the ids of those images in an array and
3. cycle through the array changing the background image every 20
seconds.

In code, it would look something like:

int [] drawableIDs = null;
String [] drawableNames = null;
...
// get a listing of all the resource names in the 'drawable' directory
drawableNames = getFileNamesFromResDirectory("drawable");

// return an array of resource IDs
drawableIDs = getMatchingResourceIDs( drawableNames );

Now, I don't care if it's exactly like the above. I just need to:

1. determine the contents of a res/ directory and
2. gain access to the id of each resource in the directory AND
3. do (1) and (2) in code.

If (1) and (2) are combined in a single method, fine. If they are in
distinct methods, that's also fine.


Thanks in advance,

Dr. Jake

-- 

2. dinamically textline in SimpleAdapter

Hi!

I'm junior in andoid programming.
I would like to make a application in which there is an edit text and
if you write in a number and press a button, it would dinamically show
as many textview lines as the given number. The problem is that I
cannot number the textview lines. For example, if I write ten in the
edit text and press the button than number 9 will appear at the
beginning of all the lines. Could you help me with this problem?

My codes:

The whole project:
http://digitus.itk.ppke.hu/~dolat/DynamicListItems.zip

Or:

package com.novoda;

import java.util.ArrayList;
import java.util.HashMap;
import android.app.ListActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.SimpleAdapter;

public class DynamicListItems extends ListActivity {

        private static final String ITEM_KEY = "key";
        ArrayList<HashMap<String, String>> list = new
ArrayList<HashMap<String, String>>();
        private EditText newValue;
        private SimpleAdapter notes;
        private int szam = 0;
        private int[] tomb = new int[10];
        private String[] key = new String[10];

        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.dynamic_list);

                newValue = (EditText) findViewById(R.id.new_value_field);

                notes = new SimpleAdapter(
                                this,
                                list,
                                R.layout.row,
                                new String[] { ITEM_KEY },
                                new int[] { R.id.list_value });

                Button ib = (Button) findViewById(R.id.button);

                ib.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View view) {
                                try {
                                        szam = 
Integer.valueOf(newValue.getText().toString()).intValue();
                                        HashMap<String, String> item = new 
HashMap<String, String>();
                                        list.clear();
                                        for(int i = 0;i < szam;i++){
                                                item.put(ITEM_KEY, i+". line");
                                                list.add(item);
                                        }
                                        setListAdapter(notes);

                                } catch (NullPointerException e) {
                                        Log.i("[Dinamikus elemek]", 
"Megprbltl hozzadni egy null
rtket.");
                                }
                        }
                });
        }
}



Thanks,
Attila

-- 

3. Direct audio between PC and droid device

4. Question about XML layout attributes and CustomView class

5. create TextView

6. Can an app upgrade itself?

7. webservice