-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDetailsActivity.java
More file actions
74 lines (58 loc) · 2.65 KB
/
DetailsActivity.java
File metadata and controls
74 lines (58 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.example.yusuph.andela;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import static android.R.attr.id;
import static com.example.yusuph.andela.R.id.imageV;
import static com.example.yusuph.andela.R.id.url;
import static com.example.yusuph.andela.R.id.username;
public class DetailsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
TextView tv = (TextView)findViewById(R.id.share);
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBody = "Checkout this awesome developers" + username + url;
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
}
});
TextView tvv = (TextView) findViewById(R.id.textView5);
tvv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("http://www.google.com")));
}
});
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
ab.setHomeButtonEnabled(true);
}
TextView unameP = (TextView) findViewById(R.id.textView2);
TextView addressP = (TextView) findViewById(R.id.textView5);
ImageView imgV = (ImageView) findViewById(R.id.imageView2);
Context context;
Intent intent = getIntent();
String username = intent.getStringExtra("username");
String url = intent.getStringExtra("url");
String img = intent.getStringExtra("img");
Integer imageId = this.getResources().getIdentifier(img,"drawable", this.getPackageName());
unameP.setText(username);
addressP.setText(url);
imgV.setImageResource(imageId);
ab.setTitle(username + " Profile's");
}
}