경로 작성 시 루트 디렉토리로 이동하는 코드

<%=application.getContextPath()%>




<img src="<%=application.getContextPath()%>/img/img.png" alt="사진">




public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Button btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Intent msg = new Intent(Intent.ACTION_SEND);
msg.addCategory(Intent.CATEGORY_DEFAULT);
msg.putExtra(Intent.EXTRA_SUBJECT, "주제");
msg.putExtra(Intent.EXTRA_TEXT, "내용");
msg.putExtra(Intent.EXTRA_TITLE, "제목");
msg.setType("text/plain");
startActivity(Intent.createChooser(msg, "공유"));

}
});
}
}


+ Recent posts