com.android.phone.InCallScreen activity

by Ruben » Fri, 03 Apr 2009 00:16:22 GMT


Sponsored Links
 Is it possible to intercept the intent of calling and answering and by
doing that replacing the calling/answering screen. I see from the
logcat that right now com.android.phone.InCallScreen activity is been
started. Anyway to overwrite that to have my own activity to show up?

--~--~---------~--~----~------------~-------~--~----~



com.android.phone.InCallScreen activity

by Ruben » Fri, 03 Apr 2009 00:16:35 GMT


 Is it possible to intercept the intent of calling and answering and by
doing that replacing the calling/answering screen. I see from the
logcat that right now com.android.phone.InCallScreen activity is been
started. Anyway to overwrite that to have my own activity to show up?

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Android GData (Calendar)

Hi

I'm working on a program whose job is to parse a schema from a course
at university (html) and synchronize it with a calendar in Google
Calendar.
A must-have requirements from the author is that the user must enter
their user information (x...@gmail.com) then connect via the Calendar
API to calendar services.
** The smartphone calendar via Intent is not okay to use **

The main problem is that there is no GData (Dalvik Java) for Android.
But I checked on GitHub and found that there seems to be something
going on com.google.wireless.gdata: 
http://android.git.kernel.org/?p=platform/external/gdata.git,a=summary
Searched around and found some packets like simply-android-GData and
GData on code.google.com, but none of them help with the structure of
calendrar, and they can login to retrieve data rss, json, atom.

So my question is then whether someone has a solution that works quite
well as a possible. next update of the SDK will provide, a full GData
API?

Is it possible to compile a custom SDK from git and get with the
functionality of git://android.git.kernel.org/platform/external/gdata.git?

Or do you have any other solution that might work?

Minimum functionality:
View Calendars
View Events
Add Events
Delete Events

Happy Easter
Johan

-- 

2. Calling new thread to update some images

Hi,

I'm trying to call a thread on a button click (btn_more) but i cant
get it right. The thread is to get some data and update the images. If
i retrieve info and update 4 or 5 images then it works fine. But if i
load more than 5 images i will get a force close. At times when the
internet is slow I will face the same problem too. Can please help me
to solve this problem or provide me some guidance? Here is the error i
got from LogCat:

04-19 18:51:44.907: ERROR/AndroidRuntime(1034): Uncaught handler:
thread main exiting due to uncaught exception 04-19 18:51:44.927:
ERROR/AndroidRuntime(1034): java.lang.NullPointerException 04-19
18:51:44.927: ERROR/AndroidRuntime(1034): at
mobile9.android.gallery.GalleryWallpapers.setWallpaperThumb(GalleryWallpapers.java:
383) 04-19 18:51:44.927: ERROR/AndroidRuntime(1034): at
mobile9.android.gallery.GalleryWallpapers.access
$4(GalleryWallpapers.java:320) 04-19 18:51:44.927: ERROR/
AndroidRuntime(1034): at mobile9.android.gallery.GalleryWallpapers
$1.handleMessage(GalleryWallpapers.java:266) 04-19 18:51:44.927: ERROR/
AndroidRuntime(1034): at
android.os.Handler.dispatchMessage(Handler.java:99) 04-19
18:51:44.927: ERROR/AndroidRuntime(1034): at
android.os.Looper.loop(Looper.java:123) 04-19 18:51:44.927: ERROR/
AndroidRuntime(1034): at
android.app.ActivityThread.main(ActivityThread.java:4310) 04-19
18:51:44.927: ERROR/AndroidRuntime(1034): at
java.lang.reflect.Method.invokeNative(Native Method) 04-19
18:51:44.927: ERROR/AndroidRuntime(1034): at
java.lang.reflect.Method.invoke(Method.java:521) 04-19 18:51:44.927:
ERROR/AndroidRuntime(1034): at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860) 04-19 18:51:44.927:
ERROR/AndroidRuntime(1034): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 04-19
18:51:44.927: ERROR/AndroidRuntime(1034): at
dalvik.system.NativeStart.main(Native Method)

My Code :

private static final String rootURL = "http://www.uploadhub.com/";

    private int wallpapers_count = 0;

    private int ringtones_count = 0;

    private int index = 0;

    private int folder_id;

    private int page;

    private int page_counter = 1;

    private String family;

    private String keyword;

    private String xmlURL = "";

    private String thread_op = "xml";

    private ImageButton btn_back;

    private ImageButton btn_home;

    private ImageButton btn_filter;

    private ImageButton btn_search;

    private TextView btn_more;

    private ProgressDialog pd;

    GalleryExampleHandler myExampleHandler = new
GalleryExampleHandler();


    Context context = GalleryWallpapers.this.getBaseContext();

    Drawable image;


    @Override

    public void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);

            MODEL = "HTC Legend";  // **needs to be remove after
testing**

            try {

                 MODEL = URLEncoder.encode(MODEL,"UTF-8");

            } catch (UnsupportedEncodingException e) {

                    // TODO Auto-generated catch block

                    e.printStackTrace();

            }
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.gallerywallpapers);
            Bundle b = this.getIntent().getExtras();
            family = b.getString("fm").trim();
            folder_id = Integer.parseInt(b.getString("fi"));
            keyword = b.getString("kw").trim();
            page = Integer.parseInt(b.getString("page").trim());
            WindowManager w = getWindowManager();
            Display d = w.getDefaultDisplay();
            final int width = d.getWidth();
            final int height = d.getHeight();
            xmlURL = rootURL + "wallpapers/1/?
output=rss&afm=wallpapers&mdl=" + MODEL + "&awd=" + width + "&aht=" +
height;
            if (folder_id > 0) {
                  xmlURL = xmlURL + "&fi=" + folder_id;
            }

            pd = ProgressDialog.show(GalleryWallpapers.this, "",
            "Loading...", true, false);
            Thread thread = new Thread(GalleryWallpapers.this);
            thread.start();

            btn_more = (TextView) findViewById(R.id.btn_more);

            btn_more.setOnClickListener(new View.OnClickListener() {
                  public void onClick(View view) {
                            myExampleHandler.filenames.clear();
                            myExampleHandler.authors.clear();
                            myExampleHandler.duration.clear();
                            myExampleHandler.fileid.clear();

 
btn_more.setBackgroundResource(R.drawable.btn_more_click);
                            page = page + 1;
                            thread_op = "xml";
                            xmlURL = rootURL + "wallpapers/1/?
output=rss&afm=wallpapers&mdl=" + MODEL + "&awd=" + width + "&aht=" +
height;
                            xmlURL = xmlURL + "&pg2=" + page;
                            index = 0;
                            pd =
ProgressDialog.show(GalleryWallpapers.this, "",
                    "Loading...", true, false);
                            Thread thread = new
Thread(GalleryWallpapers.this);
                            thread.start();
                       }
                 });

   }


        public void run() {
            if(thread_op.equalsIgnoreCase("xml")){
                     readXML();
            }
            else if(thread_op.equalsIgnoreCase("getImg")){
                     getWallpaperThumb();
            }
            handler.sendEmptyMessage(0);
         }

         private Handler handler = new Handler() {
    @Override
    public void handleMessage(Message msg) {
        int count = 0;
        if (!myExampleHandler.filenames.isEmpty()){
            count = myExampleHandler.filenames.size();
        }
        count = 6;
        if(thread_op.equalsIgnoreCase("xml")){
            pd.dismiss();
            thread_op = "getImg";
            btn_more.setBackgroundResource(R.drawable.btn_more);
        }
        else if(thread_op.equalsIgnoreCase("getImg")){
            setWallpaperThumb();
            index++;
            if (index < count){
                Thread thread = new Thread(GalleryWallpapers.this);
                thread.start();

            }
        }
    }
};

    private void readXML(){
    if (xmlURL.length() != 0) {
        try {
            /* Create a URL we want to load some xml-data from. */
            URL url = new URL(xmlURL);
            /* Get a SAXParser from the SAXPArserFactory. */
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();

            /* Get the XMLReader of the SAXParser we created. */
            XMLReader xr = sp.getXMLReader();
            /*
             * Create a new ContentHandler and apply it to the
             * XML-Reader
             */
            xr.setContentHandler(myExampleHandler);

            /* Parse the xml-data from our URL. */
            xr.parse(new InputSource(url.openStream()));
            /* Parsing has finished. */

            /*
             * Our ExampleHandler now provides the parsed data to
             * us.
             */
            ParsedExampleDataSet parsedExampleDataSet =
myExampleHandler
                    .getParsedData();

        } catch (Exception e) {
            //showDialog(DIALOG_SEND_LOG);
        }
    }
}

    private void getWallpaperThumb(){
           int i = this.index;
           if (!
myExampleHandler.filenames.elementAt(i).toString().equalsIgnoreCase(""))
{
                     image = ImageOperations(context,
                myExampleHandler.thumbs.elementAt(i).toString(),
"image.jpg");
           }
     }

      private void setWallpaperThumb(){
            int i = this.index;
            if (myExampleHandler.filenames.elementAt(i).toString() !=
null) {
                    String file_info =
myExampleHandler.filenames.elementAt(i).toString();
                    String author = "\nby " +
myExampleHandler.authors.elementAt(i).toString();
                    final String folder =
myExampleHandler.folder_id.elementAt(folder_id).toString();
                    final String fid =
myExampleHandler.fileid.elementAt(i).toString();
                    ImageView imgView = new ImageView(context);
                    TextView tv_filename = null;
                    TextView tv_author = null;

                    switch (i + 1) {
                            case 1:
                                  imgView = (ImageView)
findViewById(R.id.image1);
                                  tv_filename = (TextView)
findViewById(R.id.filename1);
                                  tv_author = (TextView)
findViewById(R.id.author1);
                                  break;
                            case 2:
                                  imgView = (ImageView)
findViewById(R.id.image2);
                                  tv_filename = (TextView)
findViewById(R.id.filename2);
                                  tv_author = (TextView)
findViewById(R.id.author2);
                                  break;
                            case 3:
                                  imgView = (ImageView)
findViewById(R.id.image3);
                                  tv_filename = (TextView)
findViewById(R.id.filename3);
                                  tv_author = (TextView)
findViewById(R.id.author3);
                                  break;
            case 4:
                .
                                    .
                                    .
                                    .
                                    .
            case 10:
                                  imgView = (ImageView)
findViewById(R.id.image10);
                                  tv_filename = (TextView)
findViewById(R.id.filename10);
                                  tv_author = (TextView)
findViewById(R.id.author10);
                                  break;
                    }
                    if (image.getIntrinsicHeight() > 0) {
                         imgView.setImageDrawable(image);
                    } else {
 
imgView.setImageResource(R.drawable.default_wallpaper);
                    }
                    tv_filename.setText(file_info);
                    tv_author.setText(author);
                    imgView.setOnClickListener(new
View.OnClickListener() {
                           public void onClick(View view) {
                // Perform action on click
            }
        });
    }
}

    private Drawable ImageOperations(Context ctx, String url,
            String saveFilename) {
            try {
                    InputStream is = (InputStream) this.fetch(url);
                    Drawable d = Drawable.createFromStream(is, "src");
                    return d;
            } catch (MalformedURLException e) {
                    e.printStackTrace();
                    return null;
            } catch (IOException e) {
                    e.printStackTrace();
                    return null;
            }
     }

  }

-- 

3. What format and tools do you use for music in your games?

4. Is camcorder emulation supposed to work for the android?

5. Android Camera Issue

6. Doubt In Eclipse Plugin Development

7. android.widget.DigitalClock