Code example for Intent

Methods: getActiongetCategoriesgetComponentgetDatagetIntExtragetPackagegetType, fillIn

0
        assertSame(self, intent);
    } 
 
    @Test 
    public void shouldFillIn() throws Exception { 
        Intent intentA = new Intent();
        Intent intentB = new Intent();
 
        intentB.setAction("foo");
        Uri uri = Uri.parse("http://www.foo.com");
        intentB.setDataAndType(uri, "text/html");
        String category = "category";
        intentB.addCategory(category);
        intentB.setPackage("com.foobar.app");
        ComponentName cn = new ComponentName("com.foobar.app", "fragmentActivity");
        intentB.setComponent(cn);
        intentB.putExtra("FOO", 23);
 
        int flags = Intent.FILL_IN_ACTION |
                Intent.FILL_IN_DATA |
                Intent.FILL_IN_CATEGORIES |
                Intent.FILL_IN_PACKAGE |
                Intent.FILL_IN_COMPONENT;
 
        int result = intentA.fillIn(intentB, flags);
        assertEquals("foo", intentA.getAction());
        assertSame(uri, intentA.getData());
        assertEquals("text/html", intentA.getType());
        assertTrue(intentA.getCategories().contains(category));
        assertEquals("com.foobar.app", intentA.getPackage());
        assertSame(cn, intentA.getComponent());
        assertEquals(23, intentA.getIntExtra("FOO", -1));
        assertEquals(result, flags);
    } 
 
    @Test 
    public void equals_shouldTestActionComponentNameDataAndExtras() throws Exception {